[libc-commits] [libc] a4f553f - [libc] Fix using the `libcgpu.a` for NVPTX in non-LTO builds
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Mon Jul 10 11:54:54 PDT 2023
Author: Joseph Huber
Date: 2023-07-10T13:54:47-05:00
New Revision: a4f553fcde7596aa23ff56d2c9f4f0804311955b
URL: https://github.com/llvm/llvm-project/commit/a4f553fcde7596aa23ff56d2c9f4f0804311955b
DIFF: https://github.com/llvm/llvm-project/commit/a4f553fcde7596aa23ff56d2c9f4f0804311955b.diff
LOG: [libc] Fix using the `libcgpu.a` for NVPTX in non-LTO builds
CUDA requires a PTX feature to be compiled generally, because the
`libcgpu.a` archive contains LLVM-IR we need to have one present to
compile it. Currently, the wrapper fatbinary format we use to
incorporate these into single-source offloading languages has a special
option to provide this. Since this was not present in the builds, if the
user did not specify it via `-foffload-lto` it would not compile from
CUDA or OpenMP due to the missing PTX features. Fix this by passing it
to the packager invocation.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D154864
Added:
Modified:
libc/cmake/modules/LLVMLibCObjectRules.cmake
Removed:
################################################################################
diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 07de67e1d4dc06..2dfa7c09ae9162 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -184,8 +184,14 @@ function(_build_gpu_objects fq_target_name internal_target_name)
# Append this target to a list of images to package into a single binary.
set(input_file $<TARGET_OBJECTS:${gpu_target_name}>)
- list(APPEND packager_images
- --image=file=${input_file},arch=${gpu_arch},triple=${gpu_target_triple})
+ if("${gpu_arch}" IN_LIST all_nvptx_architectures)
+ string(REGEX MATCH "\\+ptx[0-9]+" nvptx_ptx_feature ${nvptx_options})
+ list(APPEND packager_images
+ --image=file=${input_file},arch=${gpu_arch},triple=${gpu_target_triple},feature=${nvptx_ptx_feature})
+ else()
+ list(APPEND packager_images
+ --image=file=${input_file},arch=${gpu_arch},triple=${gpu_target_triple})
+ endif()
list(APPEND gpu_target_names ${gpu_target_name})
endforeach()
More information about the libc-commits
mailing list