[Openmp-commits] [PATCH] D102054: [AMDGPU][OpenMP] Disable tests when amdgpu-arch fails

Pushpinder Singh via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri May 7 01:19:45 PDT 2021


pdhaliwal created this revision.
pdhaliwal added reviewers: JonChesterfield, ronlieb, protze.joachim.
Herald added subscribers: kerbowa, guansong, t-tye, tpr, dstuttard, yaxunl, mgorny, nhaehnle, jvesely, kzhuravl.
pdhaliwal requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1, wdng.
Herald added a reviewer: jdoerfert.
Herald added a project: OpenMP.

This patch prevents runtime tests running on systems without amdgpu.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102054

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


Index: openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+++ openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
@@ -80,6 +80,29 @@
   "-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
+libomptarget_say("${AMDGPU_ARCH_TOOL}")
+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)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102054.343607.patch
Type: text/x-patch
Size: 1273 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210507/6b6c42dd/attachment-0001.bin>


More information about the Openmp-commits mailing list