[Openmp-commits] [openmp] 968f65a - [OpenMP] Adjust using the NVPTX architecture detection tool

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 29 10:14:57 PDT 2023


Author: Joseph Huber
Date: 2023-06-29T12:14:44-05:00
New Revision: 968f65ae03f6f07567fc3e76559b0846cfeeced1

URL: https://github.com/llvm/llvm-project/commit/968f65ae03f6f07567fc3e76559b0846cfeeced1
DIFF: https://github.com/llvm/llvm-project/commit/968f65ae03f6f07567fc3e76559b0846cfeeced1.diff

LOG: [OpenMP] Adjust using the NVPTX architecture detection tool

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

Added: 
    

Modified: 
    openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
index d08aa9da144eb1..89d626b5075822 100644
--- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -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
@@ -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)


        


More information about the Openmp-commits mailing list