[Mlir-commits] [mlir] Keep attributes on bufferization of execute_region. (PR #165381)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Oct 28 05:44:55 PDT 2025
https://github.com/ddubov100 created https://github.com/llvm/llvm-project/pull/165381
None
>From 7cc2a4f037487eacb360d533e5cc81376ae4d076 Mon Sep 17 00:00:00 2001
From: dubov diana <ddubov at mobileye.com>
Date: Tue, 28 Oct 2025 14:43:18 +0200
Subject: [PATCH] Keep attributes on bufferization of execute_region.
---
.../Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp | 1 +
.../Bufferization/Transforms/one-shot-module-bufferize.mlir | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
index 47c99642b9c37..c4b23b5d8c0c6 100644
--- a/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -190,6 +190,7 @@ struct ExecuteRegionOpInterface
// Create new op and move over region.
auto newOp = scf::ExecuteRegionOp::create(
rewriter, op->getLoc(), newResultTypes, executeRegionOp.getNoInline());
+ newOp->setAttrs(executeRegionOp->getAttrs());
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 8db1ebb87a1e5..fa4f6dfa9de40 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/one-shot-module-bufferize.mlir
@@ -369,10 +369,11 @@ func.func private @execute_region_test(%t1 : tensor<?xf32>)
// CHECK-NOT: alloc
// CHECK-NOT: copy
// CHECK: memref.store %{{.*}}, %[[m1]][%{{.*}}]
- %0, %1, %2 = scf.execute_region -> (f32, tensor<?xf32>, f32) {
+ %0, %1, %2 = scf.execute_region -> (f32, tensor<?xf32>, f32) no_inline {
%t2 = tensor.insert %f2 into %t1[%idx] : tensor<?xf32>
scf.yield %f1, %t2, %f2 : f32, tensor<?xf32>, f32
- }
+ // CHECK: {test.custom_attr = "custom_value"}
+ } {test.custom_attr = "custom_value"}
// CHECK: return %{{.*}}, %{{.*}} : f32, f32
return %0, %1, %2 : f32, tensor<?xf32>, f32
More information about the Mlir-commits
mailing list