[libc-commits] [PATCH] D158203: [libc] Do not find system binaries for offloading tools

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Aug 17 11:38:11 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: JonChesterfield, arsenm, sivachandra, michaelrj.
Herald added subscribers: libc-commits, tpr.
Herald added projects: libc-project, All.
jhuber6 requested review of this revision.
Herald added subscribers: wangpc, wdng.

  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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158203

Files:
  libc/cmake/modules/prepare_libc_gpu_build.cmake


Index: libc/cmake/modules/prepare_libc_gpu_build.cmake
===================================================================
--- libc/cmake/modules/prepare_libc_gpu_build.cmake
+++ libc/cmake/modules/prepare_libc_gpu_build.cmake
@@ -30,12 +30,12 @@
 
 # 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 @@
 
 # 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 "


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158203.551211.patch
Type: text/x-patch
Size: 1201 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230817/79deb704/attachment.bin>


More information about the libc-commits mailing list