Skip to content

Commit 373a2f1

Browse files
undordorAradME
andauthored
[mlir][scf] ExecuteRegionOp bufferization to consider no_inline attr (#160697)
Fix a bug where ExecuteRegionOp bufferization dropped the "no_inline" attribute. Co-authored-by: Dor Arad <[email protected]>
1 parent b05101b commit 373a2f1

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ struct ExecuteRegionOpInterface
188188
TypeRange newResultTypes(yieldOp.getResults());
189189

190190
// Create new op and move over region.
191-
auto newOp =
192-
scf::ExecuteRegionOp::create(rewriter, op->getLoc(), newResultTypes);
191+
auto newOp = scf::ExecuteRegionOp::create(
192+
rewriter, op->getLoc(), newResultTypes, executeRegionOp.getNoInline());
193193
newOp.getRegion().takeBody(executeRegionOp.getRegion());
194194

195195
// Bufferize every block.

mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,20 @@ func.func @execute_region_test(%t1 : tensor<?xf32>)
380380

381381
// -----
382382

383+
// CHECK-LABEL: func @no_inline_execute_region_not_canonicalized
384+
func.func @no_inline_execute_region_not_canonicalized() {
385+
%c = arith.constant 42 : i32
386+
// CHECK: scf.execute_region
387+
// CHECK-SAME: no_inline
388+
%v = scf.execute_region -> i32 no_inline {
389+
scf.yield %c : i32
390+
}
391+
// CHECK: return
392+
return
393+
}
394+
395+
// -----
396+
383397
// CHECK: func private @some_external_func(memref<?xf32, strided<[?], offset: ?>>)
384398
func.func private @some_external_func(tensor<?xf32>)
385399

0 commit comments

Comments
 (0)