[llvm] [offload][omp] Move reading _kernel_environment to libomptarget (PR #222606)
Alex Duran via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 05:51:54 PDT 2026
================
@@ -461,6 +466,67 @@ static int loadImagesOntoDevice(DeviceTy &Device) {
if (Device.RTL->get_function(Binary, Entry.SymbolName,
&DeviceEntry.Address) != OFFLOAD_SUCCESS)
REPORT() << "Failed to load kernel " << Entry.SymbolName;
+
+ // Read this kernel's launch-geometry properties once, from its
+ // "<name>_kernel_environment" device global, and cache them on
+ // the device for use at launch time.
+ std::string EnvName =
+ std::string(Entry.SymbolName) + "_kernel_environment";
+ KernelEnvironmentTy KernelEnv{};
+ void *KernelEnvPtr = nullptr;
+ bool ReadOk =
+ Device.RTL->get_global(Binary, sizeof(KernelEnv), EnvName.c_str(),
+ &KernelEnvPtr) == OFFLOAD_SUCCESS &&
+ Device.RTL->data_retrieve(DeviceId, &KernelEnv, KernelEnvPtr,
+ sizeof(KernelEnv)) == OFFLOAD_SUCCESS;
+ if (!ReadOk) {
----------------
adurang wrote:
As far as I could see, we don't generate them for the host target (there were massive regressions without this) nor also ompx_bare kernels.
So, while it could go in theory go away I think it would require changes on the codegen that I'd prefer not to do here.
https://github.com/llvm/llvm-project/pull/222606
More information about the llvm-commits
mailing list