[Openmp-commits] [PATCH] D132579: [libomptarget][amdgpu] enable tests whenever possible.
Ye Luo via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Aug 24 11:07:52 PDT 2022
ye-luo created this revision.
Herald added subscribers: kosarev, kerbowa, t-tye, tpr, dstuttard, yaxunl, mgorny, jvesely, kzhuravl.
Herald added a project: All.
ye-luo requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1, wdng.
Herald added a reviewer: jdoerfert.
Herald added a project: OpenMP.
if(TARGET amdgpu-arch) doesn't work when ENABLE_LLVM_PROJECTS=openmp because openmp subdirectory is processed before clang subdirectory. Adopt the same logic of enabling tests like the CUDA plugin.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D132579
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
@@ -106,23 +106,18 @@
set_target_properties(omptarget.rtl.amdgpu PROPERTIES
INSTALL_RPATH "$ORIGIN" BUILD_RPATH "$ORIGIN:${CMAKE_CURRENT_BINARY_DIR}/..")
-# in case of amdgcn, skip running tests if amdgpu-arch was not built or fails
-if (NOT TARGET amdgpu-arch)
- libomptarget_say("Not generating amdgcn test targets as amdgpu-arch is not found")
- return()
-endif()
-
-get_property(AMDGPU_ARCH_COMMAND TARGET amdgpu-arch PROPERTY LOCATION)
-
-execute_process(COMMAND ${AMDGPU_ARCH_COMMAND} 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}")
-else()
+# Report to the parent scope that we are building a plugin for hsa.
+# This controls whether tests are run for the nvptx offloading target
+# Run them if libhsa is available, or if the user explicitly asked for dlopen
+# Otherwise this plugin is being built speculatively and there may be no hsa available
+if (${hsa-runtime64_FOUND} OR LIBOMPTARGET_FORCE_DLOPEN_LIBHSA)
# Report to the parent scope that we are building a plugin for amdgpu
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} amdgcn-amd-amdhsa amdgcn-amd-amdhsa-oldDriver" PARENT_SCOPE)
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} amdgcn-amd-amdhsa amdgcn-amd-amdhsa-LTO" PARENT_SCOPE)
list(APPEND LIBOMPTARGET_TESTED_PLUGINS "omptarget.rtl.amdgpu")
set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE)
+else()
+ libomptarget_say("Not generating amdgcn test targets as libhsa is not linkable")
+ return()
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132579.455294.patch
Type: text/x-patch
Size: 1954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220824/1f923de6/attachment.bin>
More information about the Openmp-commits
mailing list