[llvm] [Offload] Use newer CUDA API functions when dynamically loaded (PR #93057)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Wed May 22 08:54:55 PDT 2024
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/93057
>From 2c0535d526711842b8632e8fd4272a1f1d4b28c2 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Wed, 22 May 2024 10:48:54 -0500
Subject: [PATCH] [Offload] Use newer CUDA API functions when dynamically
loaded
Summary:
CUDA does its versioning by putting a redirection in the header so the
API functions remain the same while the symbol changes. These weren't
being used for some functions that required it in the dynamic cuda
version.
These functions have newer verisons that should be used. These are
fairly old as far as I'm aware so we should be able to sweep backward
compatibility under the rug.
---
offload/plugins-nextgen/cuda/dynamic_cuda/cuda.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/offload/plugins-nextgen/cuda/dynamic_cuda/cuda.h b/offload/plugins-nextgen/cuda/dynamic_cuda/cuda.h
index 32031c28f8797..d65e5cf61e096 100644
--- a/offload/plugins-nextgen/cuda/dynamic_cuda/cuda.h
+++ b/offload/plugins-nextgen/cuda/dynamic_cuda/cuda.h
@@ -16,6 +16,15 @@
#include <cstddef>
#include <cstdint>
+#define cuDeviceTotalMem cuDeviceTotalMem_v2
+#define cuModuleGetGlobal cuModuleGetGlobal_v2
+#define cuMemGetInfo cuMemGetInfo_v2
+#define cuMemAlloc cuMemAlloc_v2
+#define cuMemFree cuMemFree_v2
+#define cuMemAllocHost cuMemAllocHost_v2
+#define cuDevicePrimaryCtxRelease cuDevicePrimaryCtxRelease_v2
+#define cuDevicePrimaryCtxSetFlags cuDevicePrimaryCtxSetFlags_v2
+
typedef int CUdevice;
typedef uintptr_t CUdeviceptr;
typedef struct CUmod_st *CUmodule;
More information about the llvm-commits
mailing list