]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp: Add a few more OpenMP/USM test cases
authorThomas Schwinge <tschwinge@baylibre.com>
Fri, 9 May 2025 13:09:51 +0000 (15:09 +0200)
committerThomas Schwinge <tschwinge@baylibre.com>
Wed, 14 Jan 2026 15:00:56 +0000 (16:00 +0100)
... where there are clear differences in behavior for OpenMP/USM run-time
configurations.

We shall further clarify all the intended semantics, once the implementation
begins to differentiate OpenMP 'requires unified_shared_memory' vs.
'requires self_maps'.

libgomp/
* testsuite/libgomp.c-c++-common/map-arrayofstruct-2-usm.c: New.
* testsuite/libgomp.c-c++-common/map-arrayofstruct-3-usm.c:
Likewise.
* testsuite/libgomp.c-c++-common/struct-elem-5-usm.c: Likewise.
* testsuite/libgomp.c-c++-common/target-present-1-usm.c: Likewise.
* testsuite/libgomp.c-c++-common/target-present-2-usm.c: Likewise.
* testsuite/libgomp.c-c++-common/target-present-3-usm.c: Likewise.
* testsuite/libgomp.fortran/map-subarray-5-usm.f90: Likewise.
* testsuite/libgomp.fortran/map-subarray-6-usm.f90: Likewise.
* testsuite/libgomp.fortran/map-subarray-7-usm.f90: Likewise.
* testsuite/libgomp.fortran/target-allocatable-1-1-usm.f90:
Likewise.
* testsuite/libgomp.fortran/target-allocatable-1-2-usm.f90:
Likewise.
* testsuite/libgomp.fortran/target-enter-data-2-usm.F90: Likewise.
* testsuite/libgomp.fortran/target-present-1-usm.f90: Likewise.
* testsuite/libgomp.fortran/target-present-2-usm.f90: Likewise.
* testsuite/libgomp.fortran/target-present-3-usm.f90: Likewise.
* testsuite/libgomp.fortran/target-allocatable-1-1.f90: Adjust.
* testsuite/libgomp.fortran/target-allocatable-1-2.f90: Likewise.
* testsuite/libgomp.fortran/target-present-1.f90: Likewise.
* testsuite/libgomp.fortran/target-present-2.f90: Likewise.
* testsuite/libgomp.fortran/target-present-3.f90: Likewise.

20 files changed:
libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-2-usm.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-3-usm.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/struct-elem-5-usm.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/target-present-1-usm.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/target-present-2-usm.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c-c++-common/target-present-3-usm.c [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/map-subarray-5-usm.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/map-subarray-6-usm.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/map-subarray-7-usm.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-allocatable-1-1-usm.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-allocatable-1-1.f90
libgomp/testsuite/libgomp.fortran/target-allocatable-1-2-usm.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-allocatable-1-2.f90
libgomp/testsuite/libgomp.fortran/target-enter-data-2-usm.F90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-present-1-usm.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-present-1.f90
libgomp/testsuite/libgomp.fortran/target-present-2-usm.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-present-2.f90
libgomp/testsuite/libgomp.fortran/target-present-3-usm.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-present-3.f90

diff --git a/libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-2-usm.c b/libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-2-usm.c
new file mode 100644 (file)
index 0000000..751ab1b
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+
+#include "map-arrayofstruct-2.c"
+
+/* No 'dg-shouldfail'.  */
diff --git a/libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-3-usm.c b/libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-3-usm.c
new file mode 100644 (file)
index 0000000..4f8955f
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+
+#include "map-arrayofstruct-3.c"
+
+/* No 'dg-shouldfail'.  */
diff --git a/libgomp/testsuite/libgomp.c-c++-common/struct-elem-5-usm.c b/libgomp/testsuite/libgomp.c-c++-common/struct-elem-5-usm.c
new file mode 100644 (file)
index 0000000..4a07f4b
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+
+#include "struct-elem-5.c"
+
+/* No 'dg-shouldfail'.  */
diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-present-1-usm.c b/libgomp/testsuite/libgomp.c-c++-common/target-present-1-usm.c
new file mode 100644 (file)
index 0000000..a8b0840
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+
+#include "target-present-1.c"
+
+/* No 'dg-shouldfail'.  */
diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-present-2-usm.c b/libgomp/testsuite/libgomp.c-c++-common/target-present-2-usm.c
new file mode 100644 (file)
index 0000000..f3b0eb2
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+
+#include "target-present-2.c"
+
+/* No 'dg-shouldfail'.  */
diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-present-3-usm.c b/libgomp/testsuite/libgomp.c-c++-common/target-present-3-usm.c
new file mode 100644 (file)
index 0000000..d270c98
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+
+#include "target-present-3.c"
+
+/* No 'dg-shouldfail'.  */
diff --git a/libgomp/testsuite/libgomp.fortran/map-subarray-5-usm.f90 b/libgomp/testsuite/libgomp.fortran/map-subarray-5-usm.f90
new file mode 100644 (file)
index 0000000..7ece1f1
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do run }
+
+! { dg-require-effective-target omp_usm }
+!$omp requires unified_shared_memory self_maps
+
+include 'map-subarray-5.f90'
+
+! No 'dg-shouldfail'.
diff --git a/libgomp/testsuite/libgomp.fortran/map-subarray-6-usm.f90 b/libgomp/testsuite/libgomp.fortran/map-subarray-6-usm.f90
new file mode 100644 (file)
index 0000000..f2c93fe
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do run }
+
+! { dg-require-effective-target omp_usm }
+!$omp requires unified_shared_memory self_maps
+
+include 'map-subarray-6.f90'
+
+! No 'dg-shouldfail'.
diff --git a/libgomp/testsuite/libgomp.fortran/map-subarray-7-usm.f90 b/libgomp/testsuite/libgomp.fortran/map-subarray-7-usm.f90
new file mode 100644 (file)
index 0000000..c1310a8
--- /dev/null
@@ -0,0 +1,6 @@
+! { dg-require-effective-target omp_usm }
+!$omp requires unified_shared_memory self_maps
+
+include 'map-subarray-7.f90'
+
+! No 'dg-shouldfail'.
diff --git a/libgomp/testsuite/libgomp.fortran/target-allocatable-1-1-usm.f90 b/libgomp/testsuite/libgomp.fortran/target-allocatable-1-1-usm.f90
new file mode 100644 (file)
index 0000000..c31d39a
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do run }
+! { dg-additional-options "-cpp" }
+! { dg-require-effective-target omp_usm }
+! { dg-additional-options "-DOMP_USM" }
+! { dg-additional-options "-DMEM_SHARED" }
+
+#include "target-allocatable-1-1.f90"
index 429a855a20b215433d1f56d1ce23ec9dc4ff6f3b..dc2ce645e23b7fc76727ec8770f60b7f46b2b127 100644 (file)
@@ -8,6 +8,10 @@
 
 program main
   implicit none
+#ifdef OMP_USM
+  !$omp requires unified_shared_memory self_maps
+#endif
+
   integer, allocatable :: a, b, c, d, e
 
   allocate (a)
diff --git a/libgomp/testsuite/libgomp.fortran/target-allocatable-1-2-usm.f90 b/libgomp/testsuite/libgomp.fortran/target-allocatable-1-2-usm.f90
new file mode 100644 (file)
index 0000000..26fc755
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do run }
+! { dg-additional-options "-cpp" }
+! { dg-require-effective-target omp_usm }
+! { dg-additional-options "-DOMP_USM" }
+! { dg-additional-options "-DMEM_SHARED" }
+
+#include "target-allocatable-1-2.f90"
index 5301c8eeffbd912ced4af9d9651cdd7249421616..c5010a15ecf42679d35fb1b90edb6b59bf0d35a2 100644 (file)
@@ -8,6 +8,10 @@
 ! { dg-additional-options "-DMEM_SHARED" { target offload_device_shared_as } }
 
 module m
+#ifdef OMP_USM
+  !$omp requires unified_shared_memory self_maps
+#endif
+
 contains
   subroutine r (a, b, c, d, e)
     implicit none
diff --git a/libgomp/testsuite/libgomp.fortran/target-enter-data-2-usm.F90 b/libgomp/testsuite/libgomp.fortran/target-enter-data-2-usm.F90
new file mode 100644 (file)
index 0000000..4afad55
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-additional-options "-DMEM_SHARED" }
+! { dg-do run }
+
+! { dg-require-effective-target omp_usm }
+!$omp requires unified_shared_memory self_maps
+
+#include "target-enter-data-2.F90"
diff --git a/libgomp/testsuite/libgomp.fortran/target-present-1-usm.f90 b/libgomp/testsuite/libgomp.fortran/target-present-1-usm.f90
new file mode 100644 (file)
index 0000000..e326ebc
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-additional-options -cpp }
+! { dg-require-effective-target omp_usm }
+! { dg-additional-options -DOMP_USM }
+
+#include "target-present-1.f90"
+
+! No 'dg-shouldfail'.
index fc13609d52835efffcd49605875ee4e92d8b3a0a..f1950692758a7d27f9a6b402649a43bc30f59d96 100644 (file)
@@ -1,5 +1,11 @@
+! { dg-additional-options -cpp }
+
 program main
   implicit none
+#ifdef OMP_USM
+  !$omp requires unified_shared_memory self_maps
+#endif
+
   integer, parameter :: N = 100
   integer :: a(N), b(N), c(N), i
 
diff --git a/libgomp/testsuite/libgomp.fortran/target-present-2-usm.f90 b/libgomp/testsuite/libgomp.fortran/target-present-2-usm.f90
new file mode 100644 (file)
index 0000000..86236d3
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-additional-options -cpp }
+! { dg-require-effective-target omp_usm }
+! { dg-additional-options -DOMP_USM }
+
+#include "target-present-2.f90"
+
+! No 'dg-shouldfail'.
index 524d01d94656219a36f5cc310a16f818d2cfe6f6..dbb120e9d779d5bdc7fead08ef53fbbff033dc06 100644 (file)
@@ -1,5 +1,11 @@
+! { dg-additional-options -cpp }
+
 program main
   implicit none
+#ifdef OMP_USM
+  !$omp requires unified_shared_memory self_maps
+#endif
+
   integer, parameter :: N = 100
   integer :: a(N), b(N), c(N), i
 
diff --git a/libgomp/testsuite/libgomp.fortran/target-present-3-usm.f90 b/libgomp/testsuite/libgomp.fortran/target-present-3-usm.f90
new file mode 100644 (file)
index 0000000..55ebb80
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-additional-options -cpp }
+! { dg-require-effective-target omp_usm }
+! { dg-additional-options -DOMP_USM }
+
+#include "target-present-3.f90"
+
+! No 'dg-shouldfail'.
index dd4af4c16511ae16aa2eeddaf29b39f74ee914c2..3b8163961ceeb59a944d62be0016d91185aa64dc 100644 (file)
@@ -1,5 +1,11 @@
+! { dg-additional-options -cpp }
+
 program main
   implicit none
+#ifdef OMP_USM
+  !$omp requires unified_shared_memory self_maps
+#endif
+
   integer, parameter :: N = 100
   integer :: a(N), b(N), c(N), i