[libc-commits] [libc] 7a5c01d - [libc] Search the compiler's path for GPU utility tools (#82712)
via libc-commits
libc-commits at lists.llvm.org
Thu Feb 22 16:55:50 PST 2024
Author: Joseph Huber
Date: 2024-02-22T18:55:46-06:00
New Revision: 7a5c01dbca3ddfc6dd87775ec90346783c8e2c73
URL: https://github.com/llvm/llvm-project/commit/7a5c01dbca3ddfc6dd87775ec90346783c8e2c73
DIFF: https://github.com/llvm/llvm-project/commit/7a5c01dbca3ddfc6dd87775ec90346783c8e2c73.diff
LOG: [libc] Search the compiler's path for GPU utility tools (#82712)
Summary:
We need some extra tools for the GPU build. Normally we search for these
from the build itself, but in the case of a `LLVM_PROJECTS_BUILD` or
some other kind of external build, this directory will not be populated.
However, the GPU build already requires that the compiler is an
up-to-date clang, which should always have these present next to the
binary. Simply add this as a fallback search path. Generally we want it
to be the second, because it would pick up someone install and then
become stale.
Added:
Modified:
libc/cmake/modules/prepare_libc_gpu_build.cmake
Removed:
################################################################################
diff --git a/libc/cmake/modules/prepare_libc_gpu_build.cmake b/libc/cmake/modules/prepare_libc_gpu_build.cmake
index 75beef86760c8d..752182f67cc019 100644
--- a/libc/cmake/modules/prepare_libc_gpu_build.cmake
+++ b/libc/cmake/modules/prepare_libc_gpu_build.cmake
@@ -17,9 +17,10 @@ if(NOT LLVM_LIBC_FULL_BUILD)
endif()
# Identify the program used to package multiple images into a single binary.
+get_filename_component(compiler_path ${CMAKE_CXX_COMPILER} DIRECTORY)
find_program(LIBC_CLANG_OFFLOAD_PACKAGER
NAMES clang-offload-packager NO_DEFAULT_PATH
- PATHS ${LLVM_BINARY_DIR}/bin)
+ PATHS ${LLVM_BINARY_DIR}/bin ${compiler_path})
if(NOT LIBC_CLANG_OFFLOAD_PACKAGER)
message(FATAL_ERROR "Cannot find the 'clang-offload-packager' for the GPU "
"build")
@@ -45,7 +46,7 @@ elseif(LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
# Using 'check_cxx_compiler_flag' does not work currently due to the link job.
find_program(LIBC_NVPTX_ARCH
NAMES nvptx-arch NO_DEFAULT_PATH
- PATHS ${LLVM_BINARY_DIR}/bin)
+ PATHS ${LLVM_BINARY_DIR}/bin ${compiler_path})
if(LIBC_NVPTX_ARCH)
execute_process(COMMAND ${LIBC_NVPTX_ARCH}
OUTPUT_VARIABLE arch_tool_output
More information about the libc-commits
mailing list