[Openmp-commits] [PATCH] D116963: [openmp][amdgpu] Replace unsigned long with uint64_t

Jon Chesterfield via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 10 11:08:19 PST 2022


JonChesterfield created this revision.
JonChesterfield added reviewers: brooks, arsenm, ronlieb.
Herald added subscribers: kerbowa, guansong, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
JonChesterfield requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1, wdng.
Herald added a reviewer: jdoerfert.
Herald added a project: OpenMP.

Some types need to be 64 bit. Unsigned long is a hazard there.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116963

Files:
  openmp/libomptarget/plugins/amdgpu/impl/internal.h
  openmp/libomptarget/plugins/amdgpu/src/rtl.cpp


Index: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -43,8 +43,8 @@
 // linked as --whole-archive to override the weak symbols that are used to
 // implement a fallback for toolchains that do not yet have a hostrpc library.
 extern "C" {
-unsigned long hostrpc_assign_buffer(hsa_agent_t agent, hsa_queue_t *this_Q,
-                                    uint32_t device_id);
+uint64_t hostrpc_assign_buffer(hsa_agent_t agent, hsa_queue_t *this_Q,
+                               uint32_t device_id);
 hsa_status_t hostrpc_init();
 hsa_status_t hostrpc_terminate();
 
@@ -52,8 +52,8 @@
 __attribute__((weak)) hsa_status_t hostrpc_terminate() {
   return HSA_STATUS_SUCCESS;
 }
-__attribute__((weak)) unsigned long
-hostrpc_assign_buffer(hsa_agent_t, hsa_queue_t *, uint32_t device_id) {
+__attribute__((weak)) uint64_t hostrpc_assign_buffer(hsa_agent_t, hsa_queue_t *,
+                                                     uint32_t device_id) {
   DP("Warning: Attempting to assign hostrpc to device %u, but hostrpc library "
      "missing\n",
      device_id);
@@ -1231,8 +1231,8 @@
         // under a multiple reader lock, not a writer lock.
         static pthread_mutex_t hostcall_init_lock = PTHREAD_MUTEX_INITIALIZER;
         pthread_mutex_lock(&hostcall_init_lock);
-        unsigned long buffer = hostrpc_assign_buffer(
-            DeviceInfo.HSAAgents[device_id], queue, device_id);
+        uint64_t buffer = hostrpc_assign_buffer(DeviceInfo.HSAAgents[device_id],
+                                                queue, device_id);
         pthread_mutex_unlock(&hostcall_init_lock);
         if (!buffer) {
           DP("hostrpc_assign_buffer failed, gpu would dereference null and "
Index: openmp/libomptarget/plugins/amdgpu/impl/internal.h
===================================================================
--- openmp/libomptarget/plugins/amdgpu/impl/internal.h
+++ openmp/libomptarget/plugins/amdgpu/impl/internal.h
@@ -34,13 +34,13 @@
 #define MAX_NUM_KERNELS (1024 * 16)
 
 typedef struct impl_implicit_args_s {
-  unsigned long offset_x;
-  unsigned long offset_y;
-  unsigned long offset_z;
-  unsigned long hostcall_ptr;
-  unsigned long unused0;
-  unsigned long unused1;
-  unsigned long unused2;
+  uint64_t offset_x;
+  uint64_t offset_y;
+  uint64_t offset_z;
+  uint64_t hostcall_ptr;
+  uint64_t unused0;
+  uint64_t unused1;
+  uint64_t unused2;
 } impl_implicit_args_t;
 static_assert(sizeof(impl_implicit_args_t) == 56, "");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116963.398705.patch
Type: text/x-patch
Size: 2633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220110/c8a2c8fd/attachment-0001.bin>


More information about the Openmp-commits mailing list