[Mlir-commits] [mlir] f080f11 - [mlir][scf] Create constants for tiling in parent with isolated region.

Oleg Shyshkov llvmlistbot at llvm.org
Fri Mar 31 09:28:03 PDT 2023


Author: Oleg Shyshkov
Date: 2023-03-31T18:27:30+02:00
New Revision: f080f1122f42ec71571081343f7ef2dcc237a02c

URL: https://github.com/llvm/llvm-project/commit/f080f1122f42ec71571081343f7ef2dcc237a02c
DIFF: https://github.com/llvm/llvm-project/commit/f080f1122f42ec71571081343f7ef2dcc237a02c.diff

LOG: [mlir][scf] Create constants for tiling in parent with isolated region.

FuncOp is IsolatedFromAbove, so this change doesn't alter current behaviour, but the current code fails if the tile op is in an op with IsolatedFromAbove trait.

An alternative would be to create constant in the same region where they're used a rely on CSE to figure out where to move them.

Differential Revision: https://reviews.llvm.org/D147273

Added: 
    

Modified: 
    mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
index ec116df700aae..544a863c8ffe4 100644
--- a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
@@ -37,7 +37,9 @@ scf::SCFTilingOptions::setTileSizes(ArrayRef<int64_t> ts) {
   tileSizeComputationFunction = [tileSizes](OpBuilder &b, Operation *op) {
     OpBuilder::InsertionGuard guard(b);
     b.setInsertionPointToStart(
-        &op->getParentOfType<func::FuncOp>().getBody().front());
+        &op->getParentWithTrait<OpTrait::IsIsolatedFromAbove>()
+             ->getRegion(0)
+             .front());
     return llvm::to_vector<4>(map_range(tileSizes, [&](int64_t s) {
       Value v = b.create<arith::ConstantIndexOp>(op->getLoc(), s);
       return v;


        


More information about the Mlir-commits mailing list