[mlir][Linalg] Handle fusion on tensors for projected permutation.
authorHanhan Wang <hanchung@google.com>
Fri, 4 Dec 2020 07:10:20 +0000 (23:10 -0800)
committerHanhan Wang <hanchung@google.com>
Fri, 4 Dec 2020 07:11:29 +0000 (23:11 -0800)
commitf5f1a5c2448e31f3c7e6f85b378372a02f8d3e43
tree79b118400d90eb52cf521a820fbef12f714208f9
parentf5d52916ce34f68a2fb4de69844f1b51b6bd0a13
[mlir][Linalg] Handle fusion on tensors for projected permutation.

In the past, the reshape op can be folded only if the indexing map is
permutation in consumer's usage. We can relax to condition to be projected
permutation.

This patch still limits the fusion for scalar cases. Scalar case is a corner
case, because we need to decide where to put extra dims.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D92466
mlir/include/mlir/Dialect/Linalg/Utils/Utils.h
mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
mlir/lib/Dialect/Linalg/Utils/Utils.cpp
mlir/test/Dialect/Linalg/reshape_fusion.mlir