[Mlir-commits] [mlir] [MLIR] Add pattern to bubble up tensor.extract_slice (PR #126898)
Matthias Gehre
llvmlistbot at llvm.org
Wed Feb 12 23:46:11 PST 2025
mgehre-amd wrote:
> I agree that the patterns in mlir/lib/Dialect/Tensor/Transforms/ReshapePatterns.cpp are similar. The pattern I added is meant to swap between expand_shape and extract_slice which when used as a cleanup pattern for tile and fuse utility enables adding the expand_shape into a loop nest even though it does not implement the tiling interface. I'm not familiar the the use of the other patterns, but don't think it is related to tiling. I placed it in a separate file since I thought that other patterns that bubble up extract_slice through tensor ops could be placed there as well, so the emphasis is more on the extract_slice than on the expand_shape. But currently there is only one such pattern, so it could be placed together with the other reshape patterns. But it would still require a separate populate function, since only this pattern should be added to the FuseOp cleanup patterns. BTW there is another place with a similar pattern - in mlir/lib/Dialect/Linalg/Transforms/BubbleUpExtractSlice.cpp there is a pattern that bubbles up a extract_slice through a linalg op. Given this, if you think that the best place for this pattern is in mlir/lib/Dialect/Tensor/Transforms/ReshapePatterns.cpp I can move it to there
Ok, make sense to me. Thanks for the analysis! Discoverability has been a big headache for me: There are many useful patterns, but its really hard to find whether a certain pattern already exists.
You can't probably do much about it in this PR.
Anyway, your patterns looks very useful, so thanks for the PR!
https://github.com/llvm/llvm-project/pull/126898
More information about the Mlir-commits
mailing list