summaryrefslogtreecommitdiff
path: root/flang/runtime/CUDA/allocator.cpp
diff options
context:
space:
mode:
authorFlorian Mayer <fmayer@google.com>2024-08-07 14:00:59 -0700
committerFlorian Mayer <fmayer@google.com>2024-08-07 14:00:59 -0700
commit890289dfb61757cc3f8fd5feb093131ebc3b7477 (patch)
treeb9b69f1881544d20a2c05f84c42a0a5805128f4e /flang/runtime/CUDA/allocator.cpp
parentb58d0717d588624eae77aea330e94f52607448c9 (diff)
parent6a3604ef8592edf39fedd6af8100aefafd6d931d (diff)
[𝘀𝗽𝗿] changes introduced through rebaseusers/fmayer/spr/main.compiler-rt-tsan-leave-bufferedstacktrace-uninit
Created using spr 1.3.4 [skip ci]
Diffstat (limited to 'flang/runtime/CUDA/allocator.cpp')
-rw-r--r--flang/runtime/CUDA/allocator.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/flang/runtime/CUDA/allocator.cpp b/flang/runtime/CUDA/allocator.cpp
index 26a3c2969626..cd00d40361d2 100644
--- a/flang/runtime/CUDA/allocator.cpp
+++ b/flang/runtime/CUDA/allocator.cpp
@@ -17,7 +17,7 @@
#include "cuda.h"
-namespace Fortran::runtime::cuf {
+namespace Fortran::runtime::cuda {
void CUFRegisterAllocator() {
allocatorRegistry.Register(
@@ -26,6 +26,8 @@ void CUFRegisterAllocator() {
kDeviceAllocatorPos, {&CUFAllocDevice, CUFFreeDevice});
allocatorRegistry.Register(
kManagedAllocatorPos, {&CUFAllocManaged, CUFFreeManaged});
+ allocatorRegistry.Register(
+ kUnifiedAllocatorPos, {&CUFAllocUnified, CUFFreeUnified});
}
void *CUFAllocPinned(std::size_t sizeInBytes) {
@@ -57,4 +59,14 @@ void CUFFreeManaged(void *p) {
CUDA_REPORT_IF_ERROR(cuMemFree(reinterpret_cast<CUdeviceptr>(p)));
}
-} // namespace Fortran::runtime::cuf
+void *CUFAllocUnified(std::size_t sizeInBytes) {
+ // Call alloc managed for the time being.
+ return CUFAllocManaged(sizeInBytes);
+}
+
+void CUFFreeUnified(void *p) {
+ // Call free managed for the time being.
+ CUFFreeManaged(p);
+}
+
+} // namespace Fortran::runtime::cuda