diff --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg --- a/openmp/libomptarget/test/lit.cfg +++ b/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, ";") diff --git a/openmp/libomptarget/test/lit.site.cfg.in b/openmp/libomptarget/test/lit.site.cfg.in --- a/openmp/libomptarget/test/lit.site.cfg.in +++ b/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@" diff --git a/openmp/libomptarget/test/mapping/present/unified_shared_memory.c b/openmp/libomptarget/test/mapping/present/unified_shared_memory.c --- a/openmp/libomptarget/test/mapping/present/unified_shared_memory.c +++ b/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 diff --git a/openmp/libomptarget/test/unified_shared_memory/close_enter_exit.c b/openmp/libomptarget/test/unified_shared_memory/close_enter_exit.c --- a/openmp/libomptarget/test/unified_shared_memory/close_enter_exit.c +++ b/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 diff --git a/openmp/libomptarget/test/unified_shared_memory/close_manual.c b/openmp/libomptarget/test/unified_shared_memory/close_manual.c --- a/openmp/libomptarget/test/unified_shared_memory/close_manual.c +++ b/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 #include diff --git a/openmp/libomptarget/test/unified_shared_memory/close_modifier.c b/openmp/libomptarget/test/unified_shared_memory/close_modifier.c --- a/openmp/libomptarget/test/unified_shared_memory/close_modifier.c +++ b/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 diff --git a/openmp/libomptarget/test/unified_shared_memory/shared_update.c b/openmp/libomptarget/test/unified_shared_memory/shared_update.c --- a/openmp/libomptarget/test/unified_shared_memory/shared_update.c +++ b/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