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
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: