[Openmp-commits] [openmp] a74826d - [openmp][amdgpu] Replace unsigned long with uint64_t
Jon Chesterfield via Openmp-commits
openmp-commits at lists.llvm.org
Mon Jan 10 14:19:38 PST 2022
Author: Jon Chesterfield
Date: 2022-01-10T22:19:30Z
New Revision: a74826d30a2ef900078cd2e18ae534e3e37691c0
URL: https://github.com/llvm/llvm-project/commit/a74826d30a2ef900078cd2e18ae534e3e37691c0
DIFF: https://github.com/llvm/llvm-project/commit/a74826d30a2ef900078cd2e18ae534e3e37691c0.diff
LOG: [openmp][amdgpu] Replace unsigned long with uint64_t
Some types need to be 64 bit. Unsigned long is a hazard there.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D116963
Added:
Modified:
openmp/libomptarget/plugins/amdgpu/impl/internal.h
openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
Removed:
################################################################################
diff --git a/openmp/libomptarget/plugins/amdgpu/impl/internal.h b/openmp/libomptarget/plugins/amdgpu/impl/internal.h
index fe974d3676f58..63b60b24a5570 100644
--- a/openmp/libomptarget/plugins/amdgpu/impl/internal.h
+++ b/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, "");
diff --git a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
index 41f5b1a570b5e..fec8865b3c5e8 100644
--- a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ b/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_init() { return HSA_STATUS_SUCCESS; }
__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 @@ int32_t runRegionLocked(int32_t device_id, void *tgt_entry_ptr, void **tgt_args,
// 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 "
More information about the Openmp-commits
mailing list