[libcxx-commits] [libcxx] [libcxx] Add cache file for the GPU build (PR #99348)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 17 09:18:11 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Joseph Huber (jhuber6)
<details>
<summary>Changes</summary>
Summary:
This patch adds a CMake cache config file for the GPU build. This cache
will set the default required options when used from the LLVM runtime
interface or directly. These options pretty much disable everything the
GPU can't handle.
With this and the fllowing patches: #<!-- -->99259, #<!-- -->99243, #<!-- -->99287, and #<!-- -->99333,
we will be able to build `libc++` targeting the GPU with an invocation
like this.
```
$ cmake ../llvm
-C${LLVM_ROOT}/libcxx/cmake/caches/GPU.cmake \
-DRUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES=compiler-rt;libc;libcxx \
-DRUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES=compiler-rt;libc;libcxx \
-DLLVM_RUNTIME_TARGETS=amdgcn-amd-amdhsa;nvptx64-nvidia-cuda \
```
This will then install the libraries and headers into the appropriate
locations for use with `clang`.
---
Full diff: https://github.com/llvm/llvm-project/pull/99348.diff
1 Files Affected:
- (added) libcxx/cmake/caches/GPU.cmake (+45)
``````````diff
diff --git a/libcxx/cmake/caches/GPU.cmake b/libcxx/cmake/caches/GPU.cmake
new file mode 100644
index 0000000000000..0963fc7fd3852
--- /dev/null
+++ b/libcxx/cmake/caches/GPU.cmake
@@ -0,0 +1,45 @@
+# 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_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_USE_LLVM_LIBC ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+ set(RUNTIMES_${target}_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
+endforeach()
+
+# Handle default arguments when being built directly.
+if(${CMAKE_CXX_COMPILER_TARGET} MATCHES "^amdgcn|^nvptx")
+ set(LIBCXX_ABI_VERSION 2 CACHE STRING "")
+ set(LIBCXX_CXX_ABI none CACHE STRING "")
+ set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "")
+ set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "")
+ set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "")
+ set(LIBCXX_ENABLE_RANDOM_DEVICE OFF CACHE BOOL "")
+ set(LIBCXX_ENABLE_LOCALIZATION OFF CACHE BOOL "")
+ set(LIBCXX_ENABLE_UNICODE OFF CACHE BOOL "")
+ set(LIBCXX_ENABLE_WIDE_CHARACTERS OFF CACHE BOOL "")
+ set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+ set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+ set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
+ set(LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY ON CACHE BOOL "")
+ set(LIBCXX_ENABLE_THREADS OFF CACHE BOOL "")
+ set(LIBCXX_ENABLE_MONOTONIC_CLOCK ON CACHE BOOL "")
+ set(LIBCXX_INSTALL_LIBRARY ON CACHE BOOL "")
+ set(LIBCXX_USE_LLVM_LIBC ON CACHE BOOL "")
+ set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
+ set(LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "")
+endif()
``````````
</details>
https://github.com/llvm/llvm-project/pull/99348
More information about the libcxx-commits
mailing list