[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
Thu May 13 09:04:11 PDT 2021


Meinersbur updated this revision to Diff 345167.
Meinersbur edited the summary of this revision.
Meinersbur added a comment.

- Remove XFAIL lines that are there because of USM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101498/new/

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,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
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,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
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,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
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.345167.patch
Type: text/x-patch
Size: 4072 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210513/17d0c72f/attachment-0001.bin>


More information about the Openmp-commits mailing list