Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Offload] Refactor offload test requirements #95196

Merged
merged 8 commits into from
Jun 29, 2024

Conversation

EthanLuisMcDonough
Copy link
Member

Many tests in the offload project have requirements defined by which targets are not supported rather than which platforms are supported. This patch aims to streamline the requirement definitions by adding four new feature tags: host, gpu, amdgpu, and nvidia-gpu.

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 12, 2024

@llvm/pr-subscribers-offload

Author: Ethan Luis McDonough (EthanLuisMcDonough)

Changes

Many tests in the offload project have requirements defined by which targets are not supported rather than which platforms are supported. This patch aims to streamline the requirement definitions by adding four new feature tags: host, gpu, amdgpu, and nvidia-gpu.


Patch is 67.16 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/95196.diff

92 Files Affected:

  • (modified) offload/test/api/omp_dynamic_shared_memory.c (+1-6)
  • (modified) offload/test/jit/empty_kernel_lvl1.c (+1-6)
  • (modified) offload/test/jit/empty_kernel_lvl2.c (+1-6)
  • (modified) offload/test/jit/type_punning.c (+1-6)
  • (modified) offload/test/libc/assert.c (+1-6)
  • (modified) offload/test/lit.cfg (+18)
  • (modified) offload/test/mapping/auto_zero_copy.cpp (+1-9)
  • (modified) offload/test/mapping/auto_zero_copy_apu.cpp (+1-7)
  • (modified) offload/test/mapping/auto_zero_copy_globals.cpp (+1-9)
  • (modified) offload/test/mapping/prelock.cpp (+1-4)
  • (modified) offload/test/offloading/barrier_fence.c (+1-6)
  • (modified) offload/test/offloading/bug49334.cpp (+1-6)
  • (modified) offload/test/offloading/default_thread_limit.c (+1-6)
  • (modified) offload/test/offloading/dynamic_module.c (+1-1)
  • (modified) offload/test/offloading/fortran/basic-target-parallel-do.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/basic-target-parallel-region.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/basic-target-region-1D-array-section.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/basic-target-region-3D-array-section.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/basic-target-region-3D-array.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/basic_target_region.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/constant-arr-index.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/declare-target-vars-in-target-region.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/double-target-call-with-declare-target.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/target-map-allocatable-array-section-1d-bounds.f90 (+2-7)
  • (modified) offload/test/offloading/fortran/target-map-allocatable-array-section-3d-bounds.f90 (+2-7)
  • (modified) offload/test/offloading/fortran/target-map-allocatable-map-scopes.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-derived-type-full-1.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-derived-type-full-2.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-derived-type-full-implicit-1.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-derived-type-full-implicit-2.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-double-large-nested-dtype-multi-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-double-nested-dtype-array-bounds.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-double-nested-dtype-double-array-bounds.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-double-nested-dtype-single-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-dtype-arr-bounds-member-enter-exit-update.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-dtype-arr-bounds-member-enter-exit.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-dtype-explicit-individual-array-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-dtype-multi-explicit-array-3D-member-bounds.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-dtype-multi-explicit-array-member-bounds.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-dtype-multi-explicit-array-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-dtype-multi-explicit-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-enter-exit-allocatables.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-enter-exit-array-2.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-enter-exit-array-bounds.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-enter-exit-array.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-enter-exit-scalar.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-individual-dtype-member-map.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-large-nested-dtype-multi-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-nested-dtype-complex-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-nested-dtype-derived-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-nested-dtype-multi-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-nested-dtype-single-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-pointer-scopes-enter-exit.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-pointer-target-array-section-3d-bounds.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-pointer-target-scopes.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-two-dtype-explicit-member.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-two-dtype-individual-member-array-1D-bounds.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-two-dtype-mixed-implicit-explicit-capture-1.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-two-dtype-mixed-implicit-explicit-capture-2.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-two-dtype-multi-member-array-1D-bounds.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-map-two-nested-dtype-member-array-map.f90 (-6)
  • (modified) offload/test/offloading/fortran/target-nested-target-data.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/target-parallel-do-collapse.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/target-region-implicit-array.f90 (+1-4)
  • (modified) offload/test/offloading/fortran/target_map_common_block.f90 (+1-8)
  • (modified) offload/test/offloading/fortran/target_map_common_block1.f90 (-7)
  • (modified) offload/test/offloading/fortran/target_map_common_block2.f90 (+1-8)
  • (modified) offload/test/offloading/memory_manager.cpp (+1-3)
  • (modified) offload/test/offloading/ompx_bare.c (+1-6)
  • (modified) offload/test/offloading/ompx_bare_ballot_sync.c (+1-6)
  • (modified) offload/test/offloading/ompx_bare_shfl_down_sync.cpp (+1-6)
  • (modified) offload/test/offloading/ompx_coords.c (+1-6)
  • (modified) offload/test/offloading/ompx_saxpy_mixed.c (+1-6)
  • (modified) offload/test/offloading/parallel_offloading_map.cpp (+1-2)
  • (modified) offload/test/offloading/parallel_target_teams_reduction.cpp (+1-6)
  • (modified) offload/test/offloading/parallel_target_teams_reduction_max.cpp (+1-4)
  • (modified) offload/test/offloading/parallel_target_teams_reduction_min.cpp (+1-4)
  • (modified) offload/test/offloading/small_trip_count.c (+1-6)
  • (modified) offload/test/offloading/small_trip_count_thread_limit.cpp (+1-6)
  • (modified) offload/test/offloading/spmdization.c (+1-6)
  • (modified) offload/test/offloading/target_critical_region.cpp (+1-6)
  • (modified) offload/test/offloading/taskloop_offload_nowait.cpp (+1-2)
  • (modified) offload/test/offloading/thread_limit.c (+1-6)
  • (modified) offload/test/offloading/workshare_chunk.c (+1-6)
  • (modified) offload/test/ompt/target_memcpy.c (+1-6)
  • (modified) offload/test/ompt/target_memcpy_emi.c (+1-6)
  • (modified) offload/test/ompt/veccopy.c (+1-6)
  • (modified) offload/test/ompt/veccopy_data.c (+1-6)
  • (modified) offload/test/ompt/veccopy_disallow_both.c (+1-6)
  • (modified) offload/test/ompt/veccopy_emi.c (+1-6)
  • (modified) offload/test/ompt/veccopy_emi_map.c (+1-6)
  • (modified) offload/test/ompt/veccopy_map.c (+1-6)
diff --git a/offload/test/api/omp_dynamic_shared_memory.c b/offload/test/api/omp_dynamic_shared_memory.c
index 3fe75f24db3e6..76f625f07bfaf 100644
--- a/offload/test/api/omp_dynamic_shared_memory.c
+++ b/offload/test/api/omp_dynamic_shared_memory.c
@@ -6,12 +6,7 @@
 // RUN: env LIBOMPTARGET_SHARED_MEMORY_SIZE=256 \
 // RUN:   %libomptarget-run-generic | %fcheck-generic
 
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: s390x-ibm-linux-gnu
-// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
+// REQUIRES: gpu
 
 #include <omp.h>
 #include <stdio.h>
diff --git a/offload/test/jit/empty_kernel_lvl1.c b/offload/test/jit/empty_kernel_lvl1.c
index a0b8cd448837d..812d5c1f46314 100644
--- a/offload/test/jit/empty_kernel_lvl1.c
+++ b/offload/test/jit/empty_kernel_lvl1.c
@@ -28,11 +28,6 @@
 // RUN: %fcheck-plain-generic --input-file %t.pre.ll %S/empty_kernel.inc --check-prefixes=FIRST,SECOND
 // clang-format on
 
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-// UNSUPPORTED: s390x-ibm-linux-gnu
-// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
+// REQUIRES: gpu
 
 #include "empty_kernel.inc"
diff --git a/offload/test/jit/empty_kernel_lvl2.c b/offload/test/jit/empty_kernel_lvl2.c
index 81a04f55ce43d..90e4ce321fe8a 100644
--- a/offload/test/jit/empty_kernel_lvl2.c
+++ b/offload/test/jit/empty_kernel_lvl2.c
@@ -88,11 +88,6 @@
 // RUN: not %fcheck-plain-generic --input-file %t.pre.ll %S/empty_kernel.inc --check-prefixes=FIRST,SECOND
 // clang-format on
 
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-// UNSUPPORTED: s390x-ibm-linux-gnu
-// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
+// REQUIRES: gpu
 
 #include "empty_kernel.inc"
diff --git a/offload/test/jit/type_punning.c b/offload/test/jit/type_punning.c
index 10e3d2cef718b..574168b8a69cb 100644
--- a/offload/test/jit/type_punning.c
+++ b/offload/test/jit/type_punning.c
@@ -8,12 +8,7 @@
 //
 // clang-format on
 
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-// UNSUPPORTED: s390x-ibm-linux-gnu
-// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
+// REQUIRES: gpu
 
 // Ensure that there is only the kernel function left, not any outlined
 // parallel regions.
diff --git a/offload/test/libc/assert.c b/offload/test/libc/assert.c
index 803a8207e10a4..c2c5055c47051 100644
--- a/offload/test/libc/assert.c
+++ b/offload/test/libc/assert.c
@@ -5,12 +5,7 @@
 
 // NVPTX without LTO uses the implementation in OpenMP currently.
 // UNSUPPORTED: nvptx64-nvidia-cuda
-// UNSUPPORTED: powerpc64-ibm-linux-gnu
-// UNSUPPORTED: powerpc64-ibm-linux-gnu-LTO
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
+// REQUIRES: gpu
 
 #include <assert.h>
 
diff --git a/offload/test/lit.cfg b/offload/test/lit.cfg
index 6c590603079c4..ef9a7deb97d34 100644
--- a/offload/test/lit.cfg
+++ b/offload/test/lit.cfg
@@ -188,6 +188,24 @@ def add_libraries(source):
                    config.llvm_library_intdir + "/libomptarget.devicertl.a"
     return source + " " + config.llvm_library_intdir + "/libomptarget.devicertl.a"
 
+# Add platform targets
+host_targets = [
+    "aarch64-unknown-linux-gnu",
+    "aarch64-unknown-linux-gnu-LTO",
+    "x86_64-pc-linux-gnu",
+    "x86_64-pc-linux-gnu-LTO",
+    "s390x-ibm-linux-gnu",
+    "s390x-ibm-linux-gnu-LTO",
+]
+if config.libomptarget_current_target.startswith('nvptx'):
+    config.available_features.add('gpu')
+    config.available_features.add('nvidia-gpu')
+if config.libomptarget_current_target.startswith('amdgcn'):
+    config.available_features.add('gpu')
+    config.available_features.add('amdgpu')
+if config.libomptarget_current_target in host_targets:
+    config.available_features.add('host')
+
 # substitutions
 # - for targets that exist in the system create the actual command.
 # - for valid targets that do not exist in the system, return false, so that the
diff --git a/offload/test/mapping/auto_zero_copy.cpp b/offload/test/mapping/auto_zero_copy.cpp
index 46641200bb56e..69dabadd25322 100644
--- a/offload/test/mapping/auto_zero_copy.cpp
+++ b/offload/test/mapping/auto_zero_copy.cpp
@@ -7,15 +7,7 @@
 // RUN: env HSA_XNACK=0 LIBOMPTARGET_INFO=30 %libomptarget-run-generic 2>&1 \
 // RUN: | %fcheck-generic -check-prefix=INFO_COPY -check-prefix=CHECK
 
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: nvptx64-nvidia-cuda
-// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-// UNSUPPORTED: s390x-ibm-linux-gnu
-// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
-
+// REQUIRES: amdgpu
 // REQUIRES: unified_shared_memory
 
 // clang-format on
diff --git a/offload/test/mapping/auto_zero_copy_apu.cpp b/offload/test/mapping/auto_zero_copy_apu.cpp
index 48360e4fd7f7b..4a03fb2e7084e 100644
--- a/offload/test/mapping/auto_zero_copy_apu.cpp
+++ b/offload/test/mapping/auto_zero_copy_apu.cpp
@@ -7,13 +7,7 @@
 // RUN: env HSA_XNACK=0 LIBOMPTARGET_INFO=30 %libomptarget-run-generic 2>&1 \
 // RUN: | %fcheck-generic -check-prefix=INFO_COPY -check-prefix=CHECK
 
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: nvptx64-nvidia-cuda
-// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-
+// REQUIRES: amdgpu
 // REQUIRES: apu
 
 // clang-format on
diff --git a/offload/test/mapping/auto_zero_copy_globals.cpp b/offload/test/mapping/auto_zero_copy_globals.cpp
index 55dfb2807ebc7..556f0142695fd 100644
--- a/offload/test/mapping/auto_zero_copy_globals.cpp
+++ b/offload/test/mapping/auto_zero_copy_globals.cpp
@@ -3,15 +3,7 @@
 // RUN: env OMPX_APU_MAPS=1 HSA_XNACK=1 LIBOMPTARGET_INFO=60 %libomptarget-run-generic 2>&1 \
 // RUN: | %fcheck-generic -check-prefix=CHECK
 
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: nvptx64-nvidia-cuda
-// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-// UNSUPPORTED: s390x-ibm-linux-gnu
-// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
-
+// REQUIRES: amdgpu
 // REQUIRES: unified_shared_memory
 
 // clang-format on
diff --git a/offload/test/mapping/prelock.cpp b/offload/test/mapping/prelock.cpp
index d019108dcad62..bc881ef827498 100644
--- a/offload/test/mapping/prelock.cpp
+++ b/offload/test/mapping/prelock.cpp
@@ -1,12 +1,9 @@
 // RUN: %libomptarget-compilexx-generic
 // RUN: %libomptarget-run-generic %fcheck-generic
 
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
+// REQURIES: gpu
 // UNSUPPORTED: nvptx64-nvidia-cuda
 // UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 // UNSUPPORTED: amdgcn-amd-amdhsa
 
 #include <cstdio>
diff --git a/offload/test/offloading/barrier_fence.c b/offload/test/offloading/barrier_fence.c
index b9a8ca27965a0..73d259d4f71b6 100644
--- a/offload/test/offloading/barrier_fence.c
+++ b/offload/test/offloading/barrier_fence.c
@@ -3,12 +3,7 @@
 // RUN: %libomptarget-compileopt-generic -fopenmp-offload-mandatory -O3
 // RUN: %libomptarget-run-generic
 
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-// UNSUPPORTED: s390x-ibm-linux-gnu
-// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
+// REQUIRES: gpu
 
 #include <omp.h>
 #include <stdio.h>
diff --git a/offload/test/offloading/bug49334.cpp b/offload/test/offloading/bug49334.cpp
index 1f19dab378810..eaf7b85049bff 100644
--- a/offload/test/offloading/bug49334.cpp
+++ b/offload/test/offloading/bug49334.cpp
@@ -5,12 +5,7 @@
 // RUN: %libomptarget-compileoptxx-generic -O3 -ffast-math && \
 // RUN: %libomptarget-run-generic
 
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: s390x-ibm-linux-gnu
-// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
+// REQUIRES: gpu
 // UNSUPPORTED: amdgcn-amd-amdhsa
 // UNSUPPORTED: nvptx64-nvidia-cuda
 // UNSUPPORTED: nvptx64-nvidia-cuda-LTO
diff --git a/offload/test/offloading/default_thread_limit.c b/offload/test/offloading/default_thread_limit.c
index d9be843dfbda4..6e415a5cc11c2 100644
--- a/offload/test/offloading/default_thread_limit.c
+++ b/offload/test/offloading/default_thread_limit.c
@@ -5,12 +5,7 @@
 
 // UNSUPPORTED: nvptx64-nvidia-cuda
 // UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-// UNSUPPORTED: aarch64-unknown-linux-gnu
-// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-// UNSUPPORTED: x86_64-pc-linux-gnu
-// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
-// UNSUPPORTED: s390x-ibm-linux-gnu
-// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
+// REQUIRES: gpu
 
 __attribute__((optnone)) int optnone() { return 1; }
 
diff --git a/offload/test/offloading/dynamic_module.c b/offload/test/offloading/dynamic_module.c
index 9dcf3a1ae649a..00ae8100db7e4 100644
--- a/offload/test/offloading/dynamic_module.c
+++ b/offload/test/offloading/dynamic_module.c
@@ -3,7 +3,7 @@
 // RUN: %libomptarget-compileopt-generic -DSHARED -fPIC -shared -o %t.so && \
 // RUN: %libomptarget-compileopt-generic %t.so && %libomptarget-run-generic 2>&1 | %fcheck-generic
 //
-// UNSUPPORTED: x86_64-pc-linux-gnu
+// REQUIRES: gpu
 
 #ifdef SHARED
 void foo() {}
diff --git a/offload/test/offloading/fortran/basic-target-parallel-do.f90 b/offload/test/offloading/fortran/basic-target-parallel-do.f90
index 0027f15bdb423..21f33dab65fb0 100644
--- a/offload/test/offloading/fortran/basic-target-parallel-do.f90
+++ b/offload/test/offloading/fortran/basic-target-parallel-do.f90
@@ -1,10 +1,7 @@
 ! Basic offloading test with a target region
 ! REQUIRES: flang
+! REQUIRES: gpu
 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-generic
 ! RUN: env LIBOMPTARGET_INFO=16 %libomptarget-run-generic 2>&1 | %fcheck-generic
diff --git a/offload/test/offloading/fortran/basic-target-parallel-region.f90 b/offload/test/offloading/fortran/basic-target-parallel-region.f90
index 54341f7c40ff3..b65fa99617302 100644
--- a/offload/test/offloading/fortran/basic-target-parallel-region.f90
+++ b/offload/test/offloading/fortran/basic-target-parallel-region.f90
@@ -1,10 +1,7 @@
 ! Basic offloading test with a target region
 ! REQUIRES: flang
+! REQUIRES: gpu
 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 program main
diff --git a/offload/test/offloading/fortran/basic-target-region-1D-array-section.f90 b/offload/test/offloading/fortran/basic-target-region-1D-array-section.f90
index e0b0f2ea734e9..712bcacf671cb 100644
--- a/offload/test/offloading/fortran/basic-target-region-1D-array-section.f90
+++ b/offload/test/offloading/fortran/basic-target-region-1D-array-section.f90
@@ -1,11 +1,8 @@
 ! Basic offloading test of arrays with provided lower
 ! and upper bounds as specified by OpenMP's sectioning
 ! REQUIRES: flang
+! REQUIRES: gpu
 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 program main
diff --git a/offload/test/offloading/fortran/basic-target-region-3D-array-section.f90 b/offload/test/offloading/fortran/basic-target-region-3D-array-section.f90
index 1b3f86c0dbfaa..a6928b61a0439 100644
--- a/offload/test/offloading/fortran/basic-target-region-3D-array-section.f90
+++ b/offload/test/offloading/fortran/basic-target-region-3D-array-section.f90
@@ -1,11 +1,8 @@
 ! Basic offloading test of a regular array explicitly
 ! passed within a target region
 ! REQUIRES: flang
+! REQUIRES: gpu
 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 program main
diff --git a/offload/test/offloading/fortran/basic-target-region-3D-array.f90 b/offload/test/offloading/fortran/basic-target-region-3D-array.f90
index ea3048185d52b..d575810713895 100644
--- a/offload/test/offloading/fortran/basic-target-region-3D-array.f90
+++ b/offload/test/offloading/fortran/basic-target-region-3D-array.f90
@@ -1,11 +1,8 @@
 ! Basic offloading test of a regular array explicitly
 ! passed within a target region
 ! REQUIRES: flang
+! REQUIRES: gpu
 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 program main
diff --git a/offload/test/offloading/fortran/basic_target_region.f90 b/offload/test/offloading/fortran/basic_target_region.f90
index d856d42bb8cd6..be59dd4596532 100644
--- a/offload/test/offloading/fortran/basic_target_region.f90
+++ b/offload/test/offloading/fortran/basic_target_region.f90
@@ -1,10 +1,7 @@
 ! Basic offloading test with a target region
 ! REQUIRES: flang
+! REQUIRES: gpu
 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 program main
diff --git a/offload/test/offloading/fortran/constant-arr-index.f90 b/offload/test/offloading/fortran/constant-arr-index.f90
index 669630555c31e..5e4846eda74d2 100644
--- a/offload/test/offloading/fortran/constant-arr-index.f90
+++ b/offload/test/offloading/fortran/constant-arr-index.f90
@@ -3,11 +3,8 @@
 ! correctly works (regression test for prior
 ! bug).
 ! REQUIRES: flang
+! REQUIRES: gpu
 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 program main
diff --git a/offload/test/offloading/fortran/declare-target-vars-in-target-region.f90 b/offload/test/offloading/fortran/declare-target-vars-in-target-region.f90
index f524deac3bcce..76c431829f7fe 100644
--- a/offload/test/offloading/fortran/declare-target-vars-in-target-region.f90
+++ b/offload/test/offloading/fortran/declare-target-vars-in-target-region.f90
@@ -2,11 +2,8 @@
 ! Fortran array writing some values to it and checking the host
 ! correctly receives the updates made on the device.
 ! REQUIRES: flang
+! REQUIRES: gpu
 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 module test_0
diff --git a/offload/test/offloading/fortran/double-target-call-with-declare-target.f90 b/offload/test/offloading/fortran/double-target-call-with-declare-target.f90
index 38cb055bfa2da..237eabc29c2dd 100644
--- a/offload/test/offloading/fortran/double-target-call-with-declare-target.f90
+++ b/offload/test/offloading/fortran/double-target-call-with-declare-target.f90
@@ -3,12 +3,9 @@
 ! it before checking the host correctly receives the
 ! correct updates made on the device.
 ! REQUIRES: flang
+! REQUIRES: gpu
 ! UNSUPPORTED: nvptx64-nvidia-cuda
 ! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 module test_0
diff --git a/offload/test/offloading/fortran/target-map-allocatable-array-section-1d-bounds.f90 b/offload/test/offloading/fortran/target-map-allocatable-array-section-1d-bounds.f90
index 99dbe99d40497..c52d8bc3cc5d8 100644
--- a/offload/test/offloading/fortran/target-map-allocatable-array-section-1d-bounds.f90
+++ b/offload/test/offloading/fortran/target-map-allocatable-array-section-1d-bounds.f90
@@ -1,13 +1,8 @@
 ! Offloading test checking interaction of a
 ! two 1-D allocatable arrays with a target region
 ! while providing the map upper and lower bounds
-! REQUIRES: flang, amdgcn-amd-amdhsa
-! UNSUPPORTED: nvptx64-nvidia-cuda
-! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
+! REQUIRES: flang
+! REQUIRES: amdgcn-amd-amdhsa
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 program main
diff --git a/offload/test/offloading/fortran/target-map-allocatable-array-section-3d-bounds.f90 b/offload/test/offloading/fortran/target-map-allocatable-array-section-3d-bounds.f90
index 0786e0fd744e7..0ed15f66543de 100644
--- a/offload/test/offloading/fortran/target-map-allocatable-array-section-3d-bounds.f90
+++ b/offload/test/offloading/fortran/target-map-allocatable-array-section-3d-bounds.f90
@@ -1,13 +1,8 @@
 ! Offloading test checking interaction of allocatables
 ! with multi-dimensional bounds (3-D in this case) and
 ! a target region
-! REQUIRES: flang, amdgcn-amd-amdhsa
-! UNSUPPORTED: nvptx64-nvidia-cuda
-! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
+! REQUIRES: flang
+! REQUIRES: amdgcn-amd-amdhsa
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 program main
diff --git a/offload/test/offloading/fortran/target-map-allocatable-map-scopes.f90 b/offload/test/offloading/fortran/target-map-allocatable-map-scopes.f90
index 506976b339dfc..93ff8159bef87 100644
--- a/offload/test/offloading/fortran/target-map-allocatable-map-scopes.f90
+++ b/offload/test/offloading/fortran/target-map-allocatable-map-scopes.f90
@@ -1,12 +1,6 @@
 ! Offloading test checking interaction of allocatables
 ! with target in different scopes
 ! REQUIRES: flang, amdgcn-amd-amdhsa
-! UNSUPPORTED: nvptx64-nvidia-cuda
-! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 module test
diff --git a/offload/test/offloading/fortran/target-map-derived-type-full-1.f90 b/offload/test/offloading/fortran/target-map-derived-type-full-1.f90
index f4e11f8b9e326..e81d603a6b4f5 100644
--- a/offload/test/offloading/fortran/target-map-derived-type-full-1.f90
+++ b/offload/test/offloading/fortran/target-map-derived-type-full-1.f90
@@ -3,12 +3,6 @@
 ! to target and assinging one derived type
 ! to another
 ! REQUIRES: flang, amdgcn-amd-amdhsa
-! UNSUPPORTED: nvptx64-nvidia-cuda
-! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
-! UNSUPPORTED: aarch64-unknown-linux-gnu
-! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
-! UNSUPPORTED: x86_64-pc-linux-gnu
-! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
 
 ! RUN: %libomptarget-compile-fortran-run-and-check-generic
 program main
diff --git a/offload/test/offloading/fortran/target-map-derived-type-full-2.f90 b/offload/test/offloading/fortran/target-map-derived-type-full-2.f90
index f97880a2023d4..520d94e83a308 100644
--- a/offload/test/offloading/fortran/target-map-derived-type-full-2.f90
+++ b/offload/tes...
[truncated]

Copy link
Contributor

@agozillon agozillon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I think the overall simplification is nice (at least from the perspective of someone writing these on a fairly regular basis at least), but please do wait on one of the more experienced reviewers to approve before landing! They'll likely know the broader impact of simplifying the architecture listing, if there is any :-)

@@ -1,12 +1,9 @@
// RUN: %libomptarget-compilexx-generic
// RUN: %libomptarget-run-generic %fcheck-generic

// UNSUPPORTED: aarch64-unknown-linux-gnu
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
// REQURIES: gpu
// UNSUPPORTED: nvptx64-nvidia-cuda
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also use nvidia-gpu here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I that should work. I kept those long names because I wasn't sure which targets this test was meant to run on (seeing that host, nvptx64-nvidia-cuda, nvptx64-nvidia-cuda-LTO, and amdgcn-amd-amdhsa). I figured it was best to err on the side of caution.

Make naming scheme consistent
Comment on lines 5 to 6
// UNSUPPORTED: nvidiagpu
// UNSUPPORTED: amdgcn-amd-amdhsa
Copy link
Contributor

@jhuber6 jhuber6 Jun 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird that we're doing nvidia-gpu instead of nvptx64-nvidia-cuda or just nvptx when there's amdgcn right below it. I don't think there's a particular need to distinguish between the NVPTX triple and the NVPTX triple on a GPU.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just not sure where this test is supposed to be run. The test is unsupported on host targets, amdgcn-amd-amdhsa, and NVIDIA targets. Ideally we would only include the platform its meant to run on, but I'm not sure what platform that is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug49334.cpp is another test case where I did this. I wasn't sure which targets the test was meant to support, so I just kept in a lot of the unsupported directives.

Upstream main:

// UNSUPPORTED: x86_64-pc-linux-gnu
// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
// UNSUPPORTED: aarch64-unknown-linux-gnu
// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
// UNSUPPORTED: s390x-ibm-linux-gnu
// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
// UNSUPPORTED: amdgcn-amd-amdhsa
// UNSUPPORTED: nvptx64-nvidia-cuda
// UNSUPPORTED: nvptx64-nvidia-cuda-LTO

My PR:

// REQUIRES: gpu
// UNSUPPORTED: amdgcn-amd-amdhsa
// UNSUPPORTED: nvptx64-nvidia-cuda
// UNSUPPORTED: nvptx64-nvidia-cuda-LTO

Are these tests meant to be disabled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, that list pretty much means "no one". I would just keep nvptx64-nvidia-cuda but drop the -LTO bit since it's irrelevant AFAIK. (I think there's a single test case where it matters but that's just because I don't have compiler-rt yet)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the test where that matters is assert.c:

// NVPTX without LTO uses the implementation in OpenMP currently.
// UNSUPPORTED: nvptx64-nvidia-cuda
// REQUIRES: gpu

If the test isn't meant to run anywhere yet, I think // UNSUPPORTED: host, gpu might be more explicit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah I wanted to get rid of that as well and just make it use the libc one, but for now it's probably fin. Can probably just have REQUIRES: lto or something.

@EthanLuisMcDonough EthanLuisMcDonough merged commit 8823448 into llvm:main Jun 29, 2024
5 checks passed
lravenclaw pushed a commit to lravenclaw/llvm-project that referenced this pull request Jul 3, 2024
Many tests in the `offload` project have requirements defined by which
targets are not supported rather than which platforms are supported.
This patch aims to streamline the requirement definitions by adding four
new feature tags: `host`, `gpu`, `amdgpu`, and `nvidiagpu`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants