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

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Thu Aug 15 14:10:33 PDT 2024


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

None

>From 2f44a59576b7c3b6932fb2b0626211ea59974559 Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Thu, 15 Aug 2024 14:04:20 -0700
Subject: [PATCH] [flang][cuda] Add version in libCufRuntime name

---
 flang/runtime/CUDA/CMakeLists.txt           | 9 +++++++--
 flang/unittests/Runtime/CUDA/CMakeLists.txt | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

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
 )
 



More information about the flang-commits mailing list