[Mlir-commits] [mlir] [mlir][Vector] Fix out-of-bounds crash unrolling create_mask/constant_mask with rank-mismatched native shape (PR #217514)
Federico Bruzzone
llvmlistbot at llvm.org
Sat Sep 5 01:53:34 PDT 2026
================
@@ -127,6 +127,26 @@ getTargetShape(const vector::UnrollVectorOptions &options, Operation *op) {
return targetShape;
}
+/// Returns `targetShape` left-padded with unit dimensions so that it has the
+/// same rank as `originalShape`.
+///
+/// The native/target shape returned by `getTargetShape` is only required to
+/// divide the *trailing* dimensions of the op being unrolled (see
+/// `computeShapeRatio`), so it may have a smaller rank than the op itself.
+/// Tiling with the padded shape is equivalent - the leading dimensions are
+/// simply unrolled one element at a time - and keeps the offsets, sizes and
+/// strides rank-aligned with the op's vector type.
----------------
FedericoBruzzone wrote:
```suggestion
/// The native/target shape returned by `getTargetShape` is only required to
/// divide the *trailing* dimensions of the op being unrolled, so it may have a
/// smaller rank than the op itself.
/// Tiling with the padded shape is equivalent and keeps the offsets, sizes
/// and strides rank-aligned with the op's vector type.
```
https://github.com/llvm/llvm-project/pull/217514
More information about the Mlir-commits
mailing list