[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:55:17 PDT 2026
https://github.com/SabYic created https://github.com/llvm/llvm-project/pull/196012
Reject gpu.launch_func ops that have both async dependencies and an explicit async object.
>From 466743ee52a1cad1a70ae7b94e5e5bd1bae12af8 Mon Sep 17 00:00:00 2001
From: SabYic <sunwenjia04 at 163.com>
Date: Wed, 6 May 2026 14:52:02 +0800
Subject: [PATCH] [mlir][gpu] Reject conflicting async operands on
gpu.launch_func
Reject gpu.launch_func ops that have both async dependencies and an
explicit async object.
Changes to be committed:
modified: mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
modified: mlir/test/Dialect/GPU/invalid.mlir
---
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp | 4 ++++
mlir/test/Dialect/GPU/invalid.mlir | 19 +++++++++++++++++++
2 files changed, 23 insertions(+)
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