[Mlir-commits] [mlir] [mlir][vector] Account for vector.mask in transfer RAW/WAW checks (PR #228328)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Oct 5 12:46:06 PDT 2026


================
@@ -2020,6 +2020,25 @@ func.func @negative_store_to_load_tensor(%arg0 : tensor<4x4xf32>,
 
 // -----
 
+// A read under vector.mask does not see the written vector in the masked-off
+// lanes, so it must not fold to it.
+// CHECK-LABEL: func @negative_store_to_load_tensor_region_masked_read
+//       CHECK:   vector.transfer_write
+//       CHECK:   %[[R:.*]] = vector.mask %{{.*}} { vector.transfer_read
+//       CHECK:   return %[[R]] : vector<4xf32>
+func.func @negative_store_to_load_tensor_region_masked_read(%arg0 : tensor<4xf32>,
+  %v0 : vector<4xf32>, %mask : vector<4xi1>) -> vector<4xf32> {
+  %c0 = arith.constant 0 : index
+  %cf0 = arith.constant 0.0 : f32
+  %w0 = vector.transfer_write %v0, %arg0[%c0] {in_bounds = [true]} :
+    vector<4xf32>, tensor<4xf32>
+  %0 = vector.mask %mask { vector.transfer_read %w0[%c0], %cf0 {in_bounds = [true]} :
+    tensor<4xf32>, vector<4xf32> } : vector<4xi1> -> vector<4xf32>
+  return %0 : vector<4xf32>
+}
----------------
Vaisman wrote:

Done in 31f0194: the RAW and WAW cases now reuse `@store_to_load_tensor` and `@dead_store_tensor` (the broadcast one already did).

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


More information about the Mlir-commits mailing list