[Openmp-commits] [openmp] f8b1f93 - [libomptarget] Enable the device allocator for AMDGPU

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Thu Sep 1 10:41:20 PDT 2022


Author: Joseph Huber
Date: 2022-09-01T12:40:59-05:00
New Revision: f8b1f93f268a16f994a1f33b5aca2a00f7d13ac2

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

LOG: [libomptarget] Enable the device allocator for AMDGPU

This patch adds support for the device memory type, this is currently equivalent
to the default type so it should be treated as the same.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D133128

Added: 
    

Modified: 
    openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
    openmp/libomptarget/test/api/omp_device_memory.c

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
index 7e042c518369d..4f4881f04673c 100644
--- a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -2623,6 +2623,7 @@ void *__tgt_rtl_data_alloc(int DeviceId, int64_t Size, void *, int32_t Kind) {
   hsa_amd_memory_pool_t MemoryPool;
   switch (Kind) {
   case TARGET_ALLOC_DEFAULT:
+  case TARGET_ALLOC_DEVICE:
     // GPU memory
     MemoryPool = DeviceInfo().getDeviceMemoryPool(DeviceId);
     break;

diff  --git a/openmp/libomptarget/test/api/omp_device_memory.c b/openmp/libomptarget/test/api/omp_device_memory.c
index 6bb02be7a50f5..816ae359540d2 100644
--- a/openmp/libomptarget/test/api/omp_device_memory.c
+++ b/openmp/libomptarget/test/api/omp_device_memory.c
@@ -1,5 +1,4 @@
-// RUN: %libomptarget-compile-run-and-check-nvptx64-nvidia-cuda
-// REQUIRES: nvptx64-nvidia-cuda
+// RUN: %libomptarget-compile-run-and-check-generic
 
 #include <omp.h>
 #include <stdio.h>


        


More information about the Openmp-commits mailing list