[libc-commits] [PATCH] D146861: [libc] Enable integration tests targeting NVIDIA GPUs
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Mar 24 19:02:43 PDT 2023
jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, JonChesterfield, tianshilei1992, sivachandra, lntue, michaelrj, tra.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.
Herald added subscribers: jplehr, sstefan1.
This patch adds the necessary build infrastructure to build and run the
integration tests on NVIDIA GPUs. The NVIDIA `nvlink` linker utility is
what is ultimately used to combine these files into a single executable
image. Unfortunately, their tool does not support static libraries. So
we need to link with every object directly instead. This could be solved
by impelementing a "wrapper" utility around `nvlink` like we used to use
for OpenMP. But for now this should be sufficient.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146861
Files:
libc/cmake/modules/LLVMLibCTestRules.cmake
libc/utils/gpu/loader/CMakeLists.txt
Index: libc/utils/gpu/loader/CMakeLists.txt
===================================================================
--- libc/utils/gpu/loader/CMakeLists.txt
+++ libc/utils/gpu/loader/CMakeLists.txt
@@ -24,4 +24,12 @@
PROPERTIES
EXECUTABLE "$<TARGET_FILE:amdhsa_loader>"
)
+elseif(TARGET nvptx_loader AND LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
+ add_custom_target(libc.utils.gpu.loader)
+ add_dependencies(libc.utils.gpu.loader nvptx_loader)
+ set_target_properties(
+ libc.utils.gpu.loader
+ PROPERTIES
+ EXECUTABLE "$<TARGET_FILE:nvptx_loader>"
+ )
endif()
Index: libc/cmake/modules/LLVMLibCTestRules.cmake
===================================================================
--- libc/cmake/modules/LLVMLibCTestRules.cmake
+++ libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -484,6 +484,8 @@
add_executable(
${fq_build_target_name}
EXCLUDE_FROM_ALL
+ # The NVIDIA 'nvlink' linker does not currently support static libraries.
+ $<$<BOOL:${LIBC_TARGET_ARCHITECTURE_IS_GPU}>:${link_object_files}>
${INTEGRATION_TEST_SRCS}
${INTEGRATION_TEST_HDRS}
)
@@ -510,9 +512,12 @@
endif()
target_link_options(${fq_build_target_name} PRIVATE -nostdlib -static)
- target_link_libraries(${fq_build_target_name} ${fq_target_name}.__libc__
- libc.startup.${LIBC_TARGET_OS}.crt1
- libc.test.IntegrationTest.test)
+ target_link_libraries(
+ ${fq_build_target_name}
+ # The NVIDIA 'nvlink' linker does not currently support static libraries.
+ $<$<NOT:$<BOOL:${LIBC_TARGET_ARCHITECTURE_IS_GPU}>>:${fq_target_name}.__libc__>
+ libc.startup.${LIBC_TARGET_OS}.crt1
+ libc.test.IntegrationTest.test)
add_dependencies(${fq_build_target_name}
libc.test.IntegrationTest.test
${INTEGRATION_TEST_DEPENDS})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146861.508267.patch
Type: text/x-patch
Size: 1846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230325/429aaebf/attachment.bin>
More information about the libc-commits
mailing list