aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@baylibre.com>2025-05-30 11:37:46 +0200
committerThomas Schwinge <tschwinge@baylibre.com>2025-05-30 14:58:56 +0200
commit94334a764b073fe5011db1a53bc5693b30b57fae (patch)
treed6fc3d127fec885eed04ff67d3fd6b5321ebc9f2
parent9aa037ff9910605a1b8718b70f7c5fad0e2106d8 (diff)
downloadgcc-94334a764b073fe5011db1a53bc5693b30b57fae.zip
gcc-94334a764b073fe5011db1a53bc5693b30b57fae.tar.gz
gcc-94334a764b073fe5011db1a53bc5693b30b57fae.tar.bz2
libgomp: Add testcases for concurrent access to standard C++ containers on offload targets, a number of USM variants
libgomp/ * testsuite/libgomp.c++/target-std__array-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__array-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__bitset-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__deque-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__deque-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__forward_list-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__list-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__list-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__map-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__map-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__multimap-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__multiset-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__set-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__set-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__span-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__span-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__valarray-concurrent.C: Adjust. * testsuite/libgomp.c++/target-std__vector-concurrent-usm.C: New. * testsuite/libgomp.c++/target-std__vector-concurrent.C: Adjust. (cherry picked from commit 83ca283853f195a08d2f758580a369bc6a076122)
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__array-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C2
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C2
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__deque-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C2
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C2
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__list-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C2
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__map-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C4
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C4
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C2
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__set-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C2
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__span-concurrent-usm.C7
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C4
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C2
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__vector-concurrent-usm.C5
-rw-r--r--libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C2
24 files changed, 92 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c++/target-std__array-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__array-concurrent-usm.C
new file mode 100644
index 0000000..9923783
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__array-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__array-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C
index e97bfe6..c42105a 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C
@@ -33,7 +33,9 @@ int main (void)
srand (time (NULL));
init (data);
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[:N]) map (alloc: arr)
+#endif
{
#pragma omp target
{
diff --git a/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C
new file mode 100644
index 0000000..9023ef8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__bitset-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C
index aa27662..4fcce93 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C
@@ -40,7 +40,9 @@ int main (void)
srand (time (NULL));
init (data);
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[:N]) map (alloc: _set)
+#endif
{
#pragma omp target
{
diff --git a/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent-usm.C
new file mode 100644
index 0000000..863a1de
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__deque-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C
index 5f08bfb..9c2d6fa 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C
@@ -38,7 +38,9 @@ int main (void)
std::deque<int> _deque;
#endif
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[:N]) map (alloc: _deque)
+#endif
{
#ifndef MEM_SHARED
#pragma omp target
diff --git a/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C
new file mode 100644
index 0000000..60d5cee
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__forward_list-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C
index f8ab53e..6b0ee65 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C
@@ -43,7 +43,9 @@ int main (void)
std::forward_list<int> list;
#endif
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[:N]) map (alloc: list)
+#endif
{
#ifndef MEM_SHARED
#pragma omp target
diff --git a/libgomp/testsuite/libgomp.c++/target-std__list-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__list-concurrent-usm.C
new file mode 100644
index 0000000..5057bf9
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__list-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__list-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C
index ce3b426..1f44a17 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C
@@ -43,7 +43,9 @@ int main (void)
std::list<int> _list;
#endif
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[:N]) map (alloc: _list)
+#endif
{
#ifndef MEM_SHARED
#pragma omp target
diff --git a/libgomp/testsuite/libgomp.c++/target-std__map-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__map-concurrent-usm.C
new file mode 100644
index 0000000..fe37426
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__map-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__map-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C
index 254c490..36556ef 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C
@@ -38,7 +38,9 @@ int main (void)
init (keys, true);
init (data, false);
+#ifndef MEM_SHARED
#pragma omp target enter data map (to: keys[:N], data[:N]) map (alloc: _map)
+#endif
#pragma omp target
{
@@ -59,7 +61,9 @@ int main (void)
_map.~map ();
#endif
+#ifndef MEM_SHARED
#pragma omp target exit data map (release: _map)
+#endif
bool ok = validate (sum, keys, data);
return ok ? 0 : 1;
diff --git a/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C
new file mode 100644
index 0000000..79f9245
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__multimap-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C
index 65e6732..6a4a4e8 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C
@@ -32,7 +32,9 @@ int main (void)
init (keys, KEY_MAX);
init (data, RAND_MAX);
+#ifndef MEM_SHARED
#pragma omp target enter data map (to: keys[:N], data[:N]) map (alloc: _map)
+#endif
#pragma omp target
{
@@ -57,7 +59,9 @@ int main (void)
_map.~multimap ();
#endif
+#ifndef MEM_SHARED
#pragma omp target exit data map (release: _map)
+#endif
bool ok = validate (sum, keys, data);
return ok ? 0 : 1;
diff --git a/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C
new file mode 100644
index 0000000..2d80756
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__multiset-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C
index 0b16ca5..b12402e 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C
@@ -34,7 +34,9 @@ int main (void)
srand (time (NULL));
init (data);
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[:N]) map (alloc: set)
+#endif
{
#pragma omp target
{
diff --git a/libgomp/testsuite/libgomp.c++/target-std__set-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__set-concurrent-usm.C
new file mode 100644
index 0000000..54f62e3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__set-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__set-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C
index 6953b63..cd23128 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C
@@ -39,7 +39,9 @@ int main (void)
srand (time (NULL));
init (data);
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[:N]) map (alloc: _set)
+#endif
{
#pragma omp target
{
diff --git a/libgomp/testsuite/libgomp.c++/target-std__span-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__span-concurrent-usm.C
new file mode 100644
index 0000000..7ef16bf
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__span-concurrent-usm.C
@@ -0,0 +1,7 @@
+// { dg-additional-options "-std=c++20" }
+
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__span-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C
index ac89a89..046b3c1 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C
@@ -34,7 +34,9 @@ int main (void)
srand (time (NULL));
init (data);
+#ifndef MEM_SHARED
#pragma omp target enter data map (to: data[:N]) map (alloc: elements, span)
+#endif
#pragma omp target
{
@@ -56,7 +58,9 @@ int main (void)
#endif
}
+#ifndef MEM_SHARED
#pragma omp target exit data map (release: elements, span)
+#endif
return ok ? 0 : 1;
}
diff --git a/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C
new file mode 100644
index 0000000..41ec80e
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__valarray-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C
index 127aec4..8933072b 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C
@@ -37,7 +37,9 @@ int main (void)
std::valarray<int> arr;
#endif
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[:N]) map (alloc: arr)
+#endif
{
#pragma omp target
{
diff --git a/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent-usm.C b/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent-usm.C
new file mode 100644
index 0000000..967bff3
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent-usm.C
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__vector-concurrent.C"
diff --git a/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C b/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C
index 1367f965..a94b4cf 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C
@@ -37,7 +37,9 @@ int main (void)
std::vector<int> vec;
#endif
+#ifndef MEM_SHARED
#pragma omp target data map (to: data[:N]) map (alloc: vec)
+#endif
{
#ifndef MEM_SHARED
#pragma omp target