[mlir][Linalg] Enhance Linalg fusion on generic op and tensor_reshape op.
The tensor_reshape op was only fusible only if it is a collapsing case. Now we propagate the op to all the operands so there is a further chance to fuse it with generic op. The pre-conditions are: 1) The producer is not an indexed_generic op. 2) All the shapes of the operands are the same. 3) All the indexing maps are identity. 4) All the loops are parallel loops. 5) The producer has a single user. It is possible to fuse the ops if the producer is an indexed_generic op. We still can compute the original indices. E.g., if the reshape op collapses the d0 and d1, we can use DimOp to get the width of d1, and calculate the index `d0 * width + d1`. Then replace all the uses with it. However, this pattern is not implemented in the patch. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D86314
Loading
Please register or sign in to comment