[Mlir-commits] [mlir] [NFC] Simplify the tiling implementation using cloning. (PR #72178)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Nov 14 23:06:56 PST 2023


================
@@ -169,17 +174,25 @@ static SmallVector<scf::ForOp> generateTileLoopNest(
     }
 
     auto loop = builder.create<scf::ForOp>(
-        loc, offset, size, tileSize, ValueRange{},
+        loc, offset, size, tileSize, destinationTensors,
         [&](OpBuilder &bodyBuilder, Location bodyLoc, Value iv,
             ValueRange /*iterArgs*/) {
           sizes[loopRange.index()] =
               getBoundedTileSize(bodyBuilder, bodyLoc, loopRange.value(), iv,
                                  getAsOpFoldResult(tileSize));
-          builder.create<scf::YieldOp>(loc);
         });
     offsets[loopRange.index()] = loop.getInductionVar();
     loops.push_back(loop);
-    builder.setInsertionPoint(loop.getBody()->getTerminator());
+    builder.setInsertionPointToEnd(loop.getBody());
+    destinationTensors = loop.getRegionIterArgs();
+  }
+
+  // Add the scf.yield operations for all the outer loops.
+  for (auto [outerLoop, innerLoop] :
+       llvm::zip(MutableArrayRef(loops).drop_back(),
----------------
MaheshRavishankar wrote:

unnecessary? We are dropping the range by 1 on the same range. SO they have to be the same (maybe empty, but still equal)

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


More information about the Mlir-commits mailing list