[Mlir-commits] [mlir] [mlir][linalg] Fix crash in tile_reduction when output map has constant exprs (PR #189166)

Mehdi Amini llvmlistbot at llvm.org
Thu Apr 2 04:02:24 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.
----------------
joker-eph wrote:

OK so I updated it now, we're handling AffineConstantExpr on top of AffineDimExpr everywhere (hopefully).

I added test coverage to cover mixing dynamic and static dimensions, including non 1-dim constant. I hope I got all the cases now!

https://github.com/llvm/llvm-project/pull/189166


More information about the Mlir-commits mailing list