[Mlir-commits] [mlir] [mlir][vector] Determine vector sizes from the result shape for tensor.pad operation (PR #97248)
Han-Chung Wang
llvmlistbot at llvm.org
Mon Jul 1 09:36:53 PDT 2024
================
@@ -1055,3 +1055,35 @@ func.func @test_vectorize_unpack_no_vector_sizes_permute(%source: tensor<4x7x4xf
transform.yield
}
}
+
+ // -----
+
+// CHECK-LABEL: test_vectorize_pad_no_vector_sizes
+func.func @test_vectorize_pad_no_vector_sizes(%arg0: tensor<63x63xf32>) -> tensor<64x64xf32> {
+ %f0 = arith.constant 0.0 : f32
+ %pad = tensor.pad %arg0 low[0, 0] high[1, 1] {
+ ^bb0(%arg1: index, %arg2: index):
+ tensor.yield %f0 : f32
+ } : tensor<63x63xf32> to tensor<64x64xf32>
+ return %pad : tensor<64x64xf32>
+}
+// CHECK-DAG: %[[cst:.*]] = arith.constant 0.000000e+00 : f32
+// CHECK-DAG: %[[c0:.*]] = arith.constant 0 : index
+// CHECK-DAG: %[[c63:.*]] = arith.constant 63 : index
+// CHECK-DAG: %[[c63_0:.*]] = arith.constant 63 : index
+// CHECK: %[[mask:.*]] = vector.create_mask %[[c63]], %[[c63_0]] : vector<64x64xi1>
+// CHECK: %[[read:.*]] = vector.mask %0 { vector.transfer_read {{.*}}, %cst {in_bounds = [true, true]}
----------------
hanhanW wrote:
The approach is using in_bounds set to false when input vector sizes are not provided. Masking should only be used when input vector sizes are provided. Eventually we may get rid of in_bounds that when we would have to emulate its behavior from a masked operation.
https://github.com/llvm/llvm-project/pull/97248
More information about the Mlir-commits
mailing list