[Openmp-commits] [openmp] 7c3fa75 - OpenMP/cmake: Use TARGET instead of looking for amdgpu-arch

Matt Arsenault via Openmp-commits openmp-commits at lists.llvm.org
Wed Jun 28 03:55:20 PDT 2023


Author: Matt Arsenault
Date: 2023-06-28T06:55:15-04:00
New Revision: 7c3fa755f1ee87d8984ec4bcf57ffdb136fea862

URL: https://github.com/llvm/llvm-project/commit/7c3fa755f1ee87d8984ec4bcf57ffdb136fea862
DIFF: https://github.com/llvm/llvm-project/commit/7c3fa755f1ee87d8984ec4bcf57ffdb136fea862.diff

LOG: OpenMP/cmake: Use TARGET instead of looking for amdgpu-arch

Not sure if the standalone build case is supposed to be a supported
path. Should probably rely on find_package and imported targets
anyway.

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 1db8423ec06b4..e1e3af5b0fb5f 100644
--- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -128,11 +128,17 @@ endif()
 # Looking for AMD GPUs...
 ################################################################################
 
-find_program(LIBOMPTARGET_AMDGPU_ARCH NAMES amdgpu-arch PATHS ${LLVM_BINARY_DIR}/bin)
+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)
+endif()
+
 if(LIBOMPTARGET_AMDGPU_ARCH)
   execute_process(COMMAND ${LIBOMPTARGET_AMDGPU_ARCH}
                   OUTPUT_VARIABLE LIBOMPTARGET_AMDGPU_ARCH_OUTPUT
-                  OUTPUT_STRIP_TRAILING_WHITESPACE)
+                  OUTPUT_STRIP_TRAILING_WHITESPACE
+                  COMMAND_ERROR_IS_FATAL ANY)
   string(REPLACE "\n" ";" amdgpu_arch_list "${LIBOMPTARGET_AMDGPU_ARCH_OUTPUT}")
   if(amdgpu_arch_list)
     set(LIBOMPTARGET_FOUND_AMDGPU_GPU TRUE)


        


More information about the Openmp-commits mailing list