[libcxx-commits] [libcxx] [libcxx] Add cache file for the GPU build (PR #99348)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 14 08:43:32 PDT 2024
================
@@ -0,0 +1,94 @@
+# Handle default arguments when done through the LLVM runtimes interface.
+foreach(target amdgcn-amd-amdhsa nvptx64-nvidia-cuda)
+ set(RUNTIMES_${target}_LIBCXX_ABI_VERSION 2 CACHE STRING "")
+ set(RUNTIMES_${target}_LIBCXX_CXX_ABI none CACHE STRING "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_HAS_TERMINAL_AVAILABLE OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_LIBC "llvm-libc" CACHE STRING "")
+ set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
+
+ # Configuration options for libcxxabi.
+ set(RUNTIMES_${target}_LIBCXXABI_BAREMETAL ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS OFF CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")
+
+ # Target specific compile flags.
+ if(${target} MATCHES "^amdgcn")
+ set(RUNTIMES_${target}_LIBCXX_ADDITIONAL_COMPILE_FLAGS
+ "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
+ set(RUNTIMES_${target}_LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
+ "-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
+ set(RUNTIMES_${target}_CMAKE_REQUIRED_FLAGS "-nogpulib -nodefaultlibs" CACHE STRING "")
+ else()
+ set(RUNTIMES_${target}_LIBCXX_ADDITIONAL_COMPILE_FLAGS
+ "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
+ set(RUNTIMES_${target}_LIBCXXABI_ADDITIONAL_COMPILE_FLAGS
+ "-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
+ set(RUNTIMES_${target}_CMAKE_REQUIRED_FLAGS
+ "-flto -nodefaultlibs -c -Wno-unused-command-line-argument" CACHE STRING "")
+ endif()
+endforeach()
+
+# Handle default arguments when being built directly.
----------------
ldionne wrote:
This is the only thing we should provide in this cache file (i.e. we should remove the bootstrapping build definitions).
We should be able to pass a CMake cache file to be used for individual targets when doing a bootstrapping build. If that doesn't work today, we should make it work instead of basically merging two cache files into one. This will be useful for all the other cache files we have.
Is it possible that something like `RUNTIMES_<target>_CACHE_FILES` already allows you to do this? https://github.com/llvm/llvm-project/blob/20b2c9f10fe09f2c5cbd3da7f0af8df24f62e899/llvm/runtimes/CMakeLists.txt#L376
https://github.com/llvm/llvm-project/pull/99348
More information about the libcxx-commits
mailing list