diff mbox series

[libgomp,openacc] Use GOMP_ASYNC_SYNC in GOACC_declare

Message ID 286d95c2-dbf3-c4d8-3a79-f1dbb7e650b2@mentor.com
State New
Headers show
Series [libgomp,openacc] Use GOMP_ASYNC_SYNC in GOACC_declare | expand

Commit Message

Tom de Vries Nov. 17, 2017, 8:45 a.m. UTC
Hi,

GOACC_enter_exit_data has this prototype:
...
void
GOACC_enter_exit_data (int device, size_t mapnum,
                        void **hostaddrs, size_t *sizes,
                        unsigned short *kinds,
                        int async, int num_waits, ...)
...

And GOACC_declare calls GOACC_enter_exit_data with async arg zero:
...
           case GOMP_MAP_DELETE:
             GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
                                    &kinds[i], 0, 0);
...

Async arg zero means some async queue (see openacc 2.0a, 2.14.1 "async 
clause" for more details).

The declare directive has no async clause, so the arg should be 
GOMP_ASYNC_SYNC.

Tested libgomp testsuite on x86_64 with nvptx accelerator.

OK for trunk?

Thanks,
- Tom

Comments

Tom de Vries May 9, 2018, 4 p.m. UTC | #1
On 11/17/2017 09:45 AM, Tom de Vries wrote:
> Hi,
> 
> GOACC_enter_exit_data has this prototype:
> ...
> void
> GOACC_enter_exit_data (int device, size_t mapnum,
>                         void **hostaddrs, size_t *sizes,
>                         unsigned short *kinds,
>                         int async, int num_waits, ...)
> ...
> 
> And GOACC_declare calls GOACC_enter_exit_data with async arg zero:
> ...
>            case GOMP_MAP_DELETE:
>              GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
>                                     &kinds[i], 0, 0);
> ...
> 
> Async arg zero means some async queue (see openacc 2.0a, 2.14.1 "async 
> clause" for more details).
> 
> The declare directive has no async clause, so the arg should be 
> GOMP_ASYNC_SYNC.
> 
> Tested libgomp testsuite on x86_64 with nvptx accelerator.
> 
> OK for trunk?

Assuming no objections, committed to trunk as attached.

Thanks,
- Tom
[openacc, libgomp] Use GOMP_ASYNC_SYNC in GOACC_declare

2018-05-09  Tom de Vries  <tom@codesourcery.com>

	PR libgomp/82901
	* oacc-parallel.c (GOACC_declare): Use GOMP_ASYNC_SYNC as async argument
	to GOACC_enter_exit_data.

---
 libgomp/oacc-parallel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c
index a71b399..f270491 100644
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -524,7 +524,7 @@ GOACC_declare (int device, size_t mapnum,
 	  case GOMP_MAP_POINTER:
 	  case GOMP_MAP_DELETE:
 	    GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
-				   &kinds[i], 0, 0);
+				   &kinds[i], GOMP_ASYNC_SYNC, 0);
 	    break;
 
 	  case GOMP_MAP_FORCE_DEVICEPTR:
@@ -533,19 +533,19 @@ GOACC_declare (int device, size_t mapnum,
 	  case GOMP_MAP_ALLOC:
 	    if (!acc_is_present (hostaddrs[i], sizes[i]))
 	      GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
-				     &kinds[i], 0, 0);
+				     &kinds[i], GOMP_ASYNC_SYNC, 0);
 	    break;
 
 	  case GOMP_MAP_TO:
 	    GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
-				   &kinds[i], 0, 0);
+				   &kinds[i], GOMP_ASYNC_SYNC, 0);
 
 	    break;
 
 	  case GOMP_MAP_FROM:
 	    kinds[i] = GOMP_MAP_FORCE_FROM;
 	    GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
-				   &kinds[i], 0, 0);
+				   &kinds[i], GOMP_ASYNC_SYNC, 0);
 	    break;
 
 	  case GOMP_MAP_FORCE_PRESENT:
diff mbox series

Patch

Use GOMP_ASYNC_SYNC in GOACC_declare

Fix for PR82901 - "GOACC_declare calls GOACC_enter_exit_data with async arg 0"

---
 libgomp/oacc-parallel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libgomp/oacc-parallel.c b/libgomp/oacc-parallel.c
index a8cff9e..d82d500 100644
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -524,7 +524,7 @@  GOACC_declare (int device, size_t mapnum,
 	  case GOMP_MAP_POINTER:
 	  case GOMP_MAP_DELETE:
 	    GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
-				   &kinds[i], 0, 0);
+				   &kinds[i], GOMP_ASYNC_SYNC, 0);
 	    break;
 
 	  case GOMP_MAP_FORCE_DEVICEPTR:
@@ -533,19 +533,19 @@  GOACC_declare (int device, size_t mapnum,
 	  case GOMP_MAP_ALLOC:
 	    if (!acc_is_present (hostaddrs[i], sizes[i]))
 	      GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
-				     &kinds[i], 0, 0);
+				     &kinds[i], GOMP_ASYNC_SYNC, 0);
 	    break;
 
 	  case GOMP_MAP_TO:
 	    GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
-				   &kinds[i], 0, 0);
+				   &kinds[i], GOMP_ASYNC_SYNC, 0);
 
 	    break;
 
 	  case GOMP_MAP_FROM:
 	    kinds[i] = GOMP_MAP_FORCE_FROM;
 	    GOACC_enter_exit_data (device, 1, &hostaddrs[i], &sizes[i],
-				   &kinds[i], 0, 0);
+				   &kinds[i], GOMP_ASYNC_SYNC, 0);
 	    break;
 
 	  case GOMP_MAP_FORCE_PRESENT: