libgomp/
* testsuite/libgomp.c++/target-std__unordered_map-concurrent-usm.C:
New.
* testsuite/libgomp.c++/target-std__unordered_multimap-concurrent-usm.C:
Likewise.
* testsuite/libgomp.c++/target-std__unordered_multiset-concurrent-usm.C:
Likewise.
* testsuite/libgomp.c++/target-std__unordered_set-concurrent-usm.C:
Likewise.
* testsuite/libgomp.c++/target-std__unordered_map-concurrent.C:
Adjust.
* testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C:
Likewise.
* testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C:
Likewise.
* testsuite/libgomp.c++/target-std__unordered_set-concurrent.C:
Likewise.
---
.../target-std__unordered_map-concurrent-usm.C | 6 ++++++
.../target-std__unordered_map-concurrent.C | 12 ++++++++++++
.../target-std__unordered_multimap-concurrent-usm.C | 6 ++++++
.../target-std__unordered_multimap-concurrent.C | 12 ++++++++++++
.../target-std__unordered_multiset-concurrent-usm.C | 6 ++++++
.../target-std__unordered_multiset-concurrent.C | 10 ++++++++++
.../target-std__unordered_set-concurrent-usm.C | 6 ++++++
.../target-std__unordered_set-concurrent.C | 10 ++++++++++
8 files changed, 68 insertions(+)
create mode 100644
libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent-usm.C
create mode 100644
libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent-usm.C
create mode 100644
libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent-usm.C
create mode 100644
libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent-usm.C
diff --git
a/libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent-usm.C
b/libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent-usm.C
new file mode 100644
index 00000000000..0823724259b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent-usm.C
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+#define OMP_USM
+#define MEM_SHARED
+
+#include "target-std__unordered_map-concurrent.C"
diff --git
a/libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent.C
b/libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent.C
index 3b259c4a141..2643f2662ca 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__unordered_map-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_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
{
@@ -54,12 +56,22 @@ int main (void)
for (int i = 0; i < N; ++i)
sum += (long long) keys[i] * _map[keys[i]];
+#ifdef OMP_USM
+ #pragma omp target
+ /* Restore the object into pristine state. In particular, deallocate
+ any memory allocated during device execution, which otherwise, back
+ on the host, we'd SIGSEGV on, when attempting to deallocate during
+ destruction of the object. */
+ __typeof__ (_map){}.swap (_map);
+#endif
#ifndef MEM_SHARED
#pragma omp target
_map.~unordered_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__unordered_multimap-concurrent-usm.C
b/libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent-usm.C
new file mode 100644
index 00000000000..72a247bc69e
--- /dev/null
+++
b/libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent-usm.C
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+#define OMP_USM
+#define MEM_SHARED
+
+#include "target-std__unordered_multimap-concurrent.C"
diff --git
a/libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C
b/libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C
index d36d95d4944..4edce7e7d88 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__unordered_multimap-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_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
{
@@ -53,12 +55,22 @@ int main (void)
}
}
+#ifdef OMP_USM
+ #pragma omp target
+ /* Restore the object into pristine state. In particular, deallocate
+ any memory allocated during device execution, which otherwise, back
+ on the host, we'd SIGSEGV on, when attempting to deallocate during
+ destruction of the object. */
+ __typeof__ (_map){}.swap (_map);
+#endif
#ifndef MEM_SHARED
#pragma omp target
_map.~unordered_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__unordered_multiset-concurrent-usm.C
b/libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent-usm.C
new file mode 100644
index 00000000000..a9b733eef2f
--- /dev/null
+++
b/libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent-usm.C
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+#define OMP_USM
+#define MEM_SHARED
+
+#include "target-std__unordered_multiset-concurrent.C"
diff --git
a/libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C
b/libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C
index 3a3df2203fd..e461408fdbc 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_multiset-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: set)
+#endif
{
#pragma omp target
{
@@ -48,6 +50,14 @@ int main (void)
for (int i = 0; i < MAX; ++i)
sum += i * set.count (i);
+#ifdef OMP_USM
+ #pragma omp target
+ /* Restore the object into pristine state. In particular, deallocate
+ any memory allocated during device execution, which otherwise, back
+ on the host, we'd SIGSEGV on, when attempting to deallocate during
+ destruction of the object. */
+ __typeof__ (set){}.swap (set);
+#endif
#ifndef MEM_SHARED
#pragma omp target
set.~unordered_multiset ();
diff --git
a/libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent-usm.C
b/libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent-usm.C
new file mode 100644
index 00000000000..093f2353016
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent-usm.C
@@ -0,0 +1,6 @@
+/* { dg-require-effective-target omp_usm } */
+#pragma omp requires unified_shared_memory self_maps
+#define OMP_USM
+#define MEM_SHARED
+
+#include "target-std__unordered_set-concurrent.C"
diff --git
a/libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent.C
b/libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent.C
index ca38d33a050..b672b963841 100644
--- a/libgomp/testsuite/libgomp.c++/target-std__unordered_set-concurrent.C
+++ b/libgomp/testsuite/libgomp.c++/target-std__unordered_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
{
@@ -55,6 +57,14 @@ int main (void)
if (_set.count (i) > 0)
sum += i;
+#ifdef OMP_USM
+ #pragma omp target
+ /* Restore the object into pristine state. In particular, deallocate
+ any memory allocated during device execution, which otherwise, back
+ on the host, we'd SIGSEGV on, when attempting to deallocate during
+ destruction of the object. */
+ __typeof__ (_set){}.swap (_set);
+#endif
#ifndef MEM_SHARED
#pragma omp target
_set.~unordered_set ();
--
2.34.1