[Openmp-commits] [PATCH] D141960: [Libomptarget][NFC] Rename device environment variable

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 17 12:28:20 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG566ecc223165: [Libomptarget][NFC] Rename device environment variable (authored by jhuber6).

Changed prior to commit:
  https://reviews.llvm.org/D141960?vs=489913&id=489918#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141960/new/

https://reviews.llvm.org/D141960

Files:
  openmp/libomptarget/DeviceRTL/src/Configuration.cpp
  openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
  openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
  openmp/libomptarget/plugins/cuda/src/rtl.cpp


Index: openmp/libomptarget/plugins/cuda/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -932,7 +932,7 @@
       if (const char *EnvStr = getenv("LIBOMPTARGET_DEVICE_RTL_DEBUG"))
         DeviceEnv.DebugKind = std::stoi(EnvStr);
 
-      const char *DeviceEnvName = "omptarget_device_environment";
+      const char *DeviceEnvName = "__omp_rtl_device_environment";
       CUdeviceptr DeviceEnvPtr;
       size_t CUSize;
 
Index: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -1708,7 +1708,7 @@
   // If the symbol is in .data (aomp, rocm) it can be written directly.
   // If it is in .bss, we must wait for it to be allocated space on the
   // gpu (trunk) and initialize after loading.
-  const char *sym() { return "omptarget_device_environment"; }
+  const char *sym() { return "__omp_rtl_device_environment"; }
 
   DeviceEnvironmentTy HostDeviceEnv;
   SymbolInfo SI;
@@ -2102,7 +2102,7 @@
   // per-image initialization work. Specifically:
   //
   // - Initialize an DeviceEnvironmentTy instance embedded in the
-  //   image at the symbol "omptarget_device_environment"
+  //   image at the symbol "__omp_rtl_device_environment"
   //   Fields DebugKind, DeviceNum, NumDevices. Used by the deviceRTL.
   //
   // - Allocate a large array per-gpu (could be moved to init_device)
Index: openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
===================================================================
--- openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
+++ openmp/libomptarget/plugins-nextgen/common/PluginInterface/PluginInterface.cpp
@@ -263,7 +263,7 @@
   DeviceEnvironment.DynamicMemSize = OMPX_SharedMemorySize;
 
   // Create the metainfo of the device environment global.
-  GlobalTy DevEnvGlobal("omptarget_device_environment",
+  GlobalTy DevEnvGlobal("__omp_rtl_device_environment",
                         sizeof(DeviceEnvironmentTy), &DeviceEnvironment);
 
   // Write device environment values to the device.
Index: openmp/libomptarget/DeviceRTL/src/Configuration.cpp
===================================================================
--- openmp/libomptarget/DeviceRTL/src/Configuration.cpp
+++ openmp/libomptarget/DeviceRTL/src/Configuration.cpp
@@ -25,26 +25,25 @@
 extern uint32_t __omp_rtl_assume_no_thread_state;
 extern uint32_t __omp_rtl_assume_no_nested_parallelism;
 
-// TODO: We want to change the name as soon as the old runtime is gone.
 // This variable should be visibile to the plugin so we override the default
 // hidden visibility.
-DeviceEnvironmentTy CONSTANT(omptarget_device_environment)
+DeviceEnvironmentTy CONSTANT(__omp_rtl_device_environment)
     __attribute__((used, retain, weak, visibility("protected")));
 
 uint32_t config::getDebugKind() {
-  return __omp_rtl_debug_kind & omptarget_device_environment.DebugKind;
+  return __omp_rtl_debug_kind & __omp_rtl_device_environment.DebugKind;
 }
 
 uint32_t config::getNumDevices() {
-  return omptarget_device_environment.NumDevices;
+  return __omp_rtl_device_environment.NumDevices;
 }
 
 uint32_t config::getDeviceNum() {
-  return omptarget_device_environment.DeviceNum;
+  return __omp_rtl_device_environment.DeviceNum;
 }
 
 uint64_t config::getDynamicMemorySize() {
-  return omptarget_device_environment.DynamicMemSize;
+  return __omp_rtl_device_environment.DynamicMemSize;
 }
 
 bool config::isDebugMode(config::DebugKind Kind) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141960.489918.patch
Type: text/x-patch
Size: 3711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230117/6fb17bec/attachment-0001.bin>


More information about the Openmp-commits mailing list