[Openmp-commits] [PATCH] D101498: [OpenMP] Test unified shared memory tests only on systems that support it.
Michael Kruse via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Wed Apr 28 15:55:20 PDT 2021
Meinersbur created this revision.
Meinersbur added reviewers: protze.joachim, jdoerfert, tianshilei1992.
Meinersbur added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
Meinersbur requested review of this revision.
Herald added a subscriber: sstefan1.
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 cuda_select_nvcc_arch_flags <https://cmake.org/cmake/help/latest/module/FindCUDA.html#commands>. 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 OpenMP Offloading Buildbot <http://meinersbur.de:8011/#/builders/143> 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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101498
Files:
openmp/libomptarget/test/lit.cfg
openmp/libomptarget/test/lit.site.cfg.in
openmp/libomptarget/test/mapping/present/unified_shared_memory.c
openmp/libomptarget/test/unified_shared_memory/close_enter_exit.c
openmp/libomptarget/test/unified_shared_memory/close_manual.c
openmp/libomptarget/test/unified_shared_memory/close_modifier.c
openmp/libomptarget/test/unified_shared_memory/shared_update.c
Index: openmp/libomptarget/test/unified_shared_memory/shared_update.c
===================================================================
--- openmp/libomptarget/test/unified_shared_memory/shared_update.c
+++ openmp/libomptarget/test/unified_shared_memory/shared_update.c
@@ -1,4 +1,6 @@
// RUN: %libomptarget-compile-run-and-check-generic
+
+// REQUIRES: unified_shared_memory
// XFAIL: nvptx64-nvidia-cuda
#include <stdio.h>
Index: openmp/libomptarget/test/unified_shared_memory/close_modifier.c
===================================================================
--- openmp/libomptarget/test/unified_shared_memory/close_modifier.c
+++ openmp/libomptarget/test/unified_shared_memory/close_modifier.c
@@ -1,6 +1,7 @@
// RUN: %libomptarget-compile-run-and-check-generic
// XFAIL: nvptx64-nvidia-cuda
+// REQUIRES: unified_shared_memory
// UNSUPPORTED: clang-6, clang-7, clang-8, clang-9
#include <omp.h>
Index: openmp/libomptarget/test/unified_shared_memory/close_manual.c
===================================================================
--- openmp/libomptarget/test/unified_shared_memory/close_manual.c
+++ openmp/libomptarget/test/unified_shared_memory/close_manual.c
@@ -1,5 +1,7 @@
// RUN: %libomptarget-compile-run-and-check-generic
+// REQUIRES: unified_shared_memory
+
#include <omp.h>
#include <stdio.h>
Index: openmp/libomptarget/test/unified_shared_memory/close_enter_exit.c
===================================================================
--- openmp/libomptarget/test/unified_shared_memory/close_enter_exit.c
+++ openmp/libomptarget/test/unified_shared_memory/close_enter_exit.c
@@ -1,5 +1,6 @@
// RUN: %libomptarget-compile-run-and-check-generic
+// REQUIRES: unified_shared_memory
// UNSUPPORTED: clang-6, clang-7, clang-8, clang-9
// XFAIL: nvptx64-nvidia-cuda
Index: openmp/libomptarget/test/mapping/present/unified_shared_memory.c
===================================================================
--- openmp/libomptarget/test/mapping/present/unified_shared_memory.c
+++ openmp/libomptarget/test/mapping/present/unified_shared_memory.c
@@ -2,6 +2,8 @@
// RUN: %libomptarget-run-generic 2>&1 \
// RUN: | %fcheck-generic
+// REQUIRES: unified_shared_memory
+
#include <stdio.h>
Index: openmp/libomptarget/test/lit.site.cfg.in
===================================================================
--- openmp/libomptarget/test/lit.site.cfg.in
+++ openmp/libomptarget/test/lit.site.cfg.in
@@ -7,6 +7,7 @@
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@"
Index: openmp/libomptarget/test/lit.cfg
===================================================================
--- openmp/libomptarget/test/lit.cfg
+++ openmp/libomptarget/test/lit.cfg
@@ -59,6 +59,21 @@
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, ";")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101498.341330.patch
Type: text/x-patch
Size: 3917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210428/fe0e44f7/attachment.bin>
More information about the Openmp-commits
mailing list