Fix OpenACC 'async'/'wait' issues in 'libgomp.oacc-c-c++-common/lib-{94,95}.c', ...
authorThomas Schwinge <thomas@codesourcery.com>
Tue, 8 Jun 2021 17:32:22 +0000 (19:32 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Tue, 27 Jul 2021 09:16:24 +0000 (11:16 +0200)
Fix-up for r265842 (commit 58168bbf6f8fb456280cca13343a498ad94878c7)
"[OpenACC 2.5, libgomp] Add *_async versions of runtime library API functions".

libgomp/
* testsuite/libgomp.oacc-c-c++-common/lib-94.c: Fix OpenACC
'async'/'wait' issue.
* testsuite/libgomp.oacc-c-c++-common/lib-95.c: Likewise.
* testsuite/libgomp.oacc-fortran/lib-16-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-16.f90: Likewise.

Co-Authored-By: Julian Brown <julian@codesourcery.com>
libgomp/testsuite/libgomp.oacc-c-c++-common/lib-94.c
libgomp/testsuite/libgomp.oacc-c-c++-common/lib-95.c
libgomp/testsuite/libgomp.oacc-fortran/lib-16-2.f90
libgomp/testsuite/libgomp.oacc-fortran/lib-16.f90

index 5449723..baa3ac8 100644 (file)
@@ -22,10 +22,10 @@ main (int argc, char **argv)
 
   acc_copyin_async (h, N, async);
 
-  memset (h, 0, N);
-
   acc_wait (async);
 
+  memset (h, 0, N);
+
   acc_copyout_async (h, N, async + 1);
 
   acc_wait (async + 1);
index 85b238d..842fb84 100644 (file)
@@ -23,10 +23,11 @@ main (int argc, char **argv)
   acc_create_async (h, N, q);
 
   acc_memcpy_to_device_async (acc_deviceptr (h), g, N, q);
-  memset (&h[0], 0, N);
 
   acc_wait (q);
 
+  memset (h, 0, N);
+
   acc_update_self_async (h, N, q + 1);
   acc_delete_async (h, N, q + 1);
 
index ddd557d..2be75dc 100644 (file)
@@ -27,6 +27,8 @@ program main
 
   if (acc_is_present (h) .neqv. .TRUE.) stop 1
 
+  call acc_wait (async)
+
   h(:) = 0
 
   call acc_copyout_async (h, sizeof (h), async)
@@ -45,6 +47,8 @@ program main
   
   if (acc_is_present (h) .neqv. .TRUE.) stop 3
 
+  call acc_wait (async)
+
   do i = 1, N
     if (h(i) /= i + i) stop 4
   end do 
index ccd1ce6..fae0d10 100644 (file)
@@ -27,6 +27,8 @@ program main
 
   if (acc_is_present (h) .neqv. .TRUE.) stop 1
 
+  call acc_wait (async)
+
   h(:) = 0
 
   call acc_copyout_async (h, sizeof (h), async)
@@ -45,6 +47,8 @@ program main
   
   if (acc_is_present (h) .neqv. .TRUE.) stop 3
 
+  call acc_wait (async)
+
   do i = 1, N
     if (h(i) /= i + i) stop 4
   end do