[libc-commits] [PATCH] D154864: [libc] Fix using the `libcgpu.a` for NVPTX in non-LTO builds
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Jul 10 09:52:16 PDT 2023
jhuber6 created this revision.
jhuber6 added reviewers: tra, jdoerfert, tianshilei1992, JonChesterfield, sivachandra.
Herald added subscribers: libc-commits, mattd, gchakrabarti, asavonic, inglorion.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.
Herald added subscribers: wangpc, jplehr, sstefan1.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D154864
Files:
libc/cmake/modules/LLVMLibCObjectRules.cmake
Index: libc/cmake/modules/LLVMLibCObjectRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -184,8 +184,14 @@
# 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()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154864.538708.patch
Type: text/x-patch
Size: 1021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230710/a7c6ee1e/attachment.bin>
More information about the libc-commits
mailing list