[nvptx-arch] Dynamically load `libcuda.so.1` directly instead
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 4 Apr 2023 23:10:51 +0000 (18:10 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 5 Apr 2023 00:50:31 +0000 (19:50 -0500)
This patch loads the CUDA driver library directly via its real
`DT_SONAME`. This prevents the filesystem from needing to reload it in
cases when it's already loaded.

Reviewed By: tra

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

clang/tools/nvptx-arch/NVPTXArch.cpp

index 4cfc586..b053fcc 100644 (file)
@@ -49,7 +49,7 @@ CUresult (*cuGetErrorString)(CUresult, const char **);
 CUresult (*cuDeviceGet)(CUdevice *, int);
 CUresult (*cuDeviceGetAttribute)(int *, CUdevice_attribute, CUdevice);
 
-constexpr const char *DynamicCudaPath = "libcuda.so";
+constexpr const char *DynamicCudaPath = "libcuda.so.1";
 
 llvm::Error loadCUDA() {
   std::string ErrMsg;