[Mlir-commits] [mlir] [mlir][vector] Determine vector sizes from the result shape for tensor.pad operation (PR #97248)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Wed Jul 10 07:39:13 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]}
----------------
banach-space wrote:
> First I don't see any essential difference between inferring the vectorize size from the result shape and setting the vectorize size directly. They both provide vector size finally.
How do you infer sizes when the input shapes are dynamic?
> I try to figure out why we prefer to use `in_bounds` other than `mask`, I may find some reasons here.
There's a lot of discussion about the semantics `in_bounds` ATM. I am trying to clarify some of it here:
* https://github.com/llvm/llvm-project/pull/97049
> But when the input vector sizes are provided why we can use mask operation?
I do believe that masks and `in_bounds` model slightly different things, but the distinction is not well documented ATM.
https://github.com/llvm/llvm-project/pull/97248
More information about the Mlir-commits
mailing list