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

via flang-commits flang-commits at lists.llvm.org
Thu Aug 15 14:11:02 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-runtime

Author: Valentin Clement (バレンタイン クレメン) (clementval)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/104506.diff


2 Files Affected:

- (modified) flang/runtime/CUDA/CMakeLists.txt (+7-2) 
- (modified) flang/unittests/Runtime/CUDA/CMakeLists.txt (+1-1) 


``````````diff
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 different 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
 )
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/104506


More information about the flang-commits mailing list