[libc-commits] [libc] def5905 - [libc] Do not find system binaries for offloading tools
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Thu Aug 17 12:16:32 PDT 2023
Author: Joseph Huber
Date: 2023-08-17T14:16:24-05:00
New Revision: def5905c4592beb5da7c2a9607b3fe8b3103ff44
URL: https://github.com/llvm/llvm-project/commit/def5905c4592beb5da7c2a9607b3fe8b3103ff44
DIFF: https://github.com/llvm/llvm-project/commit/def5905c4592beb5da7c2a9607b3fe8b3103ff44.diff
LOG: [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
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 ea79a42faeef60..5bf1fc07c8a6d5 100644
--- a/libc/cmake/modules/prepare_libc_gpu_build.cmake
+++ b/libc/cmake/modules/prepare_libc_gpu_build.cmake
@@ -30,12 +30,12 @@ endif()
# Identify any locally installed AMD GPUs on the system using 'amdgpu-arch'.
find_program(LIBC_AMDGPU_ARCH
- NAMES amdgpu-arch
+ NAMES amdgpu-arch NO_DEFAULT_PATH
PATHS ${LLVM_BINARY_DIR}/bin /opt/rocm/llvm/bin/)
# Identify any locally installed NVIDIA GPUs on the system using 'nvptx-arch'.
find_program(LIBC_NVPTX_ARCH
- NAMES nvptx-arch
+ NAMES nvptx-arch NO_DEFAULT_PATH
PATHS ${LLVM_BINARY_DIR}/bin)
# Get the list of all natively supported GPU architectures.
@@ -64,7 +64,7 @@ message(STATUS "Building libc for the following GPU architecture(s): "
# Identify the program used to package multiple images into a single binary.
find_program(LIBC_CLANG_OFFLOAD_PACKAGER
- NAMES clang-offload-packager
+ NAMES clang-offload-packager NO_DEFAULT_PATH
PATHS ${LLVM_BINARY_DIR}/bin)
if(NOT LIBC_CLANG_OFFLOAD_PACKAGER)
message(FATAL_ERROR "Cannot find the 'clang-offload-packager' for the GPU "
More information about the libc-commits
mailing list