Skip to content

Commit def5905

Browse files
committed
[libc] Do not find system binaries for offloading tools
We use `find_program` to identify a few programs we use for offloading. Namely, `clang-offload-packger`, `amdgpu-arch`, and `nvptx-arch`. Currently the logic allows these to bind to any tool matching this name, so it will find it on the system. This meant that if the installation was deleted or it found a broken binary the compilation would fail. We should only pull these from the current LLVM binary directory. Reviewed By: arsenm Differential Revision: https://reviews.llvm.org/D158203
1 parent 83a0699 commit def5905

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libc/cmake/modules/prepare_libc_gpu_build.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ endif()
3030

3131
# Identify any locally installed AMD GPUs on the system using 'amdgpu-arch'.
3232
find_program(LIBC_AMDGPU_ARCH
33-
NAMES amdgpu-arch
33+
NAMES amdgpu-arch NO_DEFAULT_PATH
3434
PATHS ${LLVM_BINARY_DIR}/bin /opt/rocm/llvm/bin/)
3535

3636
# Identify any locally installed NVIDIA GPUs on the system using 'nvptx-arch'.
3737
find_program(LIBC_NVPTX_ARCH
38-
NAMES nvptx-arch
38+
NAMES nvptx-arch NO_DEFAULT_PATH
3939
PATHS ${LLVM_BINARY_DIR}/bin)
4040

4141
# Get the list of all natively supported GPU architectures.
@@ -64,7 +64,7 @@ message(STATUS "Building libc for the following GPU architecture(s): "
6464

6565
# Identify the program used to package multiple images into a single binary.
6666
find_program(LIBC_CLANG_OFFLOAD_PACKAGER
67-
NAMES clang-offload-packager
67+
NAMES clang-offload-packager NO_DEFAULT_PATH
6868
PATHS ${LLVM_BINARY_DIR}/bin)
6969
if(NOT LIBC_CLANG_OFFLOAD_PACKAGER)
7070
message(FATAL_ERROR "Cannot find the 'clang-offload-packager' for the GPU "

0 commit comments

Comments
 (0)