Hi Julian!
On 2020-07-09T17:06:58-0700, Julian Brown <[email protected]> wrote:
> This patch factors out the parts of goacc_enter_datum and
> goacc_exit_datum that can be shared with goacc_enter_data_internal
> and goacc_exit_data_internal respectively (in the next patch),
> without overloading function return values or complicating code paths
> unnecessarily.
Thanks!
> OK?
Just one comment (incremental patch attached; don't need to re-test, I've
done that). With that, OK for master and releases/gcc-10 branches.
> --- a/libgomp/oacc-mem.c
> +++ b/libgomp/oacc-mem.c
> +/* Helper function to map a single dynamic data item, represented by a single
> + mapping. The acc_dev->lock should be held on entry, and remains locked on
> + exit. */
> +
> +static void *
> +goacc_map_var_existing (struct gomp_device_descr *acc_dev, void *hostaddr,
> + size_t size, goacc_aq aq, splay_tree_key n)
Given that this deals only with existing mappings, for which we're never
going to do any host/device data copying etc., this cannot ever make any
use of 'aq', so we shouldn't include it here (see incremental patch
attached).
> +{
> + assert (n);
> +
> + /* Present. */
> + void *d = (void *) (n->tgt->tgt_start + n->tgt_offset + hostaddr
> + - n->host_start);
> +
> + if (hostaddr + size > (void *) n->host_end)
> + {
> + gomp_mutex_unlock (&acc_dev->lock);
> + gomp_fatal ("[%p,+%d] not mapped", hostaddr, (int) size);
> + }
> +
> + assert (n->refcount != REFCOUNT_LINK);
> + if (n->refcount != REFCOUNT_INFINITY)
> + {
> + n->refcount++;
> + n->virtual_refcount++;
> + }
> +
> + return d;
> +}
Grüße
Thomas
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander
Walter
>From f397602baa8116b31dc11ea1f63c3e582d2e5ba7 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <[email protected]>
Date: Fri, 10 Jul 2020 12:46:47 +0200
Subject: [PATCH] into "openacc: Helper functions for enter/exit data using
single mapping"
---
libgomp/oacc-mem.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c
index 6f9043bf5b1..34f519a2045 100644
--- a/libgomp/oacc-mem.c
+++ b/libgomp/oacc-mem.c
@@ -504,7 +504,7 @@ acc_unmap_data (void *h)
static void *
goacc_map_var_existing (struct gomp_device_descr *acc_dev, void *hostaddr,
- size_t size, goacc_aq aq, splay_tree_key n)
+ size_t size, splay_tree_key n)
{
assert (n);
@@ -559,10 +559,9 @@ goacc_enter_datum (void **hostaddrs, size_t *sizes, void *kinds, int async)
gomp_mutex_lock (&acc_dev->lock);
n = lookup_host (acc_dev, hostaddrs[0], sizes[0]);
- goacc_aq aq = get_goacc_asyncqueue (async);
if (n)
{
- d = goacc_map_var_existing (acc_dev, hostaddrs[0], sizes[0], aq, n);
+ d = goacc_map_var_existing (acc_dev, hostaddrs[0], sizes[0], n);
gomp_mutex_unlock (&acc_dev->lock);
}
else
@@ -571,6 +570,8 @@ goacc_enter_datum (void **hostaddrs, size_t *sizes, void *kinds, int async)
gomp_mutex_unlock (&acc_dev->lock);
+ goacc_aq aq = get_goacc_asyncqueue (async);
+
struct target_mem_desc *tgt
= gomp_map_vars_async (acc_dev, aq, mapnum, hostaddrs, NULL, sizes,
kinds, true, GOMP_MAP_VARS_OPENACC_ENTER_DATA);
--
2.17.1