[clang] [llvm] [Offload] Unify the kernel argument passing (PR #205224)

Piotr Balcer via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 05:49:03 PDT 2026


================
@@ -99,7 +99,10 @@ struct GenELF64KernelTy : public GenericKernelTy {
                            "cooperative kernel launch not supported for host");
     // TODO: The data will need to be copied locally if we ever support
     //       asynchronous kernel launches in the host interface.
-    Func(LaunchParams.Data);
+    llvm::SmallVector<void *, 16> Buffer(LaunchParams.NumArgs);
+    for (uint32_t I = 0; I < LaunchParams.NumArgs; ++I)
+      Buffer[I] = *reinterpret_cast<void **>(LaunchParams.Args[I]);
+    Func(LaunchParams.NumArgs ? Buffer.data() : nullptr);
----------------
pbalcer wrote:

I started working on the same cleanup, and I approached the host plugin launch kernel slightly differently, see this [PR](https://github.com/llvm/llvm-project/pull/205355). Converting the argument pointers array to a flat buffer will work only as long as arguments are pointer-sized. Which is fine for OpenMP, but might become a problem once we start using the host plugin elsewhere (like in SYCL, but I know this would require far more changes to this plugin).

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


More information about the cfe-commits mailing list