[Mlir-commits] [mlir] [mlir][linalg] Fix crash in tile_reduction when output map has constant exprs (PR #189166)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Mar 31 09:13:02 PDT 2026
================
@@ -538,7 +553,13 @@ struct LinalgOpPartialReductionInterface
// Append the new partial result dimensions.
SmallVector<OpFoldResult> partialResultShape;
+ Attribute one = IntegerAttr::get(IndexType::get(b.getContext()), 1);
for (AffineExpr dimExpr : partialMap.getResults()) {
+ if (isa<AffineConstantExpr>(dimExpr)) {
+ // A constant index in the output map means the dimension has size 1.
----------------
MaheshRavishankar wrote:
This is not necessarily true. You can have a constant indexing map when the shape in the tensor operand is not one. In general IMO having constant expression in indexing map is not the best way to lower to Linalg operations, but there are use cases that use this and we cannot change the verifier to do this.
Having a handling for constant indexing is probably good, but I am not sure we can assert that the shape is one.
https://github.com/llvm/llvm-project/pull/189166
More information about the Mlir-commits
mailing list