[Mlir-commits] [mlir] [mlir][Vector] Make createWriteOrMaskedWrite utility (PR #190967)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Wed Apr 8 08:00:37 PDT 2026
================
@@ -129,3 +129,30 @@ module attributes {transform.with_named_sequence} {
transform.yield
}
}
+
+// -----
+
+// Test to check that createReadOrMaskedRead does not create trivial masks.
+
+// CHECK-LABEL: func @pad_no_op_exact_match
+// CHECK: vector.transfer_read {{.*}} {in_bounds = [true, true]} : tensor<2x4xf32>, vector<2x4xf32>
+// CHECK-NOT: vector.create_mask
+// CHECK-NOT: vector.mask
+// CHECK: vector.transfer_write {{.*}} {in_bounds = [true, true]} : vector<2x4xf32>, tensor<2x4xf32>
+func.func @pad_no_op_exact_match(%arg0: tensor<2x4xf32>) -> tensor<2x4xf32> {
+ %cst = arith.constant 0.0 : f32
+ %0 = tensor.pad %arg0 low[0, 0] high[0, 0] {
+ ^bb0(%i: index, %j: index):
+ tensor.yield %cst : f32
+ } : tensor<2x4xf32> to tensor<2x4xf32>
+ return %0 : tensor<2x4xf32>
+}
+
+module attributes {transform.with_named_sequence} {
+ transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
+ %0 = transform.structured.match ops{["tensor.pad"]} in %arg1
+ : (!transform.any_op) -> !transform.any_op
+ transform.structured.vectorize %0 vector_sizes [2, 4] : !transform.any_op
+ transform.yield
+ }
+}
----------------
banach-space wrote:
Note, even without this change, masks are not generated in this example. As in, this test isn't really exercising the change that you have made in this PR.
https://github.com/llvm/llvm-project/pull/190967
More information about the Mlir-commits
mailing list