[Mlir-commits] [llvm] [mlir] [Linalg] Fix crash in vectorizeScalableVectorPrecondition with undersized vector sizes (PR #205493)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon Aug 3 05:38:03 PDT 2026
================
@@ -2381,6 +2381,18 @@ vectorizeScalableVectorPrecondition(Operation *op,
return success(isa<linalg::UnPackOp>(op));
}
+ // Ensure that the number of vector sizes and scalable flags provided by the
+ // user does not exceed the number of loops in the target Linalg op.
+ // Accessing iterator types with an out-of-bounds index would cause an
+ // assertion failure (SmallVector::operator[]). This check converts such a
+ // crash into a clean failure, allowing the transform interpreter to report
+ // an error gracefully.
+ // Regression test:
+ // mlir/test/Dialect/Vector/transform-op-vector-to-llvm.mlir
+ if (inputScalableVecDims.size() > linalgOp.getNumLoops() ||
+ inputVectorSizes.size() > linalgOp.getNumLoops())
----------------
banach-space wrote:
> I can think of unit dimensions maybe being an exception here (not sure), but are there other examples where a stricter equality is not required?
I can't think of a specific example myself. Even for unit dimensions, IMO it's less confusing when _all_ dims are specified.
https://github.com/llvm/llvm-project/pull/205493
More information about the Mlir-commits
mailing list