[llvm] [offload][omp] Move reading _kernel_environment to libomptarget (PR #222606)
Alex Duran via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 5 02:06:54 PDT 2026
================
@@ -459,8 +463,65 @@ static int loadImagesOntoDevice(DeviceTy &Device) {
REPORT() << "Failed to write symbol for USM " << Entry.SymbolName;
} else if (Entry.Address) {
if (Device.RTL->get_function(Binary, Entry.SymbolName,
- &DeviceEntry.Address) != OFFLOAD_SUCCESS)
+ &DeviceEntry.Address) !=
+ OFFLOAD_SUCCESS) {
REPORT() << "Failed to load kernel " << Entry.SymbolName;
+ } else {
+ // 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.
+
+ SmallString<128> EnvName(Entry.SymbolName);
+ EnvName += "_kernel_environment";
+ KernelEnvironmentTy KernelEnv{};
+ void *KernelEnvPtr = nullptr;
+ bool ReadOk =
+ Device.RTL->get_global(Binary, sizeof(KernelEnv),
----------------
adurang wrote:
Not a particular one, but get_global is used in other places in the library currently.
https://github.com/llvm/llvm-project/pull/222606
More information about the llvm-commits
mailing list