[Openmp-commits] [openmp] 31f434e - [Libomptarget][NFC] Clean up CUDA plugin and address warnings

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Tue Sep 6 13:29:17 PDT 2022


Author: Joseph Huber
Date: 2022-09-06T15:28:57-05:00
New Revision: 31f434ee3b06e99bff86adc8bae7fd6ba705c097

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

LOG: [Libomptarget][NFC] Clean up CUDA plugin and address warnings

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/cuda/src/rtl.cpp b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
index 2916a2d723381..a52e03000bee0 100644
--- a/openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -163,8 +163,8 @@ struct DeviceDataTy {
   unsigned int BlocksPerGrid = 0;
   unsigned int WarpSize = 0;
   // OpenMP properties
-  int NumTeams = 0;
-  int NumThreads = 0;
+  unsigned int NumTeams = 0;
+  unsigned int NumThreads = 0;
 };
 
 /// Resource allocator where \p T is the resource type.
@@ -329,8 +329,8 @@ class DeviceRTLTy {
   int NumberOfDevices;
   // OpenMP environment properties
   int EnvNumTeams;
-  int EnvTeamLimit;
-  int EnvTeamThreadLimit;
+  unsigned int EnvTeamLimit;
+  unsigned int EnvTeamThreadLimit;
   // OpenMP requires flags
   int64_t RequiresFlags;
   // Amount of dynamic shared memory to use at launch.
@@ -1147,7 +1147,7 @@ class DeviceRTLTy {
       CudaThreadsPerBlock = DeviceData[DeviceId].NumThreads;
     }
 
-    if (CudaThreadsPerBlock > DeviceData[DeviceId].ThreadsPerBlock) {
+    if ((unsigned)CudaThreadsPerBlock > DeviceData[DeviceId].ThreadsPerBlock) {
       DP("Threads per block capped at device limit %d\n",
          DeviceData[DeviceId].ThreadsPerBlock);
       CudaThreadsPerBlock = DeviceData[DeviceId].ThreadsPerBlock;
@@ -1527,20 +1527,20 @@ int32_t __tgt_rtl_is_valid_binary(__tgt_device_image *Image) {
   return elf_check_machine(Image, /* EM_CUDA */ 190);
 }
 
-int32_t __tgt_rtl_is_valid_binary_info(__tgt_device_image *image,
-                                       __tgt_image_info *info) {
-  if (!__tgt_rtl_is_valid_binary(image))
+int32_t __tgt_rtl_is_valid_binary_info(__tgt_device_image *Image,
+                                       __tgt_image_info *Info) {
+  if (!__tgt_rtl_is_valid_binary(Image))
     return false;
 
   // A subarchitecture was not specified. Assume it is compatible.
-  if (!info || !info->Arch)
+  if (!Info || !Info->Arch)
     return true;
 
   int32_t NumberOfDevices = 0;
   if (cuDeviceGetCount(&NumberOfDevices) != CUDA_SUCCESS)
     return false;
 
-  StringRef ArchStr = StringRef(info->Arch).drop_front(sizeof("sm_") - 1);
+  StringRef ArchStr = StringRef(Info->Arch).drop_front(sizeof("sm_") - 1);
   for (int32_t DeviceId = 0; DeviceId < NumberOfDevices; ++DeviceId) {
     CUdevice Device;
     if (cuDeviceGet(&Device, DeviceId) != CUDA_SUCCESS)
@@ -1564,7 +1564,7 @@ int32_t __tgt_rtl_is_valid_binary_info(__tgt_device_image *image,
       return false;
   }
 
-  DP("Image has compatible compute capability: %s\n", info->Arch);
+  DP("Image has compatible compute capability: %s\n", Info->Arch);
   return true;
 }
 


        


More information about the Openmp-commits mailing list