[Mlir-commits] [mlir] [mlir][tensor] Forward concat insert_slice destination into DPS provider (PR #183490)

Han-Chung Wang llvmlistbot at llvm.org
Tue Mar 31 09:14:19 PDT 2026


================
@@ -246,6 +246,7 @@ struct InsertSliceOfInsertSliceFolder : public OpRewritePattern<OpTy> {
 
 void tensor::populateFoldTensorSubsetOpPatterns(RewritePatternSet &patterns) {
   populateFoldTensorSubsetIntoVectorTransferPatterns(patterns);
+  populateForwardConcatInsertSliceDestPatterns(patterns);
----------------
hanhanW wrote:

Hi, this patch is making the below MLIR file infinite loop. This pattern conflicts with `FoldEmptyTensorWithExtractSliceOp` from `populateFoldTensorEmptyPatterns`. See the repro from @sommerlukas : https://gist.github.com/sommerlukas/3fb0ebbd02a2c2ea30cef281cc6924bc

I wonder why does this new pattern belong to `populateFoldTensorSubsetOpPatterns`? IIUC, this suite of patterns is mainly for the folding for read/write pairs like `extract_slice/insert_slice`, `transfer_read/transfer_write` and further folding on the load chain or store chain. You already have `populateForwardConcatInsertSliceDestPatterns` that can populate your special pattern, why do we include that in this pattern suite?

Is it easier for writing tests or there is a reason for doing that? I wonder if we can remove this line, which keeps the intention of the this pattern suite the same. Thanks!

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


More information about the Mlir-commits mailing list