]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp: Add testcases for concurrent access to standard C++ containers on offload...
authorThomas Schwinge <tschwinge@baylibre.com>
Fri, 30 May 2025 09:37:46 +0000 (11:37 +0200)
committerThomas Schwinge <tschwinge@baylibre.com>
Fri, 30 May 2025 12:47:41 +0000 (14:47 +0200)
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.

24 files changed:
libgomp/testsuite/libgomp.c++/target-std__array-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__array-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__bitset-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__deque-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__deque-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__forward_list-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__list-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__list-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__map-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__map-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__multimap-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__multiset-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__set-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__set-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__span-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__span-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__valarray-concurrent.C
libgomp/testsuite/libgomp.c++/target-std__vector-concurrent-usm.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c++/target-std__vector-concurrent.C

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 (file)
index 0000000..9923783
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__array-concurrent.C"
index e97bfe60a615366261d627bb0f3c19fff191fe23..c42105a65ed633fcd1d3fb273360916c388328ce 100644 (file)
@@ -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 (file)
index 0000000..9023ef8
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__bitset-concurrent.C"
index aa27662314bfa5040949540efbfb0f9f16348240..4fcce9321728a928ffdc3c6ccc546f1b22a5c3bd 100644 (file)
@@ -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 (file)
index 0000000..863a1de
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__deque-concurrent.C"
index 5f08bfb002b2adf22d062ba1f251a3153e21f88b..9c2d6fa57b41a30fdd7c05cc234d832964835ca9 100644 (file)
@@ -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 (file)
index 0000000..60d5cee
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__forward_list-concurrent.C"
index f8ab53e30df2a02b8a57b32ba2881f86ec5f943a..6b0ee65493e290ad9580d7cdb073580c0301f4d4 100644 (file)
@@ -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 (file)
index 0000000..5057bf9
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__list-concurrent.C"
index ce3b4265ee044aea29cc05d0d0cd646672a8e718..1f44a17ca09115634b6a716dfd87304cc7340c76 100644 (file)
@@ -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 (file)
index 0000000..fe37426
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__map-concurrent.C"
index 254c490afdbb5cbbec30de700efcf4b7be11c2b0..36556ef0660a10b49ece43cd35cafb16e1ae4c3b 100644 (file)
@@ -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 (file)
index 0000000..79f9245
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__multimap-concurrent.C"
index 65e6732cba3de5219cd49fc2d6c746837f851804..6a4a4e80d34e04b805db33359ee83ae6b9bffdad 100644 (file)
@@ -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 (file)
index 0000000..2d80756
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__multiset-concurrent.C"
index 0b16ca53953fff21fd20c97b5521523df0def84f..b12402e8e0c3a71df70b5eeb69e19bfad8e26100 100644 (file)
@@ -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 (file)
index 0000000..54f62e3
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__set-concurrent.C"
index 6953b6352a2146b7e1f90677f057affbd2110275..cd23128a652f96350ca2309a9a6beafc1d99c94f 100644 (file)
@@ -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 (file)
index 0000000..7ef16bf
--- /dev/null
@@ -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"
index ac89a8980c6220308e4cbee4fc3b7f2247e81c2d..046b3c1a0868ecafe015df65277cb11b31996129 100644 (file)
@@ -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 (file)
index 0000000..41ec80e
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__valarray-concurrent.C"
index 127aec436f51ff828cb8f766e76fe542493bb44d..8933072bb2b24bf1a34f4f885ad5ace60b82b823 100644 (file)
@@ -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 (file)
index 0000000..967bff3
--- /dev/null
@@ -0,0 +1,5 @@
+#pragma omp requires unified_shared_memory self_maps
+
+#define MEM_SHARED
+
+#include "target-std__vector-concurrent.C"
index 1367f9655275fac660d7e3ac5a0ce346c6fc0f33..a94b4cfe9645861ec26bc80ff12826ba6318bc4a 100644 (file)
@@ -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