[Mlir-commits] [mlir] [MLIR][Linalg] Add static shape masking option in vectorization (PR #214812)

Federico Bruzzone llvmlistbot at llvm.org
Wed Aug 12 07:04:12 PDT 2026


================

----------------
FedericoBruzzone wrote:

If I understand the example correctly, the problem is that we have a dynamic input (e.g., `B: 32xN`) that is padded to a static shape (`32x64`) so that the `linalg.matmul` can be vectorized without masking. 

The resulting matmul output is therefore also statically shaped (`128x64`), but only the first `N` columns are semantically valid.

The issue appears when this result is consumed by reductions such as `maximumf` and `minimumf`: since the padding value cannot be neutral for both reductions (`-inf` would be neutral for `maximumf`, while `+inf` would be neutral for `minimumf`), the reductions must ignore the padded columns.

So, if I understand correctly, this PR is about allowing the vectorizer to keep the static `128x64` vector shape, while applying a mask based on the original dynamic dimension size `N` to the subsequent reductions. 

Is this the intended problem/use case that the new `mask_bounds` mechanism is addressing?

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


More information about the Mlir-commits mailing list