[clang] ad6a7d7 - [nvptx-arch] Dynamically load `libcuda.so.1` directly instead

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 17:50:49 PDT 2023


Author: Joseph Huber
Date: 2023-04-04T19:50:31-05:00
New Revision: ad6a7d7dc9a2055ac3a4658d90ec86d78c3199b5

URL: https://github.com/llvm/llvm-project/commit/ad6a7d7dc9a2055ac3a4658d90ec86d78c3199b5
DIFF: https://github.com/llvm/llvm-project/commit/ad6a7d7dc9a2055ac3a4658d90ec86d78c3199b5.diff

LOG: [nvptx-arch] Dynamically load `libcuda.so.1` directly instead

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

Added: 
    

Modified: 
    clang/tools/nvptx-arch/NVPTXArch.cpp

Removed: 
    


################################################################################
diff  --git a/clang/tools/nvptx-arch/NVPTXArch.cpp b/clang/tools/nvptx-arch/NVPTXArch.cpp
index 4cfc58681cba3..b053fcc6e0bdd 100644
--- a/clang/tools/nvptx-arch/NVPTXArch.cpp
+++ b/clang/tools/nvptx-arch/NVPTXArch.cpp
@@ -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;


        


More information about the cfe-commits mailing list