Skip to content

Commit 3440466

Browse files
[OpenMP] Fix two usm tests for amdgpus. (llvm#78824)
Some are missing setting of HSA_XNACK=1 environment variable, used to enable unified memory support on amdgpu's when it's not been set at kernel boot time. Some others needed to be marked as supporting unified_shared_memory in the lit test harness. Extend lit test harness to enable unified_shared_memory requirement for AMD GPUs. Reland: llvm#77851
1 parent ac3ee1b commit 3440466

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

openmp/libomptarget/test/lit.cfg

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,13 @@ if config.libomptarget_current_target.startswith('nvptx'):
116116
except ValueError:
117117
# If the architecture is invalid, assume it is supported.
118118
supports_unified_shared_memory = True
119-
if config.libomptarget_current_target.startswith('amdgcn'):
120-
supports_unified_shared_memory = False
119+
elif config.libomptarget_current_target.startswith('amdgcn'):
120+
# amdgpu_test_arch contains a list of AMD GPUs in the system
121+
# only check the first one assuming that we will run the test on it.
122+
if not (config.amdgpu_test_arch.startswith("gfx90a") or
123+
config.amdgpu_test_arch.startswith("gfx940") or
124+
config.amdgpu_test_arch.startswith("gfx942")):
125+
supports_unified_shared_memory = False
121126
if supports_unified_shared_memory:
122127
config.available_features.add('unified_shared_memory')
123128

openmp/libomptarget/test/lit.site.cfg.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config.test_extra_flags = "@OPENMP_TEST_FLAGS@"
1010
config.cuda_path = "@CUDA_TOOLKIT_ROOT_DIR@"
1111
config.cuda_libdir = "@CUDA_LIBDIR@"
1212
config.cuda_test_arch = "@LIBOMPTARGET_DEP_CUDA_ARCH@"
13+
config.amdgpu_test_arch = "@LIBOMPTARGET_AMDGPU_DETECTED_ARCH_LIST@"
1314
config.libomptarget_obj_root = "@CMAKE_CURRENT_BINARY_DIR@/@CURRENT_TARGET@"
1415
config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@"
1516
config.llvm_library_dir = "@LIBOMPTARGET_LLVM_LIBRARY_DIR@"

openmp/libomptarget/test/unified_shared_memory/api.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
// RUN: %libomptarget-compile-run-and-check-generic
1+
// RUN: %libomptarget-compile-generic
2+
// RUN: env HSA_XNACK=1 \
3+
// RUN: %libomptarget-run-generic | %fcheck-generic
24
// XFAIL: nvptx64-nvidia-cuda
35
// XFAIL: nvptx64-nvidia-cuda-LTO
46

5-
// Fails on amdgpu with error: GPU Memory Error
6-
// UNSUPPORTED: amdgcn-amd-amdhsa
7+
// REQUIRES: unified_shared_memory
78

89
#include <omp.h>
910
#include <stdio.h>

openmp/libomptarget/test/unified_shared_memory/close_enter_exit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// RUN: %libomptarget-compile-run-and-check-generic
1+
// RUN: %libomptarget-compile-generic
2+
// RUN: env HSA_XNACK=1 \
3+
// RUN: %libomptarget-run-generic | %fcheck-generic
24

35
// REQUIRES: unified_shared_memory
46
// UNSUPPORTED: clang-6, clang-7, clang-8, clang-9
57

6-
// Fails on amdgpu with error: GPU Memory Error
78
// Fails on nvptx with error: an illegal memory access was encountered
8-
// XFAIL: amdgcn-amd-amdhsa
99
// XFAIL: nvptx64-nvidia-cuda
1010
// XFAIL: nvptx64-nvidia-cuda-LTO
1111

0 commit comments

Comments
 (0)