[Openmp-commits] [PATCH] D142018: [Libomptarget] Only build GPU tests if a GPU is found on the system
Joseph Huber via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Jan 18 08:35:52 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGea0eee80d898: [Libomptarget] Only build GPU tests if a GPU is found on the system (authored by jhuber6).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142018/new/
https://reviews.llvm.org/D142018
Files:
openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
openmp/libomptarget/plugins/cuda/CMakeLists.txt
Index: openmp/libomptarget/plugins/cuda/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins/cuda/CMakeLists.txt
+++ openmp/libomptarget/plugins/cuda/CMakeLists.txt
@@ -98,7 +98,8 @@
# This controls whether tests are run for the nvptx offloading target
# Run them if libcuda is available, or if the user explicitly asked for dlopen
# Otherwise this plugin is being built speculatively and there may be no cuda available
-if (LIBOMPTARGET_CAN_LINK_LIBCUDA OR LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA)
+option(LIBOMPTARGET_FORCE_NVIDIA_TESTS "Build NVIDIA libomptarget tests" OFF)
+if (LIBOMPTARGET_FOUND_NVIDIA_GPU OR LIBOMPTARGET_FORCE_NVIDIA_TESTS)
libomptarget_say("Enable tests using CUDA plugin")
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} nvptx64-nvidia-cuda nvptx64-nvidia-cuda-oldDriver" PARENT_SCOPE)
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} nvptx64-nvidia-cuda nvptx64-nvidia-cuda-LTO" PARENT_SCOPE)
Index: openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
===================================================================
--- openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+++ openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
@@ -111,7 +111,8 @@
# 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)
+option(LIBOMPTARGET_FORCE_AMDGPU_TESTS "Build AMDGPU libomptarget tests" OFF)
+if (LIBOMPTARGET_FOUND_AMDGPU_GPU OR LIBOMPTARGET_FORCE_AMDGPU_TESTS)
# 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)
Index: openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
===================================================================
--- openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+++ openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -118,6 +118,7 @@
string(SUBSTRING "${LIBOMPTARGET_NVPTX_ARCH_OUTPUT}" 0 ${first_arch_string}
arch_string)
if(arch_string)
+ set(LIBOMPTARGET_FOUND_NVIDIA_GPU TRUE)
set(LIBOMPTARGET_DEP_CUDA_ARCH "${arch_string}")
endif()
endif()
@@ -158,6 +159,25 @@
mark_as_advanced(LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES)
+################################################################################
+# Looking for AMD GPUs...
+################################################################################
+
+find_program(LIBOMPTARGET_AMDGPU_ARCH NAMES amdgpu-arch PATHS ${LLVM_BINARY_DIR}/bin)
+if(LIBOMPTARGET_AMDGPU_ARCH)
+ execute_process(COMMAND ${LIBOMPTARGET_AMDGPU_ARCH}
+ OUTPUT_VARIABLE LIBOMPTARGET_AMDGPU_ARCH_OUTPUT
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(FIND "${LIBOMPTARGET_AMDGPU_ARCH_OUTPUT}" "\n" first_arch_string)
+ string(SUBSTRING "${LIBOMPTARGET_AMDGPU_ARCH_OUTPUT}" 0 ${first_arch_string}
+ arch_string)
+ if(arch_string)
+ set(LIBOMPTARGET_FOUND_AMDGPU_GPU TRUE)
+ set(LIBOMPTARGET_DEP_AMDGPU_ARCH "${arch_string}")
+ endif()
+endif()
+
+
################################################################################
# Looking for VEO...
################################################################################
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142018.490186.patch
Type: text/x-patch
Size: 3673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230118/886ee776/attachment.bin>
More information about the Openmp-commits
mailing list