[llvm-branch-commits] [llvm] [offload] Copy the kernel launch environment with a direct-write memcpy (PR #231923)

Alex Duran via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 28 13:51:55 PDT 2026


================
@@ -772,12 +772,22 @@ getKernelLaunchEnvironment(DeviceTy &Device, uint32_t OmpABIVersion,
     freeAfterSynchronization(Device, AsyncInfo, *ReductionAllocOrErr);
   }
 
-  if (Device.submitData(*AllocOrErr, &LocalKLE,
-                        sizeof(KernelLaunchEnvironmentTy), AsyncInfo,
-                        /*Entry=*/nullptr, /*HDTTMapPtr=*/nullptr,
-                        /*Loc=*/nullptr, /*Name=*/"KernelLaunchEnv"))
+  INFO(OMP_INFOTYPE_DATA_TRANSFER, Device.DeviceID,
+       "Copying data from host to device, HstPtr=" DPxMOD ", TgtPtr=" DPxMOD
+       ", Size=%" PRId64 ", Name=KernelLaunchEnv\n",
+       DPxPTR(&LocalKLE), DPxPTR(*AllocOrErr),
+       sizeof(KernelLaunchEnvironmentTy));
+
+  // The allocation is fresh, so no work pending on the queue accesses it and
+  // the copy can bypass the queue. Without a queue, the plugin may write the
+  // memory directly.
+  if (const auto *Res = olMemcpy(
----------------
adurang wrote:

Any reason to use olMemcpy directly here? I think you could use submitDataSync.

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


More information about the llvm-branch-commits mailing list