aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2019-12-11 17:48:59 +0100
committerThomas Schwinge <tschwinge@gcc.gnu.org>2019-12-11 17:48:59 +0100
commit3d1b5e710e5573416bb13113b6593307e6b008e2 (patch)
tree3fcc3cefcd623c5c964bdef6ed668bd4023440ae
parent5e9394382251d43eb06f117260fcfb18961ce0c4 (diff)
downloadgcc-3d1b5e710e5573416bb13113b6593307e6b008e2.zip
gcc-3d1b5e710e5573416bb13113b6593307e6b008e2.tar.gz
gcc-3d1b5e710e5573416bb13113b6593307e6b008e2.tar.bz2
[PR92854] Add 'libgomp.oacc-c-c++-common/acc_map_data-device_already-*.c', 'libgomp.oacc-c-c++-common/acc_map_data-host_already-*.c'
... to document the status quo. libgomp/ PR libgomp/92854 * testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-1.c: New file. * testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-3.c: Likewise. From-SVN: r279231
-rw-r--r--libgomp/ChangeLog16
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-1.c36
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-2.c35
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-3.c31
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-1.c33
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-2.c32
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-3.c27
7 files changed, 210 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 6635ed7..404722e 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,4 +1,20 @@
2019-12-11 Thomas Schwinge <thomas@codesourcery.com>
+
+ PR libgomp/92854
+ * testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-1.c:
+ New file.
+ * testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-2.c:
+ Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-3.c:
+ Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-1.c:
+ Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-2.c:
+ Likewise.
+ * testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-3.c:
+ Likewise.
+
+2019-12-11 Thomas Schwinge <thomas@codesourcery.com>
Julian Brown <julian@codesourcery.com>
* target.c (gomp_load_image_to_device, omp_target_associate_ptr):
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-1.c
new file mode 100644
index 0000000..b48a1ad
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-1.c
@@ -0,0 +1,36 @@
+/* Verify that we refuse 'acc_map_data' when the "device address [...] is
+ already mapped". */
+
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <openacc.h>
+
+int
+main ()
+{
+ const int N = 131;
+
+ char *h1 = (char *) malloc (N);
+ assert (h1);
+ void *d = acc_malloc (N);
+ assert (d);
+ acc_map_data (h1, d, N);
+
+ char *h2 = (char *) malloc (N);
+ assert (h2);
+ /* Try to arrange a setting such that a later 'acc_unmap_data' would find the
+ device memory object still referenced elsewhere. This is not possible,
+ given the semantics of 'acc_map_data'. */
+ fprintf (stderr, "CheCKpOInT\n");
+ acc_map_data (h2, d, N);
+
+ return 0;
+}
+
+
+/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
+/* { dg-output "device address \\\[\[0-9a-fA-FxX\]+, \\\+131\\\] is already mapped" } */
+/* { dg-shouldfail "" } */
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-2.c
new file mode 100644
index 0000000..4fe0662
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-2.c
@@ -0,0 +1,35 @@
+/* Verify that we refuse 'acc_map_data' when the "device address [...] is
+ already mapped". */
+
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <openacc.h>
+
+int
+main ()
+{
+ const int N = 132;
+
+ char *h1 = (char *) malloc (N);
+ assert (h1);
+ void *d = acc_create (h1, N);
+ assert (d);
+
+ char *h2 = (char *) malloc (N);
+ assert (h2);
+ /* Try to arrange a setting such that a later 'acc_unmap_data' would find the
+ device memory object still referenced elsewhere. This is not possible,
+ given the semantics of 'acc_map_data'. */
+ fprintf (stderr, "CheCKpOInT\n");
+ acc_map_data (h2, d, N);
+
+ return 0;
+}
+
+
+/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
+/* { dg-output "device address \\\[\[0-9a-fA-FxX\]+, \\\+132\\\] is already mapped" } */
+/* { dg-shouldfail "" } */
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-3.c
new file mode 100644
index 0000000..44ebaa0
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-device_already-3.c
@@ -0,0 +1,31 @@
+/* Verify that we refuse 'acc_map_data' when the "device address [...] is
+ already mapped". */
+
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
+
+#include <assert.h>
+#include <stdio.h>
+#include <openacc.h>
+
+double global_var;
+#pragma acc declare create (global_var)
+
+int
+main ()
+{
+ double var;
+ void *d = acc_deviceptr (&global_var);
+ assert (d);
+ /* Try to arrange a setting such that a later 'acc_unmap_data' would find the
+ device memory object still referenced elsewhere. This is not possible,
+ given the semantics of 'acc_map_data'. */
+ fprintf (stderr, "CheCKpOInT\n");
+ acc_map_data (&var, d, sizeof var);
+
+ return 0;
+}
+
+
+/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
+/* { dg-output "device address \\\[\[0-9a-fA-FxX\]+, \\\+8\\\] is already mapped" { xfail *-*-* } } TODO PR92888 */
+/* { dg-shouldfail "TODO PR92888" { this-really-should-fail } } */
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-1.c
new file mode 100644
index 0000000..1fff806
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-1.c
@@ -0,0 +1,33 @@
+/* Verify that we refuse 'acc_map_data' when the "host address [...] is already
+ mapped". */
+
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <openacc.h>
+
+int
+main ()
+{
+ const int N = 101;
+
+ char *h = (char *) malloc (N);
+ assert (h);
+ void *d1 = acc_malloc (N);
+ assert (d1);
+ acc_map_data (h, d1, N);
+
+ void *d2 = acc_malloc (N);
+ assert (d2);
+ fprintf (stderr, "CheCKpOInT\n");
+ acc_map_data (h, d2, N);
+
+ return 0;
+}
+
+
+/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
+/* { dg-output "host address \\\[\[0-9a-fA-FxX\]+, \\\+101\\\] is already mapped" } */
+/* { dg-shouldfail "" } */
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-2.c
new file mode 100644
index 0000000..fc80469
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-2.c
@@ -0,0 +1,32 @@
+/* Verify that we refuse 'acc_map_data' when the "host address [...] is already
+ mapped". */
+
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <openacc.h>
+
+int
+main ()
+{
+ const int N = 102;
+
+ char *h = (char *) malloc (N);
+ assert (h);
+ void *d1 = acc_create (h, N);
+ assert (d1);
+
+ void *d2 = acc_malloc (N);
+ assert (d2);
+ fprintf (stderr, "CheCKpOInT\n");
+ acc_map_data (h, d2, N);
+
+ return 0;
+}
+
+
+/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
+/* { dg-output "host address \\\[\[0-9a-fA-FxX\]+, \\\+102\\\] is already mapped" } */
+/* { dg-shouldfail "" } */
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-3.c
new file mode 100644
index 0000000..6a80ebf
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_map_data-host_already-3.c
@@ -0,0 +1,27 @@
+/* Verify that we refuse 'acc_map_data' when the "host address [...] is already
+ mapped". */
+
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
+
+#include <assert.h>
+#include <stdio.h>
+#include <openacc.h>
+
+float global_var;
+#pragma acc declare create (global_var)
+
+int
+main ()
+{
+ void *d = acc_malloc (sizeof global_var);
+ assert (d);
+ fprintf (stderr, "CheCKpOInT\n");
+ acc_map_data (&global_var, d, sizeof global_var);
+
+ return 0;
+}
+
+
+/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
+/* { dg-output "host address \\\[\[0-9a-fA-FxX\]+, \\\+4\\\] is already mapped" } */
+/* { dg-shouldfail "" } */