[Mlir-commits] [mlir] [mlir][vector] Add tests for scalable vectors in bufferize-invalid.mlir (PR #102361)

Cullen Rhodes llvmlistbot at llvm.org
Fri Aug 9 00:45:54 PDT 2024


================
@@ -6,3 +6,12 @@ func.func @mask(%t0: tensor<?xf32>, %val: vector<16xf32>, %idx: index, %m0: vect
   %0 = vector.mask %m0 { vector.transfer_write %val, %t0[%idx] : vector<16xf32>, tensor<?xf32> } : vector<16xi1> -> tensor<?xf32>
   return %0 : tensor<?xf32>
 }
+
+// -----
+
+// CHECK-LABEL: func @mask_scalable(
+func.func @mask_scalable(%t0: tensor<?xf32>, %val: vector<[16]xf32>, %idx: index, %m0: vector<[16]xi1>) -> tensor<?xf32> {
+  // expected-error @+1 {{'vector.mask' op body must bufferize in-place}}
----------------
c-rhodes wrote:

just looking at the pattern I see it's bufferizing mask ops so tensors are converted to memrefs and it creates a new mask op. Given the vector type is simply forwarded during bufferization (for both one-shot and out of place) I struggle to see where this could go wrong for scalable vectors.

I'm not particularly concerned about this one tbh and think it would be fine to leave it, but I did notice there's a TODO in https://github.com/llvm/llvm-project/blob/main/mlir/test/Dialect/Vector/bufferize.mlir#L47-L48

which refers to a positive test for this pattern for one shot https://github.com/llvm/llvm-project/blob/main/mlir/test/Dialect/Vector/one-shot-bufferize.mlir#L6-L13

so could add a positive test there for scalable vectors that should be noticed when this is addressed?

https://github.com/llvm/llvm-project/pull/102361


More information about the Mlir-commits mailing list