diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2019-12-18 18:02:00 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2019-12-18 18:02:00 +0100 |
commit | 34cfe31e1da108a2d6f6a7d120d3a9dac377649d (patch) | |
tree | e40caba2a3b92513bd5cac28655b8f1848ddbd63 /libgomp/oacc-mem.c | |
parent | aaf0e9d7081755e4a95c236cfe623923a0fe6f32 (diff) |
[OpenACC] Refactor 'delete_copyout' into 'goacc_exit_data'
Change 'FLAG_COPYOUT', 'FLAG_FINALIZE' into the usual map kind.
No functional changes.
libgomp/
* oacc-mem.c (delete_copyout): Refactor into...
(goacc_exit_data): ... this. Adjust all users.
From-SVN: r279536
Diffstat (limited to 'libgomp/oacc-mem.c')
-rw-r--r-- | libgomp/oacc-mem.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c index 68b78b3f42f..76356ce9280 100644 --- a/libgomp/oacc-mem.c +++ b/libgomp/oacc-mem.c @@ -636,15 +636,17 @@ acc_pcopyin (void *h, size_t s) } #endif -#define FLAG_COPYOUT (1 << 0) -#define FLAG_FINALIZE (1 << 1) + +/* Exit a dynamic mapping. */ static void -delete_copyout (unsigned f, void *h, size_t s, int async, const char *libfnname) +goacc_exit_data (void *h, size_t s, unsigned short kind, int async) { /* No need to call lazy open, as the data must already have been mapped. */ + kind &= 0xff; + struct goacc_thread *thr = goacc_thread (); struct gomp_device_descr *acc_dev = thr->dev; @@ -683,7 +685,9 @@ delete_copyout (unsigned f, void *h, size_t s, int async, const char *libfnname) gomp_fatal ("Dynamic reference counting assert fail\n"); } - if (f & FLAG_FINALIZE) + bool finalize = (kind == GOMP_MAP_DELETE + || kind == GOMP_MAP_FORCE_FROM); + if (finalize) { if (n->refcount != REFCOUNT_INFINITY) n->refcount -= n->dynamic_refcount; @@ -700,7 +704,9 @@ delete_copyout (unsigned f, void *h, size_t s, int async, const char *libfnname) { goacc_aq aq = get_goacc_asyncqueue (async); - if (f & FLAG_COPYOUT) + bool copyout = (kind == GOMP_MAP_FROM + || kind == GOMP_MAP_FORCE_FROM); + if (copyout) { void *d = (void *) (n->tgt->tgt_start + n->tgt_offset + (uintptr_t) h - n->host_start); @@ -733,50 +739,49 @@ delete_copyout (unsigned f, void *h, size_t s, int async, const char *libfnname) void acc_delete (void *h , size_t s) { - delete_copyout (0, h, s, acc_async_sync, __FUNCTION__); + goacc_exit_data (h, s, GOMP_MAP_RELEASE, acc_async_sync); } void acc_delete_async (void *h , size_t s, int async) { - delete_copyout (0, h, s, async, __FUNCTION__); + goacc_exit_data (h, s, GOMP_MAP_RELEASE, async); } void acc_delete_finalize (void *h , size_t s) { - delete_copyout (FLAG_FINALIZE, h, s, acc_async_sync, __FUNCTION__); + goacc_exit_data (h, s, GOMP_MAP_DELETE, acc_async_sync); } void acc_delete_finalize_async (void *h , size_t s, int async) { - delete_copyout (FLAG_FINALIZE, h, s, async, __FUNCTION__); + goacc_exit_data (h, s, GOMP_MAP_DELETE, async); } void acc_copyout (void *h, size_t s) { - delete_copyout (FLAG_COPYOUT, h, s, acc_async_sync, __FUNCTION__); + goacc_exit_data (h, s, GOMP_MAP_FROM, acc_async_sync); } void acc_copyout_async (void *h, size_t s, int async) { - delete_copyout (FLAG_COPYOUT, h, s, async, __FUNCTION__); + goacc_exit_data (h, s, GOMP_MAP_FROM, async); } void acc_copyout_finalize (void *h, size_t s) { - delete_copyout (FLAG_COPYOUT | FLAG_FINALIZE, h, s, acc_async_sync, - __FUNCTION__); + goacc_exit_data (h, s, GOMP_MAP_FORCE_FROM, acc_async_sync); } void acc_copyout_finalize_async (void *h, size_t s, int async) { - delete_copyout (FLAG_COPYOUT | FLAG_FINALIZE, h, s, async, __FUNCTION__); + goacc_exit_data (h, s, GOMP_MAP_FORCE_FROM, async); } static void |