[Openmp-commits] [openmp] 322ea53 - [libomptarget][amdgpu] enable tests whenever possible.
Ye Luo via Openmp-commits
openmp-commits at lists.llvm.org
Wed Aug 24 12:33:47 PDT 2022
Author: Ye Luo
Date: 2022-08-24T14:33:28-05:00
New Revision: 322ea53144e82c34d5c933cb4ce5a83807e3b67e
URL: https://github.com/llvm/llvm-project/commit/322ea53144e82c34d5c933cb4ce5a83807e3b67e
DIFF: https://github.com/llvm/llvm-project/commit/322ea53144e82c34d5c933cb4ce5a83807e3b67e.diff
LOG: [libomptarget][amdgpu] enable tests whenever possible.
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.
Differential Revision: https://reviews.llvm.org/D132579
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 231b833e40608..9f7247eefa75b 100644
--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
@@ -106,23 +106,18 @@ install(TARGETS omptarget.rtl.amdgpu LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDI
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()
More information about the Openmp-commits
mailing list