[mlir] [llvm] [mlir][tensor] Fold linalg transpose with tensor pack (PR #74206)

Prathamesh Tagore via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 14:07:04 PST 2023


meshtag wrote:

To keep this patch modular and easy-to-review, I have dropped the case where `linalg.transpose` is the producer op and `tensor.pack` is the consumer op. I'd prefer adding support for it once we agree on the current state of things. 

> Can you add a isTranspose(linalg::LinalgOp op) util to [Linalg/Utils/Utils.h/cpp](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Linalg/Utils/Utils.cpp)?

I can do that, but I think the change will not be directly related to this PR, shall we do it separately later? 


> We have some utils for applying permutations. Can you try to use applyPermutationToVector and invertPermutationVector from [IndexingUtils.h](https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Dialect/Utils/IndexingUtils.h)?

In the current version of this patch, the permutation application is not very straightforward as we actually check some things in between while applying the permutation. I feel using `applyPermutationToVector` would drag readability down. Let me know what you think of it.  

https://github.com/llvm/llvm-project/pull/74206


More information about the llvm-commits mailing list