Skip to content

Commit

Permalink
[OpenMP] Adjust using the NVPTX architecture detection tool
Browse files Browse the repository at this point in the history
A previous patch by @arsenm adjusted these to find the `amdgpu-arch`
tool correctly if we do a `LLVM_ENABLE_PROJECTS` build. This patch
applies the same to `nvptx-arch` tool to keep it consistent.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D154107
  • Loading branch information
jhuber6 committed Jun 29, 2023
1 parent c304be7 commit 968f65a
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@ set(LIBOMPTARGET_DEP_CUDA_FOUND ${CUDAToolkit_FOUND})
################################################################################
set(LIBOMPTARGET_DEP_CUDA_ARCH "sm_35")

find_program(LIBOMPTARGET_NVPTX_ARCH NAMES nvptx-arch PATHS ${LLVM_BINARY_DIR}/bin)
if(TARGET nvptx-arch)
get_property(LIBOMPTARGET_NVPTX_ARCH TARGET nvptx-arch PROPERTY LOCATION)
else()
find_program(LIBOMPTARGET_NVPTX_ARCH NAMES nvptx-arch
PATHS ${LLVM_TOOLS_BINARY_DIR}/bin)
endif()

if(LIBOMPTARGET_NVPTX_ARCH)
execute_process(COMMAND ${LIBOMPTARGET_NVPTX_ARCH}
OUTPUT_VARIABLE LIBOMPTARGET_NVPTX_ARCH_OUTPUT
Expand All @@ -130,8 +136,9 @@ endif()

if(TARGET amdgpu-arch)
get_property(LIBOMPTARGET_AMDGPU_ARCH TARGET amdgpu-arch PROPERTY LOCATION)
else()
find_program(LIBOMPTARGET_AMDGPU_ARCH NAMES amdgpu-arch PATHS ${LLVM_BINARY_DIR}/bin)
else()
find_program(LIBOMPTARGET_AMDGPU_ARCH NAMES amdgpu-arch
PATHS ${LLVM_TOOLS_BINARY_DIR}/bin)
endif()

if(LIBOMPTARGET_AMDGPU_ARCH)
Expand Down

0 comments on commit 968f65a

Please sign in to comment.