[Openmp-commits] [PATCH] D143775: [Libomptarget] Implement the host memory allocator with fine grained memory
Joseph Huber via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Feb 20 06:43:59 PST 2023
jhuber6 updated this revision to Diff 498834.
jhuber6 added a comment.
Changing this to just go back to fine-grained. It worked before so it's less controversial.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143775/new/
https://reviews.llvm.org/D143775
Files:
openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
openmp/libomptarget/test/api/omp_host_pinned_memory.c
openmp/libomptarget/test/api/omp_host_pinned_memory_alloc.c
Index: openmp/libomptarget/test/api/omp_host_pinned_memory_alloc.c
===================================================================
--- openmp/libomptarget/test/api/omp_host_pinned_memory_alloc.c
+++ openmp/libomptarget/test/api/omp_host_pinned_memory_alloc.c
@@ -1,5 +1,4 @@
// RUN: %libomptarget-compile-run-and-check-generic
-// UNSUPPORTED: amdgcn-amd-amdhsa
#include <omp.h>
#include <stdio.h>
@@ -20,7 +19,7 @@
for (int i = 0; i < N; ++i)
sum += hst_ptr[i];
- omp_free(hst_ptr, llvm_omp_target_shared_mem_alloc);
+ omp_free(hst_ptr, llvm_omp_target_host_mem_alloc);
// CHECK: PASS
if (sum == N)
printf("PASS\n");
Index: openmp/libomptarget/test/api/omp_host_pinned_memory.c
===================================================================
--- openmp/libomptarget/test/api/omp_host_pinned_memory.c
+++ openmp/libomptarget/test/api/omp_host_pinned_memory.c
@@ -1,5 +1,4 @@
// RUN: %libomptarget-compile-run-and-check-generic
-// UNSUPPORTED: amdgcn-amd-amdhsa
#include <omp.h>
#include <stdio.h>
Index: openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
===================================================================
--- openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -1485,6 +1485,12 @@
return *FineGrainedMemoryPools[0];
}
+ AMDGPUMemoryPoolTy &getCoarseGrainedMemoryPool() {
+ assert(!CoarseGrainedMemoryPools.empty() && "No coarse-grained mempool");
+ // Retrive any memory pool.
+ return *CoarseGrainedMemoryPools[0];
+ }
+
/// Get a memory pool for kernel args allocations.
AMDGPUMemoryPoolTy &getArgsMemoryPool() {
assert(!ArgsMemoryPools.empty() && "No kernelargs mempool");
@@ -1762,6 +1768,7 @@
MemoryPool = CoarseGrainedMemoryPools[0];
break;
case TARGET_ALLOC_HOST:
+ MemoryPool = &HostDevice.getFineGrainedMemoryPool();
break;
case TARGET_ALLOC_SHARED:
MemoryPool = &HostDevice.getFineGrainedMemoryPool();
@@ -2623,6 +2630,7 @@
MemoryPool = CoarseGrainedMemoryPools[0];
break;
case TARGET_ALLOC_HOST:
+ MemoryPool = &HostDevice.getFineGrainedMemoryPool();
break;
case TARGET_ALLOC_SHARED:
MemoryPool = &HostDevice.getFineGrainedMemoryPool();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143775.498834.patch
Type: text/x-patch
Size: 2281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230220/5390a391/attachment.bin>
More information about the Openmp-commits
mailing list