[mlir][Linalg] Avoid collapsing dimensions of linalg op that arent foldable.
authorMahesh Ravishankar <ravishankarm@google.com>
Tue, 9 May 2023 06:20:53 +0000 (06:20 +0000)
committerMahesh Ravishankar <ravishankarm@google.com>
Wed, 10 May 2023 05:45:02 +0000 (05:45 +0000)
commitf12639d0d674327876388cfde6b4d226359284ac
treef7e1ec8b06effd0ba5355e90210e2f5206c2fd30
parent92663cd46412a1711256e276f8c078ed1bd299e1
[mlir][Linalg] Avoid collapsing dimensions of linalg op that arent foldable.

The collapsing dimensions transformation is limited to only those
cases where the sequence of dimensions are contiguous in all the
ranges of the indexing maps of the operation. Add this check before
applying the transformation.

Differential Revision: https://reviews.llvm.org/D150176
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
mlir/test/Dialect/Linalg/collapse-dim.mlir