[Openmp-commits] [PATCH] D102169: [libomptarget] Add support for target allocators to dynamic cuda RTL
Jon Chesterfield via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon May 10 07:23:44 PDT 2021
JonChesterfield created this revision.
JonChesterfield added reviewers: jhuber6, jdoerfert, grokos, pdhaliwal.
Herald added a subscriber: yaxunl.
JonChesterfield requested review of this revision.
Herald added a project: OpenMP.
Herald added a subscriber: openmp-commits.
[libomptarget] Add support for target allocators to dynamic cuda RTL
Follow on to D102000 <https://reviews.llvm.org/D102000> which introduced new calls into libcuda. This patch adds
the corresponding entry points to dynamic_cuda, fixing the build for systems
that do not have the cuda toolkit installed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102169
Files:
openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
Index: openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
===================================================================
--- openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
+++ openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.h
@@ -49,6 +49,12 @@
CU_CTX_SCHED_MASK = 0x07,
} CUctx_flags;
+typedef enum CUmemAttach_flags_enum {
+ CU_MEM_ATTACH_GLOBAL = 0x1,
+ CU_MEM_ATTACH_HOST = 0x2,
+ CU_MEM_ATTACH_SINGLE = 0x4,
+} CUmemAttach_flags;
+
CUresult cuCtxGetDevice(CUdevice *);
CUresult cuDeviceGet(CUdevice *, int);
CUresult cuDeviceGetAttribute(int *, CUdevice_attribute, CUdevice);
@@ -62,14 +68,18 @@
void **);
CUresult cuMemAlloc(CUdeviceptr *, size_t);
-CUresult cuMemcpyDtoDAsync(CUdeviceptr, CUdeviceptr, size_t, CUstream);
+CUresult cuMemAllocHost(void **, size_t);
+CUresult cuMemAllocManaged(CUdeviceptr *, size_t, unsigned int);
+CUresult cuMemcpyDtoDAsync(CUdeviceptr, CUdeviceptr, size_t, CUstream);
CUresult cuMemcpyDtoH(void *, CUdeviceptr, size_t);
CUresult cuMemcpyDtoHAsync(void *, CUdeviceptr, size_t, CUstream);
CUresult cuMemcpyHtoD(CUdeviceptr, const void *, size_t);
CUresult cuMemcpyHtoDAsync(CUdeviceptr, const void *, size_t, CUstream);
CUresult cuMemFree(CUdeviceptr);
+CUresult cuMemFreeHost(void *);
+
CUresult cuModuleGetFunction(CUfunction *, CUmodule, const char *);
CUresult cuModuleGetGlobal(CUdeviceptr *, size_t *, CUmodule, const char *);
Index: openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
===================================================================
--- openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
+++ openmp/libomptarget/plugins/cuda/dynamic_cuda/cuda.cpp
@@ -32,14 +32,17 @@
DLWRAP(cuLaunchKernel, 11);
DLWRAP(cuMemAlloc, 2);
-DLWRAP(cuMemcpyDtoDAsync, 4);
+DLWRAP(cuMemAllocHost, 2);
+DLWRAP(cuMemAllocManaged, 3);
+DLWRAP(cuMemcpyDtoDAsync, 4);
DLWRAP(cuMemcpyDtoH, 3);
DLWRAP(cuMemcpyDtoHAsync, 4);
DLWRAP(cuMemcpyHtoD, 3);
DLWRAP(cuMemcpyHtoDAsync, 4);
DLWRAP(cuMemFree, 1);
+DLWRAP(cuMemFreeHost, 1);
DLWRAP(cuModuleGetFunction, 3);
DLWRAP(cuModuleGetGlobal, 4);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102169.344052.patch
Type: text/x-patch
Size: 2120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210510/31d2c3ee/attachment.bin>
More information about the Openmp-commits
mailing list