[gcc r16-6770] libgomp: Add a few more OpenMP/USM test cases
Thomas Schwinge
tschwinge@gcc.gnu.org
Wed Jan 14 15:01:21 GMT 2026
https://gcc.gnu.org/g:3dc9eedd95ad88129e55bf2218b7f60f4f95b2c2
commit r16-6770-g3dc9eedd95ad88129e55bf2218b7f60f4f95b2c2
Author: Thomas Schwinge <tschwinge@baylibre.com>
Date: Fri May 9 15:09:51 2025 +0200
libgomp: Add a few more OpenMP/USM test cases
... 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.
Diff:
---
libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-2-usm.c | 6 ++++++
libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-3-usm.c | 6 ++++++
libgomp/testsuite/libgomp.c-c++-common/struct-elem-5-usm.c | 6 ++++++
libgomp/testsuite/libgomp.c-c++-common/target-present-1-usm.c | 6 ++++++
libgomp/testsuite/libgomp.c-c++-common/target-present-2-usm.c | 6 ++++++
libgomp/testsuite/libgomp.c-c++-common/target-present-3-usm.c | 6 ++++++
libgomp/testsuite/libgomp.fortran/map-subarray-5-usm.f90 | 8 ++++++++
libgomp/testsuite/libgomp.fortran/map-subarray-6-usm.f90 | 8 ++++++++
libgomp/testsuite/libgomp.fortran/map-subarray-7-usm.f90 | 6 ++++++
libgomp/testsuite/libgomp.fortran/target-allocatable-1-1-usm.f90 | 7 +++++++
libgomp/testsuite/libgomp.fortran/target-allocatable-1-1.f90 | 4 ++++
libgomp/testsuite/libgomp.fortran/target-allocatable-1-2-usm.f90 | 7 +++++++
libgomp/testsuite/libgomp.fortran/target-allocatable-1-2.f90 | 4 ++++
libgomp/testsuite/libgomp.fortran/target-enter-data-2-usm.F90 | 7 +++++++
libgomp/testsuite/libgomp.fortran/target-present-1-usm.f90 | 7 +++++++
libgomp/testsuite/libgomp.fortran/target-present-1.f90 | 6 ++++++
libgomp/testsuite/libgomp.fortran/target-present-2-usm.f90 | 7 +++++++
libgomp/testsuite/libgomp.fortran/target-present-2.f90 | 6 ++++++
libgomp/testsuite/libgomp.fortran/target-present-3-usm.f90 | 7 +++++++
libgomp/testsuite/libgomp.fortran/target-present-3.f90 | 6 ++++++
20 files changed, 126 insertions(+)
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
index 000000000000..751ab1b5b3d0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-2-usm.c
@@ -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
index 000000000000..4f8955f74e3a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/map-arrayofstruct-3-usm.c
@@ -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
index 000000000000..4a07f4bf62d3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/struct-elem-5-usm.c
@@ -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
index 000000000000..a8b0840da6ec
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/target-present-1-usm.c
@@ -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
index 000000000000..f3b0eb27627c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/target-present-2-usm.c
@@ -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
index 000000000000..d270c98d4481
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/target-present-3-usm.c
@@ -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
index 000000000000..7ece1f189564
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/map-subarray-5-usm.f90
@@ -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
index 000000000000..f2c93fea2835
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/map-subarray-6-usm.f90
@@ -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
index 000000000000..c1310a8a3c4c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/map-subarray-7-usm.f90
@@ -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
index 000000000000..c31d39a0c497
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/target-allocatable-1-1-usm.f90
@@ -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"
diff --git a/libgomp/testsuite/libgomp.fortran/target-allocatable-1-1.f90 b/libgomp/testsuite/libgomp.fortran/target-allocatable-1-1.f90
index 429a855a20b2..dc2ce645e23b 100644
--- a/libgomp/testsuite/libgomp.fortran/target-allocatable-1-1.f90
+++ b/libgomp/testsuite/libgomp.fortran/target-allocatable-1-1.f90
@@ -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
index 000000000000..26fc7554be38
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/target-allocatable-1-2-usm.f90
@@ -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"
diff --git a/libgomp/testsuite/libgomp.fortran/target-allocatable-1-2.f90 b/libgomp/testsuite/libgomp.fortran/target-allocatable-1-2.f90
index 5301c8eeffbd..c5010a15ecf4 100644
--- a/libgomp/testsuite/libgomp.fortran/target-allocatable-1-2.f90
+++ b/libgomp/testsuite/libgomp.fortran/target-allocatable-1-2.f90
@@ -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
index 000000000000..4afad55c71d0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/target-enter-data-2-usm.F90
@@ -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
index 000000000000..e326ebc38b22
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/target-present-1-usm.f90
@@ -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'.
diff --git a/libgomp/testsuite/libgomp.fortran/target-present-1.f90 b/libgomp/testsuite/libgomp.fortran/target-present-1.f90
index fc13609d5283..f1950692758a 100644
--- a/libgomp/testsuite/libgomp.fortran/target-present-1.f90
+++ b/libgomp/testsuite/libgomp.fortran/target-present-1.f90
@@ -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
index 000000000000..86236d3e8d62
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/target-present-2-usm.f90
@@ -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'.
diff --git a/libgomp/testsuite/libgomp.fortran/target-present-2.f90 b/libgomp/testsuite/libgomp.fortran/target-present-2.f90
index 524d01d94656..dbb120e9d779 100644
--- a/libgomp/testsuite/libgomp.fortran/target-present-2.f90
+++ b/libgomp/testsuite/libgomp.fortran/target-present-2.f90
@@ -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
index 000000000000..55ebb802099a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.fortran/target-present-3-usm.f90
@@ -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'.
diff --git a/libgomp/testsuite/libgomp.fortran/target-present-3.f90 b/libgomp/testsuite/libgomp.fortran/target-present-3.f90
index dd4af4c16511..3b8163961cee 100644
--- a/libgomp/testsuite/libgomp.fortran/target-present-3.f90
+++ b/libgomp/testsuite/libgomp.fortran/target-present-3.f90
@@ -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
More information about the Gcc-cvs
mailing list