-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[mlir][async]: Make async.execute operation with RecursiveMemoryEffects trait #116544
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
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-mlir Author: Aviad Cohen (AviadCo) ChangesFull diff: https://github.com/llvm/llvm-project/pull/116544.diff 2 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
index 33b67921752346..011bffd02a90c5 100644
--- a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
+++ b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
@@ -38,7 +38,8 @@ def Async_ExecuteOp :
["getEntrySuccessorOperands",
"areTypesCompatible"]>,
AttrSizedOperandSegments,
- AutomaticAllocationScope]> {
+ AutomaticAllocationScope,
+ Pure]> {
let summary = "Asynchronous execute operation";
let description = [{
The `body` region attached to the `async.execute` operation semantically
diff --git a/mlir/test/Dialect/Async/canonicalize.mlir b/mlir/test/Dialect/Async/canonicalize.mlir
new file mode 100644
index 00000000000000..1a74eaa344e169
--- /dev/null
+++ b/mlir/test/Dialect/Async/canonicalize.mlir
@@ -0,0 +1,10 @@
+// RUN: mlir-opt %s -split-input-file -canonicalize | FileCheck %s
+
+// CHECK-NOT: async.execute
+
+func.func @empty_execute() {
+ %token = async.execute {
+ async.yield
+ }
+ return
+}
|
@llvm/pr-subscribers-mlir-async Author: Aviad Cohen (AviadCo) ChangesFull diff: https://github.com/llvm/llvm-project/pull/116544.diff 2 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
index 33b67921752346..011bffd02a90c5 100644
--- a/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
+++ b/mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
@@ -38,7 +38,8 @@ def Async_ExecuteOp :
["getEntrySuccessorOperands",
"areTypesCompatible"]>,
AttrSizedOperandSegments,
- AutomaticAllocationScope]> {
+ AutomaticAllocationScope,
+ Pure]> {
let summary = "Asynchronous execute operation";
let description = [{
The `body` region attached to the `async.execute` operation semantically
diff --git a/mlir/test/Dialect/Async/canonicalize.mlir b/mlir/test/Dialect/Async/canonicalize.mlir
new file mode 100644
index 00000000000000..1a74eaa344e169
--- /dev/null
+++ b/mlir/test/Dialect/Async/canonicalize.mlir
@@ -0,0 +1,10 @@
+// RUN: mlir-opt %s -split-input-file -canonicalize | FileCheck %s
+
+// CHECK-NOT: async.execute
+
+func.func @empty_execute() {
+ %token = async.execute {
+ async.yield
+ }
+ return
+}
|
Can you elaborate on the motivation and the correctness in the description of this PR please? |
Sure, the case I have is
In some phase, I reach the point where the
In this case, I would expect that the whole
Keeping my specific flow apart, it seems legic to remove the execute region if it has no usages and have no memory effects like |
22ac2cb
to
469fe8c
Compare
@joker-eph I confused between |
I have a hard time convincing me about correctness right now, but I can't imagine what can go wrong either: "submitting a task" isn't really side-effect free, but here it is more specifically "submitting a side-effect free task". So I would tend to agree with this patch. It'd be nice if @sanjoy or @River707 would give a second opinion :) |
No description provided.