[Mlir-commits] [mlir] [MLIR] Add pattern to bubble up tensor.extract_slice (PR #126898)

ofri frishman llvmlistbot at llvm.org
Fri Feb 14 06:46:04 PST 2025


================
@@ -582,6 +582,7 @@ transform::FuseOp::apply(transform::TransformRewriter &rewriter,
     RewritePatternSet patterns(context);
     tensor::ExtractSliceOp::getCanonicalizationPatterns(patterns, context);
     tensor::populateMergeConsecutiveInsertExtractSlicePatterns(patterns);
+    tensor::populateBubbleUpExtractSliceOpPatterns(patterns);
----------------
ofri-frishman wrote:

I agree that the pattern "unblocks" fusion of operations into a single tiling loop nest. 
I think that also other patterns used for cleanup assist with that. 
>From what I understand, the concept of adding a possibility to cleanup between fusion steps was added precisely for this reason. As part of the thread in https://discourse.llvm.org/t/rfc-split-fusion-portions-of-the-tilinginterface-into-a-new-interface/81155 the idea to add such a step was proposed, and it was first implement in https://github.com/llvm/llvm-project/pull/109554. 
The lit tests added in that PR show cases where previously fusion would have got stuck, but after the change they do not. So, I thought it would make sense to add this pattern to the cleanup patterns as well.
But perhaps I misunderstood something about the nature and use of the cleanup patterns.
How otherwise would you suggest to add the ability to apply this pattern between fusion steps of `FuseOp`?

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


More information about the Mlir-commits mailing list