[mlir][linalg] Constant fold linalg.generic that are transposes
authorLei Zhang <antiagainst@google.com>
Fri, 8 Oct 2021 12:06:31 +0000 (08:06 -0400)
committerLei Zhang <antiagainst@google.com>
Fri, 8 Oct 2021 12:09:13 +0000 (08:09 -0400)
commit4cd7ff6728f440234def491be380e5af62f34b83
treeed5123b3e2a5f9bba34a7b6e46818a39e8064216
parent80c27abb2f74aa439ba381148186407ebae1793e
[mlir][linalg] Constant fold linalg.generic that are transposes

This commit adds a pattern to perform constant folding on linalg
generic ops which are essentially transposes. We see real cases
where model importers may generate such patterns.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D110597
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
mlir/test/Dialect/Linalg/fusion-elementwise-ops.mlir