[Mlir-commits] [mlir] 9d9f1ee - [mlir][gpu] Reject conflicting async operands on gpu.launch_func (#196012)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 6 05:54:10 PDT 2026


Author: Phoenixtree
Date: 2026-05-06T08:54:05-04:00
New Revision: 9d9f1eea82919cfa940637290f2af71380ba9102

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

LOG: [mlir][gpu] Reject conflicting async operands on gpu.launch_func (#196012)

Reject gpu.launch_func ops that have both async dependencies and an
explicit async object.

Added: 
    

Modified: 
    mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
    mlir/test/Dialect/GPU/invalid.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index d3fb6df2010d2..f776129c77405 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -1341,6 +1341,10 @@ LogicalResult LaunchFuncOp::verify() {
              << "expects types of the cluster dimensions must be the same";
   }
 
+  if (!getAsyncDependencies().empty() && getAsyncObject())
+    return emitOpError(
+        "cannot have both async dependencies and an explicit async object");
+
   return success();
 }
 

diff  --git a/mlir/test/Dialect/GPU/invalid.mlir b/mlir/test/Dialect/GPU/invalid.mlir
index bf862b2c5ae3c..fb01bf0bcce9c 100644
--- a/mlir/test/Dialect/GPU/invalid.mlir
+++ b/mlir/test/Dialect/GPU/invalid.mlir
@@ -222,6 +222,25 @@ module attributes {gpu.container_module} {
 
 // -----
 
+module attributes {gpu.container_module} {
+  gpu.module @kernels {
+    gpu.func @kernel_1() kernel {
+      gpu.return
+    }
+  }
+
+  func.func @launch_func_async_deps_and_async_object(%sz : index,
+                                                     %stream : !llvm.ptr) {
+    %dep = gpu.wait async
+    // expected-error at +1 {{cannot have both async dependencies and an explicit async object}}
+    %t = gpu.launch_func async [%dep] <%stream : !llvm.ptr> @kernels::@kernel_1
+        blocks in (%sz, %sz, %sz) threads in (%sz, %sz, %sz)
+    return
+  }
+}
+
+// -----
+
 module attributes {gpu.container_module} {
   gpu.module @kernels {
     gpu.func @kernel_1(%arg1 : !llvm.ptr) {


        


More information about the Mlir-commits mailing list