mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
[OpenMP] Test unified shared memory tests only on systems that support it.
Add a `REQUIRES: unified_shared_memory` option to tests that use `#pragma omp requires unified_shared_memory`. For CUDA, the feature tag is derived from LIBOMPTARGET_DEP_CUDA_ARCH which itself is derived using [[ https://cmake.org/cmake/help/latest/module/FindCUDA.html#commands | cuda_select_nvcc_arch_flags ]]. The latter determines which compute capability the GPU in the system supports. To ensure that this is the CUDA arch being used, we could also set the `-Xopenmp-target -march=` flag. In the absence of an NVIDIA GPU, LIBOMPTARGET_DEP_CUDA_ARCH will be 35. That is, in that case we are assuming unified_shared_memory is not available. CUDA plugin testing could be disabled entirely in this case, but this currently depends on `LIBOMPTARGET_CAN_LINK_LIBCUDA OR LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA`, not on whether the hardware is actually available. For all other targets, nothing changes and we are assuming unified shared memory is available. This might need refinement if not the case. This tries to fix the [[ http://meinersbur.de:8011/#/builders/143 | OpenMP Offloading Buildbot ]] that, although brand-new, only has a Pascal-generation (sm_61) GPU installed. Hence, tests that require unified shared memory are currently failing. I wish I had known in advance. Reviewed By: protze.joachim, tianshilei1992 Differential Revision: https://reviews.llvm.org/D101498
This commit is contained in:
parent
8f98356bb5
commit
34ed3e6337
@ -59,6 +59,21 @@ if config.libomptarget_debug:
|
||||
|
||||
config.available_features.add(config.libomptarget_current_target)
|
||||
|
||||
# Determine whether the test system supports unified memory.
|
||||
# For CUDA, this is the case with compute capability 70 (Volta) or higher.
|
||||
# For all other targets, we currently assume it is.
|
||||
supports_unified_shared_memory = True
|
||||
if config.libomptarget_current_target.startswith('nvptx'):
|
||||
try:
|
||||
cuda_arch = int(config.cuda_test_arch)
|
||||
if cuda_arch < 70:
|
||||
supports_unified_shared_memory = False
|
||||
except ValueError:
|
||||
# If the architecture is invalid, assume it is supported.
|
||||
supports_unified_shared_memory = True
|
||||
if supports_unified_shared_memory:
|
||||
config.available_features.add('unified_shared_memory')
|
||||
|
||||
# Setup environment to find dynamic library at runtime
|
||||
if config.operating_system == 'Windows':
|
||||
append_dynamic_library_path('PATH', config.library_dir, ";")
|
||||
|
@ -7,6 +7,7 @@ config.test_openmp_flags = "@OPENMP_TEST_OPENMP_FLAGS@"
|
||||
config.test_extra_flags = "@OPENMP_TEST_FLAGS@"
|
||||
config.cuda_path = "@CUDA_TOOLKIT_ROOT_DIR@"
|
||||
config.cuda_libdir = "@CUDA_LIBDIR@"
|
||||
config.cuda_test_arch = "@LIBOMPTARGET_DEP_CUDA_ARCH@"
|
||||
config.libomptarget_obj_root = "@CMAKE_CURRENT_BINARY_DIR@/@CURRENT_TARGET@"
|
||||
config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@"
|
||||
config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@"
|
||||
|
@ -2,6 +2,8 @@
|
||||
// RUN: %libomptarget-run-generic 2>&1 \
|
||||
// RUN: | %fcheck-generic
|
||||
|
||||
// REQUIRES: unified_shared_memory
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// RUN: %libomptarget-compile-run-and-check-generic
|
||||
|
||||
// REQUIRES: unified_shared_memory
|
||||
// UNSUPPORTED: clang-6, clang-7, clang-8, clang-9
|
||||
// XFAIL: nvptx64-nvidia-cuda
|
||||
|
||||
// Fails on amdgcn with error: GPU Memory Error
|
||||
// XFAIL: amdgcn-amd-amdhsa
|
||||
|
@ -1,5 +1,7 @@
|
||||
// RUN: %libomptarget-compile-run-and-check-generic
|
||||
|
||||
// REQUIRES: unified_shared_memory
|
||||
|
||||
#include <omp.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// RUN: %libomptarget-compile-run-and-check-generic
|
||||
// XFAIL: nvptx64-nvidia-cuda
|
||||
|
||||
// REQUIRES: unified_shared_memory
|
||||
// UNSUPPORTED: clang-6, clang-7, clang-8, clang-9
|
||||
|
||||
// amdgcn does not have printf definition
|
||||
|
@ -1,5 +1,6 @@
|
||||
// RUN: %libomptarget-compile-run-and-check-generic
|
||||
// XFAIL: nvptx64-nvidia-cuda
|
||||
|
||||
// REQUIRES: unified_shared_memory
|
||||
|
||||
// amdgcn does not have printf definition
|
||||
// XFAIL: amdgcn-amd-amdhsa
|
||||
|
Loading…
Reference in New Issue
Block a user