This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Make sure linearizeCollapsedDims doesn't drop input map dims
ClosedPublic

Authored by ThomasRaoux on Nov 30 2021, 6:47 PM.

Details

Summary

The new affine map generated by linearizeCollapsedDims should not drop
dimensions. We need to make sure we create a map with at least as many
dimensions as the source map. This prevents
FoldProducerReshapeOpByLinearization from generating invalid IR.

This solves regression in IREE due to https://github.com/llvm/llvm-project/commit/e4e4da86aff5606ef792d987a3ec85639219228c

Diff Detail

Event Timeline

ThomasRaoux created this revision.Nov 30 2021, 6:47 PM
ThomasRaoux requested review of this revision.Nov 30 2021, 6:47 PM
mravishankar accepted this revision.Nov 30 2021, 9:47 PM
mravishankar added inline comments.
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
395

I am not entirely sure about the number of symbols. The number of symbols should be the same as the number of symbols in {resultExprs}, so this might degenerate to that in most cases. In any case not blocking this on that.

This revision is now accepted and ready to land.Nov 30 2021, 9:47 PM
ThomasRaoux added inline comments.Nov 30 2021, 10:37 PM
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
395

I don't fully understand but this was the reason for the previous change in https://github.com/llvm/llvm-project/commit/e4e4da86aff5606ef792d987a3ec85639219228c. Unfortunately there were no tests along with the commit.