[Openmp-commits] [openmp] 9586937 - [AMDGPU][OpenMP] Disable tests when amdgpu-arch fails

Pushpinder Singh via Openmp-commits openmp-commits at lists.llvm.org
Mon May 10 00:37:44 PDT 2021


Author: Pushpinder Singh
Date: 2021-05-10T07:37:27Z
New Revision: 9586937ef513b5b9b134322c6c81dcdd03ca784a

URL: https://github.com/llvm/llvm-project/commit/9586937ef513b5b9b134322c6c81dcdd03ca784a
DIFF: https://github.com/llvm/llvm-project/commit/9586937ef513b5b9b134322c6c81dcdd03ca784a.diff

LOG: [AMDGPU][OpenMP] Disable tests when amdgpu-arch fails

This patch prevents runtime tests running on systems without amdgpu.

Reviewed By: protze.joachim, tianshilei1992

Differential Revision: https://reviews.llvm.org/D102054

Added: 
    

Modified: 
    openmp/libomptarget/plugins/amdgpu/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
index 43934b52e42be..64c436d9d8871 100644
--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
@@ -80,6 +80,28 @@ target_link_libraries(
   "-Wl,-z,defs"
   )
 
+if (LLVM_BINARY_DIR)
+  # for in-tree build using LLVM_ENABLE_RUNTIMES
+  set(AMDGPU_ARCH_TOOL "${LLVM_BINARY_DIR}/bin/amdgpu-arch")
+elseif (OPENMP_LLVM_TOOLS_DIR)
+  set(AMDGPU_ARCH_TOOL "${OPENMP_LLVM_TOOLS_DIR}/amdgpu-arch")
+else()
+  set(AMDGPU_ARCH_TOOL "amdgpu-arch")
+endif()
+
+# in case of amdgcn, skip running tests if amdgpu-arch was not built or fails
+if (NOT EXISTS "${AMDGPU_ARCH_TOOL}")
+  libomptarget_say("Not generating amdgcn test targets as amdgpu-arch is not found")
+  return()
+endif()
+
+execute_process(COMMAND "${AMDGPU_ARCH_TOOL}" RESULT_VARIABLE amdgpu_arch_result
+  OUTPUT_VARIABLE amdgpu_arch_output)
+if (${amdgpu_arch_result})
+  libomptarget_say("Not generating amdgcn test targets as amdgpu-arch exited with ${amdgpu_arch_result}")
+  return()
+endif()
+
 # Report to the parent scope that we are building a plugin for amdgpu
 set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} amdgcn-amd-amdhsa" PARENT_SCOPE)
 


        


More information about the Openmp-commits mailing list