Skip to content

Commit e4e4da8

Browse files
arnab-cerebrasbondhugula
authored andcommitted
[MLIR] Prevent creation of buggy affine map after linearizing collapsed dimensions of source map
Initially we were passing wrong numSymbols argument while calling AffineMap::get() for creaating affine map with linearized result expressions. The main problems was the number of symbols of the newly to be created map may be different from that of the source map, as new symbolic identifiers may be introduced while creating strided layout linearized expressions. Reviewed By: nicolasvasilache, bondhugula Differential Revision: https://reviews.llvm.org/D114240
1 parent 09401df commit e4e4da8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,7 @@ static AffineMap linearizeCollapsedDims(AffineMap sourceMap,
385385
makeCanonicalStridedLayoutExpr(sizes, dimExprs, context);
386386
resultExprs.push_back(linearizedExpr);
387387
}
388-
return AffineMap::get(sourceMap.getNumDims(), sourceMap.getNumSymbols(),
389-
resultExprs, context);
388+
return AffineMap::inferFromExprList({resultExprs}).front();
390389
}
391390

392391
// TensorExpandShapeOp is fusable with its consumer (i.e. reshape as a

0 commit comments

Comments
 (0)