[Mlir-commits] [mlir] [mlir][vector] Add an eliminate-vector-masks pass (PR #226517)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Sep 25 08:07:00 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Dhairyashil R G (dhairyashilRG)
<details>
<summary>Changes</summary>
`eliminateVectorMasks` had no in-tree caller other than a test pass, so no pipeline could use it. This exposes it as an opt-in `-eliminate-vector-masks` pass and drops the test pass.
The pass rewrites `vector.create_mask` ops that can be proven all-true into `vector.constant_mask`; canonicalization then folds those away, so a masked transfer becomes an unmasked one. Mask sizes are bounded with `ValueBoundsOpInterface`, so a loop-derived size like `%dim - %iv` can be proven.
Scalable dimensions need a `vscale` range, given by `vscale-min`/`vscale-max`. Leaving them unset means fixed-size reasoning only; a half-specified or inverted range is rejected rather than silently ignored.
`eliminate-masks.mlir` keeps its checks and only switches its two RUN lines, which shows the pass behaves as the test pass did.
Follow-up to #<!-- -->221595, and the pass promised when #<!-- -->215340 was closed.
Context: https://discourse.llvm.org/t/rfc-should-vector-transfer-read-write-keep-in-bounds-measurements-on-the-masking-alternative/91649
Assisted-by: Claude
---
Full diff: https://github.com/llvm/llvm-project/pull/226517.diff
5 Files Affected:
- (modified) mlir/include/mlir/Dialect/Vector/Transforms/Passes.td (+24)
- (modified) mlir/lib/Dialect/Vector/Transforms/VectorMaskElimination.cpp (+33)
- (added) mlir/test/Dialect/Vector/eliminate-masks-invalid-options.mlir (+11)
- (modified) mlir/test/Dialect/Vector/eliminate-masks.mlir (+2-2)
- (modified) mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp (-35)
``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````
</details>
https://github.com/llvm/llvm-project/pull/226517
More information about the Mlir-commits
mailing list