https://gcc.gnu.org/g:a9145a813c2716ec613cff163a3bbc9ea108e84d

commit a9145a813c2716ec613cff163a3bbc9ea108e84d
Author: Julian Brown <jul...@codesourcery.com>
Date:   Wed Sep 11 13:22:03 2019 -0700

    Fix OpenACC "ephemeral" asynchronous host-to-device copies
    
            libgomp/
            * testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c (main): Fix
            async-safety issue. Increase number of iterations.

Diff:
---
 libgomp/ChangeLog.omp                                      |  6 ++++++
 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c | 14 ++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 52d5cfe3b25..9389a0eefe3 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,9 @@
+2019-09-17  Julian Brown  <jul...@codesourcery.com>
+           Kwok Cheung Yeung  <k...@codesourcery.com>
+
+       * testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c (main): Fix
+       async-safety issue. Increase number of iterations.
+
 2018-10-04  Cesar Philippidis  <ce...@codesourcery.com>
            Julian Brown  <jul...@codesourcery.com>
 
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c 
b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c
index 573a8214bf0..dadb6d37942 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-10.c
@@ -1,6 +1,8 @@
 #include <stdlib.h>
 
-/* Test asyncronous attach and detach operation.  */
+#define ITERATIONS 1023
+
+/* Test asynchronous attach and detach operation.  */
 
 typedef struct {
   int *a;
@@ -25,13 +27,13 @@ main (int argc, char* argv[])
 
 #pragma acc enter data copyin(m)
 
-  for (int i = 0; i < 99; i++)
+  for (int i = 0; i < ITERATIONS; i++)
     {
       int j;
-#pragma acc parallel loop copy(m.a[0:N]) async(i % 2)
+#pragma acc parallel loop copy(m.a[0:N]) async(0)
       for (j = 0; j < N; j++)
        m.a[j]++;
-#pragma acc parallel loop copy(m.b[0:N]) async((i + 1) % 2)
+#pragma acc parallel loop copy(m.b[0:N]) async(1)
       for (j = 0; j < N; j++)
        m.b[j]++;
     }
@@ -40,9 +42,9 @@ main (int argc, char* argv[])
 
   for (i = 0; i < N; i++)
     {
-      if (m.a[i] != 99)
+      if (m.a[i] != ITERATIONS)
        abort ();
-      if (m.b[i] != 99)
+      if (m.b[i] != ITERATIONS)
        abort ();
     }

Reply via email to