[flang-commits] [flang] 2704eba - [flang][runtime] Create CUDA PTX OBJECT library target for F18 runtime CUDA build. (#88821)
via flang-commits
flang-commits at lists.llvm.org
Tue Apr 16 08:53:15 PDT 2024
Author: Slava Zakharin
Date: 2024-04-16T08:53:12-07:00
New Revision: 2704ebaf2885a16155ab7144f8dd0dd459d77089
URL: https://github.com/llvm/llvm-project/commit/2704ebaf2885a16155ab7144f8dd0dd459d77089
DIFF: https://github.com/llvm/llvm-project/commit/2704ebaf2885a16155ab7144f8dd0dd459d77089.diff
LOG: [flang][runtime] Create CUDA PTX OBJECT library target for F18 runtime CUDA build. (#88821)
This is to experiment with distributing F18 runtime CUDA library
in the form of a pure PTX library. The change is under
FLANG_EXPERIMENTAL_CUDA_RUNTIME CMake control.
Added:
Modified:
flang/cmake/modules/AddFlangOffloadRuntime.cmake
flang/lib/Decimal/CMakeLists.txt
flang/runtime/CMakeLists.txt
Removed:
################################################################################
diff --git a/flang/cmake/modules/AddFlangOffloadRuntime.cmake b/flang/cmake/modules/AddFlangOffloadRuntime.cmake
index 6fb6213e90fc49..e34d3851187acf 100644
--- a/flang/cmake/modules/AddFlangOffloadRuntime.cmake
+++ b/flang/cmake/modules/AddFlangOffloadRuntime.cmake
@@ -10,7 +10,7 @@ set(FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD "off" CACHE STRING
set(FLANG_OMP_DEVICE_ARCHITECTURES "all" CACHE STRING
"List of OpenMP device architectures to be used to compile the Fortran runtime (e.g. 'gfx1103;sm_90')")
-macro(enable_cuda_compilation files)
+macro(enable_cuda_compilation name files)
if (FLANG_EXPERIMENTAL_CUDA_RUNTIME)
if (BUILD_SHARED_LIBS)
message(FATAL_ERROR
@@ -52,6 +52,10 @@ macro(enable_cuda_compilation files)
include_directories(AFTER ${FLANG_LIBCUDACXX_PATH}/include)
add_compile_definitions(RT_USE_LIBCUDACXX=1)
endif()
+
+ # Add an OBJECT library consisting of CUDA PTX.
+ llvm_add_library(${name}PTX OBJECT PARTIAL_SOURCES_INTENDED ${files})
+ set_property(TARGET obj.${name}PTX PROPERTY CUDA_PTX_COMPILATION ON)
endif()
endmacro()
diff --git a/flang/lib/Decimal/CMakeLists.txt b/flang/lib/Decimal/CMakeLists.txt
index 3d562b8e3ce1e5..880b190f1c5815 100644
--- a/flang/lib/Decimal/CMakeLists.txt
+++ b/flang/lib/Decimal/CMakeLists.txt
@@ -55,7 +55,7 @@ set(sources
)
include(AddFlangOffloadRuntime)
-enable_cuda_compilation("${sources}")
+enable_cuda_compilation(FortranDecimal "${sources}")
enable_omp_offload_compilation("${sources}")
add_flang_library(FortranDecimal INSTALL_WITH_TOOLCHAIN ${sources})
diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt
index 2a65a22ab674c4..bdd0e07bbfd4d1 100644
--- a/flang/runtime/CMakeLists.txt
+++ b/flang/runtime/CMakeLists.txt
@@ -224,7 +224,7 @@ set(supported_files
utf.cpp
)
-enable_cuda_compilation("${supported_files}")
+enable_cuda_compilation(FortranRuntime "${supported_files}")
enable_omp_offload_compilation("${supported_files}")
if (NOT TARGET FortranFloat128Math)
More information about the flang-commits
mailing list