[Mlir-commits] [mlir] [mlir][gpu] Reject conflicting async operands on gpu.launch_func (PR #196012)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue May 5 23:56:23 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-gpu
Author: Phoenixtree (SabYic)
<details>
<summary>Changes</summary>
Reject gpu.launch_func ops that have both async dependencies and an explicit async object.
---
Full diff: https://github.com/llvm/llvm-project/pull/196012.diff
2 Files Affected:
- (modified) mlir/lib/Dialect/GPU/IR/GPUDialect.cpp (+4)
- (modified) mlir/test/Dialect/GPU/invalid.mlir (+19)
``````````diff
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) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/196012
More information about the Mlir-commits
mailing list