Commit 1a79b578 by Thomas Schwinge Committed by Thomas Schwinge

[OpenACC] Refactor 'GOACC_enter_exit_data' to call 'goacc_enter_data', 'goacc_exit_data'

No functional changes.

	libgomp/
	* oacc-mem.c (GOACC_enter_exit_data): Refactor code to call
	'goacc_enter_data', 'goacc_exit_data'.

From-SVN: r279537
parent 34cfe31e
2019-12-18 Thomas Schwinge <thomas@codesourcery.com> 2019-12-18 Thomas Schwinge <thomas@codesourcery.com>
* oacc-mem.c (GOACC_enter_exit_data): Refactor code to call
'goacc_enter_data', 'goacc_exit_data'.
* oacc-mem.c (delete_copyout): Refactor into... * oacc-mem.c (delete_copyout): Refactor into...
(goacc_exit_data): ... this. Adjust all users. (goacc_exit_data): ... this. Adjust all users.
......
...@@ -1158,28 +1158,26 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs, ...@@ -1158,28 +1158,26 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs,
{ {
for (i = 0; i < mapnum; i++) for (i = 0; i < mapnum; i++)
{ {
unsigned char kind = kinds[i] & 0xff;
/* Scan for pointers and PSETs. */ /* Scan for pointers and PSETs. */
int pointer = find_pointer (i, mapnum, kinds); int pointer = find_pointer (i, mapnum, kinds);
if (!pointer) if (!pointer)
{ {
unsigned char kind = kinds[i] & 0xff;
switch (kind) switch (kind)
{ {
case GOMP_MAP_ALLOC: case GOMP_MAP_ALLOC:
case GOMP_MAP_FORCE_ALLOC: case GOMP_MAP_FORCE_ALLOC:
acc_create_async (hostaddrs[i], sizes[i], async);
break;
case GOMP_MAP_TO: case GOMP_MAP_TO:
case GOMP_MAP_FORCE_TO: case GOMP_MAP_FORCE_TO:
acc_copyin_async (hostaddrs[i], sizes[i], async);
break; break;
default: default:
gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 0x%.2x", gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 0x%.2x",
kind); kind);
break; break;
} }
goacc_enter_data (hostaddrs[i], sizes[i], kinds[i], async);
} }
else else
{ {
...@@ -1198,9 +1196,6 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs, ...@@ -1198,9 +1196,6 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs,
{ {
unsigned char kind = kinds[i] & 0xff; unsigned char kind = kinds[i] & 0xff;
bool finalize = (kind == GOMP_MAP_DELETE
|| kind == GOMP_MAP_FORCE_FROM);
int pointer = find_pointer (i, mapnum, kinds); int pointer = find_pointer (i, mapnum, kinds);
if (!pointer) if (!pointer)
...@@ -1209,26 +1204,21 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs, ...@@ -1209,26 +1204,21 @@ GOACC_enter_exit_data (int flags_m, size_t mapnum, void **hostaddrs,
{ {
case GOMP_MAP_RELEASE: case GOMP_MAP_RELEASE:
case GOMP_MAP_DELETE: case GOMP_MAP_DELETE:
if (finalize)
acc_delete_finalize_async (hostaddrs[i], sizes[i], async);
else
acc_delete_async (hostaddrs[i], sizes[i], async);
break;
case GOMP_MAP_FROM: case GOMP_MAP_FROM:
case GOMP_MAP_FORCE_FROM: case GOMP_MAP_FORCE_FROM:
if (finalize)
acc_copyout_finalize_async (hostaddrs[i], sizes[i], async);
else
acc_copyout_async (hostaddrs[i], sizes[i], async);
break; break;
default: default:
gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 0x%.2x", gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 0x%.2x",
kind); kind);
break; break;
} }
goacc_exit_data (hostaddrs[i], sizes[i], kinds[i], async);
} }
else else
{ {
bool finalize = (kind == GOMP_MAP_DELETE
|| kind == GOMP_MAP_FORCE_FROM);
bool copyfrom = (kind == GOMP_MAP_FORCE_FROM bool copyfrom = (kind == GOMP_MAP_FORCE_FROM
|| kind == GOMP_MAP_FROM); || kind == GOMP_MAP_FROM);
goacc_remove_pointer (hostaddrs[i], sizes[i], copyfrom, async, goacc_remove_pointer (hostaddrs[i], sizes[i], copyfrom, async,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment