[Mlir-commits] [mlir] [SCF] Set Insertion point after the root op when tiling using scf.for_all (PR #76874)

Nirvedh Meshram llvmlistbot at llvm.org
Wed Jan 3 14:51:22 PST 2024


https://github.com/nirvedhmeshram created https://github.com/llvm/llvm-project/pull/76874

This is consistent with that is done for tiling with scf.for utility

Co-authored-by: Abhishek Varma <abhvarma at amd.com>

>From 799d39e4f34153201e6a3ad61615cbc2db2b0e34 Mon Sep 17 00:00:00 2001
From: Nirvedh Meshram <nmeshram at amd.com>
Date: Wed, 3 Jan 2024 22:42:38 +0000
Subject: [PATCH] [SCF] Set Insertion point after the root op when tiling using
 scf.for_all

This is consistent with that is done for tiling with scf.for

Co-authored-by: Abhishek Varma <abhvarma at amd.com>
---
 mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
index 1b6b4db9d20907..71f6ab7f063bcf 100644
--- a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
@@ -804,6 +804,7 @@ mlir::scf::tileUsingSCFForallOp(RewriterBase &rewriter, TilingInterface op,
                                 const scf::SCFTilingOptions &options) {
   Location loc = op->getLoc();
   OpBuilder::InsertionGuard g(rewriter);
+  rewriter.setInsertionPointAfter(op);
 
   // 1. Get the range of loops that are represented by the operation.
   SmallVector<Range> loopRanges = op.getIterationDomain(rewriter);
@@ -843,6 +844,7 @@ mlir::scf::tileUsingSCFForallOp(RewriterBase &rewriter, TilingInterface op,
   // 6. Create the ForallOp. We don't use the lambda body-builder
   // version because we require the use of RewriterBase in the body, so we
   // manually move the insertion point to the body below.
+  rewriter.setInsertionPointAfter(op);
   auto forallOp =
       rewriter.create<scf::ForallOp>(loc, lbs, ubs, steps, dest, mappingAttr);
 



More information about the Mlir-commits mailing list