[Mlir-commits] [mlir] [mlir][linalg] set inbounds on `xfer_read/writes` for `assumeDynamicDimsMatchVecSizes ` (PR #160839)

Andrzej WarzyƄski llvmlistbot at llvm.org
Fri Sep 26 04:04:45 PDT 2025


================
@@ -524,6 +524,23 @@ VectorizationState::maskOperation(RewriterBase &rewriter, Operation *opToMask,
 
   if (!mask) {
     LDBG() << "No mask required";
+    if (assumeDynamicDimsMatchVecSizes) {
+      LDBG() << "Assuming dynamic dimensions match vector sizes!";
+      // Set inbounds to all-true.
----------------
banach-space wrote:

This comment tells me _what_ is happening, but that's also what the code says :) Could you instead clarify _why_ we need this extra step? I would also update the `LLDB` message.

Basically,
* xfer_read/xfer_write are special and hence this special treatment (this does not concern any other Ops)
* We need to set `in_bounds` explicitly as otherwise things further down the line will assume "out-of-bouds".

```suggestion
For vector.transfer_read and vector.transfer_write, there is also the `in-bounds` attribute that we need to set explicitly. Otherwise, "out-of-bounds" access will be assumed and masks will be generated. 
```

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


More information about the Mlir-commits mailing list