-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[mlir][scf] ExecuteRegionOp bufferization to consider no_inline attr #160697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
joker-eph
merged 6 commits into
llvm:main
from
undor:undor/execute_region_bufferize_no_inline
Sep 25, 2025
Merged
[mlir][scf] ExecuteRegionOp bufferization to consider no_inline attr #160697
joker-eph
merged 6 commits into
llvm:main
from
undor:undor/execute_region_bufferize_no_inline
Sep 25, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ With the latest revision this PR passed the C/C++ code formatter. |
87adfdd
to
7017e48
Compare
7017e48
to
cd3fcbe
Compare
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-bufferization Author: Dor Arad (undor) ChangesFix a bug where ExecuteRegionOp bufferization dropped the "no_inline" attribute. Full diff: https://github.com/llvm/llvm-project/pull/160697.diff 2 Files Affected:
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index fb179e64d8e7b..47c99642b9c37 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -188,8 +188,8 @@ struct ExecuteRegionOpInterface
TypeRange newResultTypes(yieldOp.getResults());
// Create new op and move over region.
- auto newOp =
- scf::ExecuteRegionOp::create(rewriter, op->getLoc(), newResultTypes);
+ auto newOp = scf::ExecuteRegionOp::create(
+ rewriter, op->getLoc(), newResultTypes, executeRegionOp.getNoInline());
newOp.getRegion().takeBody(executeRegionOp.getRegion());
// Bufferize every block.
diff --git a/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir b/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
index eb0093106dc11..6054a61912532 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
@@ -380,6 +380,20 @@ func.func @execute_region_test(%t1 : tensor<?xf32>)
// -----
+// CHECK-LABEL: func @no_inline_execute_region_not_canonicalized
+func.func @no_inline_execute_region_not_canonicalized() {
+ %c = arith.constant 42 : i32
+ // CHECK: scf.execute_region
+ // CHECK-SAME: no_inline
+ %v = scf.execute_region -> i32 no_inline {
+ scf.yield %c : i32
+ }
+ // CHECK: return
+ return
+}
+
+// -----
+
// CHECK: func private @some_external_func(memref<?xf32, strided<[?], offset: ?>>)
func.func private @some_external_func(tensor<?xf32>)
|
joker-eph
approved these changes
Sep 25, 2025
mahesh-attarde
pushed a commit
to mahesh-attarde/llvm-project
that referenced
this pull request
Oct 3, 2025
…lvm#160697) Fix a bug where ExecuteRegionOp bufferization dropped the "no_inline" attribute. Co-authored-by: Dor Arad <dor.arad@mobileye.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix a bug where ExecuteRegionOp bufferization dropped the "no_inline" attribute.