[flang-commits] [flang] 5c3a3dc - [flang][cuda] Add version in libCufRuntime name (#104506)

via flang-commits flang-commits at lists.llvm.org
Thu Aug 15 20:45:37 PDT 2024


Author: Valentin Clement (バレンタイン クレメン)
Date: 2024-08-15T20:45:33-07:00
New Revision: 5c3a3dc9eb0a70979ab456a69f2f40dab6515008

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

LOG: [flang][cuda] Add version in libCufRuntime name (#104506)

Added: 
    

Modified: 
    flang/runtime/CUDA/CMakeLists.txt
    flang/unittests/Runtime/CUDA/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/runtime/CUDA/CMakeLists.txt b/flang/runtime/CUDA/CMakeLists.txt
index c9a20ebcc82e07..81055b2737c0f1 100644
--- a/flang/runtime/CUDA/CMakeLists.txt
+++ b/flang/runtime/CUDA/CMakeLists.txt
@@ -8,7 +8,12 @@
 
 include_directories(${CUDAToolkit_INCLUDE_DIRS})
 
-add_flang_library(CufRuntime
+# libCufRuntime depends on a certain version of CUDA. To be able to have
+# multiple build of this library with 
diff erent CUDA version, the version is
+# added to the library name.
+set(CUFRT_LIBNAME CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR})
+
+add_flang_library(${CUFRT_LIBNAME}
   allocator.cpp
   descriptor.cpp
 )
@@ -19,7 +24,7 @@ else()
   set(CUDA_RT_TARGET CUDA::cudart_static)
 endif()
 
-target_link_libraries(CufRuntime
+target_link_libraries(${CUFRT_LIBNAME}
   PRIVATE
   FortranRuntime
   ${CUDA_RT_TARGET}

diff  --git a/flang/unittests/Runtime/CUDA/CMakeLists.txt b/flang/unittests/Runtime/CUDA/CMakeLists.txt
index 14b5c788719b87..ed0caece3d15db 100644
--- a/flang/unittests/Runtime/CUDA/CMakeLists.txt
+++ b/flang/unittests/Runtime/CUDA/CMakeLists.txt
@@ -6,7 +6,7 @@ add_flang_unittest(FlangCufRuntimeTests
 
 target_link_libraries(FlangCufRuntimeTests
   PRIVATE
-  CufRuntime
+  CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR}
   FortranRuntime
 )
 


        


More information about the flang-commits mailing list