[Mlir-commits] [mlir] [mlir][GPU] Add `RecursiveMemoryEffects` to `gpu.launch` (PR #75315)

Matthias Springer llvmlistbot at llvm.org
Tue Dec 19 00:00:06 PST 2023


================
@@ -227,3 +243,20 @@ func.func @make_subgroup_reduce_uniform() {
   }
   return
 }
+
+// -----
+
+// The GPU kernel does not have any side effecting ops, so the entire
----------------
matthias-springer wrote:

We discussed offline. The way CUDA streams are expressed in the GPU dialect is via async tokens. It would not make sense for `gpu.launch` and other ops to take an additional `%stream` operand in the future. We use async tokens (`%task`) for that.

Coming back to `RecursiveMemoryEffects`, this trait should be safe to attach. There are no side effects wrt. streams, because streams are encoded with async tokens.

Empty GPU kernels like the one in the test case will not simply DCE away if they impose a dependency via async tokens. (A folder or canonicalization pattern may find a way to remove empty kernels in a way that preserves the dependencies expressed by the async tokens.)


https://github.com/llvm/llvm-project/pull/75315


More information about the Mlir-commits mailing list