-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler-rt] Initial support for builtins on GPU targets (#95304)
Summary: This patch adds initial support to build the `builtins` library for GPU targets. Primarily this requires adding a few new architectures for `amdgcn` and `nvptx64`. I built this using the following invocations. ```console $ cmake ../compiler-rt -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -GNinja -DCMAKE_C_COMPILER_TARGET=<nvptx64-nvidia-cuda|amdgcn-amd-amdhsa> -DCMAKE_CXX_COMPILER_TARGET=<nvptx64-nvidia-cuda|amdgcn-amd-amdhsa> -DCMAKE_C_COMPILER_WORKS=1 -DCMAKE_CXX_COMPILER_WORKS=1 -DLLVM_CMAKE_DIR=../cmake/Modules -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON -C ../compiler-rt/cmake/caches/GPU.cmake ``` Some pointers would be appreciated for how to test this using a standard (non-default target only) build. GPU builds are somewhat finnicky. We only expect this to be built with a sufficiently new clang, as it's the only compiler that supports the target and output we distribute. Distribution is done as LLVM-IR blobs for now. GPUs have little backward compatibility, so linking object files is left to a future patch. More work is necessary to build correctly for all targets and ship into the correct clang resource directory. Additionally we need to use the `libc` project's support for running unit tests.
- Loading branch information
Showing
7 changed files
with
85 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# This file sets up a CMakeCache for GPU builds of compiler-rt. This supports | ||
# amdgcn and nvptx builds targeting the builtins library. | ||
|
||
set(COMPILER_RT_INCLUDE_TESTS OFF CACHE BOOL "") | ||
set(COMPILER_RT_HAS_SAFESTACK OFF CACHE BOOL "") | ||
|
||
set(COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") | ||
set(COMPILER_RT_BAREMETAL_BUILD ON CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_CRT OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_XRAY_NO_PREINIT OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_ORC OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "") | ||
set(COMPILER_RT_BUILD_SCUDO_SANTDALONE_WITH_LLVM_LIBC OFF CACHE BOOL "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters