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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 2 07:07:39 PDT 2026


================
@@ -239,6 +239,10 @@ static bool isSplatWriteConsistentWithMaskedRead(vector::TransferWriteOp write,
 
 bool mlir::vector::checkSameValueRAW(vector::TransferWriteOp defWrite,
                                      vector::TransferReadOp read) {
+  // An enclosing vector.mask leaves some lanes unwritten or padded, so the
+  // read does not see the written vector as a whole.
+  if (defWrite.isMasked() || read.isMasked())
----------------
Vaisman wrote:

No. An all-true constant mask is folded away by `MaskOp::fold`, which uses the same `getMaskFormat` check and moves the operation out of the region. Canonicalization can then fold the unmasked read; I verified this with `vector.constant_mask [4]`.

Treating an all-true region mask as unmasked in the helpers would only matter when `transferOpflowOpt` runs before canonicalization, and I can add that if you think it is useful. `TransferReadAfterWriteToBroadcast` would keep the strict check either way because it creates several operations.


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


More information about the Mlir-commits mailing list