aboutsummaryrefslogtreecommitdiff
path: root/libc/startup
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2023-04-17 09:11:09 -0500
committerJoseph Huber <jhuber6@vols.utk.edu>2023-04-17 11:51:34 -0500
commite2356fb07e57538cbe5f731f23fc574848ea9bb1 (patch)
tree39da12525fa6cc55cc70929c88666c0bd7f430eb /libc/startup
parent1f5e737fc135bf991889a1364b8f8c5edc3953d2 (diff)
downloadllvm-e2356fb07e57538cbe5f731f23fc574848ea9bb1.zip
llvm-e2356fb07e57538cbe5f731f23fc574848ea9bb1.tar.gz
llvm-e2356fb07e57538cbe5f731f23fc574848ea9bb1.tar.bz2
[libc] Add special handling for CUDA PTX features
The NVIDIA compilation path requires some special options. This is mostly because compilation is dependent on having a valid CUDA toolchain. We don't actually need the CUDA toolchain to create the exported `libcgpu.a` library because it's pure LLVM-IR. However, for some language features we need the PTX version to be set. This is normally set by checking the CUDA version, but without one installed it will fail to build. We instead choose a minimum set of features on the desired target, inferred from https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#release-notes and the PTX refernece for functions like `nanosleep`. Reviewed By: tianshilei1992 Differential Revision: https://reviews.llvm.org/D148532
Diffstat (limited to 'libc/startup')
-rw-r--r--libc/startup/gpu/nvptx/CMakeLists.txt4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/startup/gpu/nvptx/CMakeLists.txt b/libc/startup/gpu/nvptx/CMakeLists.txt
index f8839e9..4966169 100644
--- a/libc/startup/gpu/nvptx/CMakeLists.txt
+++ b/libc/startup/gpu/nvptx/CMakeLists.txt
@@ -1,3 +1,4 @@
+get_nvptx_compile_options(nvptx_options ${LIBC_GPU_TARGET_ARCHITECTURE})
add_startup_object(
crt1
SRC
@@ -8,9 +9,8 @@ add_startup_object(
-ffreestanding # To avoid compiler warnings about calling the main function.
-fno-builtin
-nogpulib # Do not include any GPU vendor libraries.
- -march=${LIBC_GPU_TARGET_ARCHITECTURE}
--target=${LIBC_GPU_TARGET_TRIPLE}
- --cuda-path=${LIBC_CUDA_ROOT}
+ ${nvptx_options}
NO_GPU_BUNDLE # Compile this file directly without special GPU handling.
)
get_fq_target_name(crt1 fq_name)