[Openmp-commits] [openmp] ba0af88 - [libomptarget][amdgpu][nfc] Make grid value access match devicertl

Jon Chesterfield via Openmp-commits openmp-commits at lists.llvm.org
Wed Aug 25 07:11:25 PDT 2021


Author: Jon Chesterfield
Date: 2021-08-25T15:11:19+01:00
New Revision: ba0af885e700fa939734820ce355933f1556119c

URL: https://github.com/llvm/llvm-project/commit/ba0af885e700fa939734820ce355933f1556119c
DIFF: https://github.com/llvm/llvm-project/commit/ba0af885e700fa939734820ce355933f1556119c.diff

LOG: [libomptarget][amdgpu][nfc] Make grid value access match devicertl

Added: 
    

Modified: 
    openmp/libomptarget/plugins/amdgpu/src/rtl.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
index b86f6788eda4..9b00080ff2fb 100644
--- a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -436,6 +436,10 @@ struct EnvironmentVariables {
   int MaxTeamsDefault;
 };
 
+static constexpr const llvm::omp::GV &getGridValue() {
+  return llvm::omp::AMDGPUGridValues;
+}
+
 /// Class containing all the device information
 class RTLDeviceInfoTy {
   std::vector<std::list<FuncOrGblEntryTy>> FuncGblEntries;
@@ -504,11 +508,10 @@ class RTLDeviceInfoTy {
   static const unsigned HardTeamLimit =
       (1 << 16) - 1; // 64K needed to fit in uint16
   static const int DefaultNumTeams = 128;
-  static const int Max_Teams = llvm::omp::AMDGPUGridValues.GV_Max_Teams;
-  static const int Warp_Size = llvm::omp::AMDGPUGridValues.GV_Warp_Size;
-  static const int Max_WG_Size = llvm::omp::AMDGPUGridValues.GV_Max_WG_Size;
-  static const int Default_WG_Size =
-      llvm::omp::AMDGPUGridValues.GV_Default_WG_Size;
+  static const int Max_Teams = getGridValue().GV_Max_Teams;
+  static const int Warp_Size = getGridValue().GV_Warp_Size;
+  static const int Max_WG_Size = getGridValue().GV_Max_WG_Size;
+  static const int Default_WG_Size = getGridValue().GV_Default_WG_Size;
 
   using MemcpyFunc = hsa_status_t (*)(hsa_signal_t, void *, const void *,
                                       size_t size, hsa_agent_t,
@@ -1057,9 +1060,8 @@ int32_t __tgt_rtl_init_device(int device_id) {
     DP("Queried wavefront size: %d\n", wavefront_size);
     DeviceInfo.WarpSize[device_id] = wavefront_size;
   } else {
-    DP("Default wavefront size: %d\n",
-       llvm::omp::AMDGPUGridValues.GV_Warp_Size);
-    DeviceInfo.WarpSize[device_id] = llvm::omp::AMDGPUGridValues.GV_Warp_Size;
+    DP("Default wavefront size: %d\n", getGridValue().GV_Warp_Size);
+    DeviceInfo.WarpSize[device_id] = getGridValue().GV_Warp_Size;
   }
 
   // Adjust teams to the env variables


        


More information about the Openmp-commits mailing list