File tree Expand file tree Collapse file tree 15 files changed +228
-236
lines changed Expand file tree Collapse file tree 15 files changed +228
-236
lines changed Original file line number Diff line number Diff line change @@ -59,13 +59,6 @@ set(LIBC_NAMESPACE ${default_namespace}
59
59
CACHE STRING "The namespace to use to enclose internal implementations. Must start with '__llvm_libc'."
60
60
)
61
61
62
- # We will build the GPU utilities if we are not doing a runtimes build.
63
- option (LIBC_BUILD_GPU_LOADER "Always build the GPU loader utilities" OFF )
64
- if (LIBC_BUILD_GPU_LOADER OR ((NOT LLVM_RUNTIMES_BUILD ) AND LLVM_LIBC_GPU_BUILD ))
65
- add_subdirectory (utils/gpu )
66
- return ()
67
- endif ()
68
-
69
62
option (LIBC_CMAKE_VERBOSE_LOGGING
70
63
"Log details warnings and notifications during CMake configuration." OFF )
71
64
Original file line number Diff line number Diff line change 20
20
#define __has_builtin (x ) 0
21
21
#endif
22
22
23
+ // Workaround for missing __builtin_is_constant_evaluated in < GCC 10.
24
+ #ifndef __builtin_is_constant_evaluated
25
+ #define __builtin_is_constant_evaluated (x ) 0
26
+ #endif
27
+
23
28
// Configs for using the LLVM libc writer interface.
24
29
#define LIBC_COPT_USE_C_ASSERT
25
30
#define LIBC_COPT_MEMCPY_USE_EMBEDDED_TINY
28
33
#define LIBC_COPT_PRINTF_DISABLE_INDEX_MODE
29
34
#define LIBC_COPT_PRINTF_DISABLE_STRERROR
30
35
31
- // The 'long double' type is 8 byte
36
+ // The 'long double' type is 8 bytes.
32
37
#define LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64
33
38
34
39
#include " shared/rpc.h"
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -210,10 +210,6 @@ if("${LIBC_TARGET_TRIPLE}" STREQUAL "amdgcn-amd-amdhsa" OR
210
210
"${LIBC_TARGET_TRIPLE} " STREQUAL "nvptx64-nvidia-cuda" )
211
211
set (LLVM_LIBC_GPU_BUILD ON )
212
212
endif ()
213
- if (NOT "libc" IN_LIST LLVM_ENABLE_PROJECTS AND LLVM_LIBC_GPU_BUILD )
214
- message (STATUS "Enabling libc project to build libc testing tools" )
215
- list (APPEND LLVM_ENABLE_PROJECTS "libc" )
216
- endif ()
217
213
218
214
# LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
219
215
# `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
Original file line number Diff line number Diff line change @@ -534,20 +534,6 @@ if(build_runtimes)
534
534
endif ()
535
535
if (LLVM_LIBC_GPU_BUILD )
536
536
list (APPEND extra_cmake_args "-DLLVM_LIBC_GPU_BUILD=ON" )
537
- if ("libc" IN_LIST RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES )
538
- if (TARGET amdhsa-loader )
539
- list (APPEND extra_cmake_args
540
- "-DRUNTIMES_amdgcn-amd-amdhsa_LIBC_GPU_LOADER_EXECUTABLE=$<TARGET_FILE:amdhsa-loader>" )
541
- list (APPEND extra_deps amdhsa-loader )
542
- endif ()
543
- endif ()
544
- if ("libc" IN_LIST RUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES )
545
- if (TARGET nvptx-loader )
546
- list (APPEND extra_cmake_args
547
- "-DRUNTIMES_nvptx64-nvidia-cuda_LIBC_GPU_LOADER_EXECUTABLE=$<TARGET_FILE:nvptx-loader>" )
548
- list (APPEND extra_deps nvptx-loader )
549
- endif ()
550
- endif ()
551
537
if (TARGET clang-offload-packager )
552
538
list (APPEND extra_deps clang-offload-packager )
553
539
endif ()
Original file line number Diff line number Diff line change 9
9
# traversing each directory.
10
10
create_llvm_tool_options ()
11
11
12
+ if (NOT LLVM_COMPILER_IS_GCC_COMPATIBLE )
13
+ set (LLVM_TOOL_LLVM_GPU_LOADER_BUILD OFF )
14
+ endif ()
15
+
12
16
if (NOT LLVM_BUILD_LLVM_DYLIB AND NOT LLVM_BUILD_LLVM_C_DYLIB )
13
17
set (LLVM_TOOL_LLVM_SHLIB_BUILD Off )
14
18
endif ()
Original file line number Diff line number Diff line change
1
+ set (LLVM_LINK_COMPONENTS
2
+ BinaryFormat
3
+ Object
4
+ Option
5
+ Support
6
+ FrontendOffloading
7
+ TargetParser
8
+ )
9
+
10
+ add_llvm_tool (llvm-gpu-loader
11
+ llvm-gpu-loader.cpp
12
+
13
+ # TODO: We intentionally split this currently due to statically linking the
14
+ # GPU runtimes. Dynamically load the dependencies, possibly using the
15
+ # LLVM offloading API when it is complete.
16
+ PARTIAL_SOURCES_INTENDED
17
+
18
+ DEPENDS
19
+ intrinsics_gen
20
+ )
21
+
22
+ # Locate the RPC server handling interface.
23
+ include (FindLibcCommonUtils )
24
+ target_link_libraries (llvm-gpu-loader PUBLIC llvm-libc-common-utilities )
25
+
26
+ # Check for HSA support for targeting AMD GPUs.
27
+ find_package (hsa-runtime64 QUIET 1.2.0 HINTS ${CMAKE_INSTALL_PREFIX} PATHS /opt/rocm )
28
+ if (hsa-runtime64_FOUND )
29
+ target_sources (llvm-gpu-loader PRIVATE amdhsa.cpp )
30
+ target_compile_definitions (llvm-gpu-loader PRIVATE AMDHSA_SUPPORT )
31
+ target_link_libraries (llvm-gpu-loader PRIVATE hsa-runtime64::hsa-runtime64 )
32
+
33
+ # Compatibility with the old amdhsa-loader name.
34
+ add_llvm_tool_symlink (amdhsa-loader llvm-gpu-loader )
35
+ endif ()
36
+
37
+ # Check for CUDA support for targeting NVIDIA GPUs.
38
+ find_package (CUDAToolkit 11.2 QUIET )
39
+ if (CUDAToolkit_FOUND )
40
+ target_sources (llvm-gpu-loader PRIVATE nvptx.cpp )
41
+ target_compile_definitions (llvm-gpu-loader PRIVATE NVPTX_SUPPORT )
42
+ target_link_libraries (llvm-gpu-loader PRIVATE CUDA::cuda_driver )
43
+
44
+ # Compatibility with the old nvptx-loader name.
45
+ add_llvm_tool_symlink (nvptx-loader llvm-gpu-loader )
46
+ endif ()
You can’t perform that action at this time.
0 commit comments