[Mlir-commits] [mlir] [mlir][Vector] Fix out-of-bounds crash unrolling create_mask/constant_mask with rank-mismatched native shape (PR #217514)
Aman Singh
llvmlistbot at llvm.org
Fri Aug 28 01:34:26 PDT 2026
amanyagami wrote:
@hamzaqureshi5 @banach-space — good news, no need for a separate patch: both parts are already in the current diff on this branch.
`padTargetShapeToRank` handles the leading-unit-dims padding (matching `UnrollElementwisePattern`'s existing approach), and `UnrollConstantMaskPattern` already normalizes an all-zero-in-one-dim tile to fully-zero via the same reasoning you two worked out above (`vector_constant_mask_empty_tile` test covers exactly the `[8, 8] : vector<16x16xi1>` case from your repro, plus the rank-mismatched interaction of the two).
Verified locally against the LLVM build here: reverting just the `.cpp` change (keeping the tests) reproduces the original OOB assert for `create_mask`/`constant_mask` with a rank-mismatched native shape, and separately reproduces the constant_mask verifier failure on an all-zero-in-one-dim tile without the empty-tile normalization; reapplying the fix passes both via `llvm-lit`.
@hamzaqureshi5 — thanks for digging into the empty-tile case independently, that discussion is what confirmed this needed both fixes together rather than just the rank padding. Let me know if you still see a case this doesn't cover.
https://github.com/llvm/llvm-project/pull/217514
More information about the Mlir-commits
mailing list