Commit 5bcd470b by Julian Brown Committed by Julian Brown

Use gomp_map_val for OpenACC host-to-device address translation

	libgomp/
	* libgomp.h (gomp_map_val): Add prototype.
	* oacc-parallel.c (GOACC_parallel_keyed): Use gomp_map_val instead of
	open-coding device-address calculation.
	* target.c (gomp_map_val): Make global. Use OFFSET_POINTER in
	non-present case.

Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>

From-SVN: r279622
parent 378da98f
2019-12-19 Julian Brown <julian@codesourcery.com> 2019-12-19 Julian Brown <julian@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
* libgomp.h (gomp_map_val): Add prototype.
* oacc-parallel.c (GOACC_parallel_keyed): Use gomp_map_val instead of
open-coding device-address calculation.
* target.c (gomp_map_val): Make global. Use OFFSET_POINTER in
non-present case.
2019-12-19 Julian Brown <julian@codesourcery.com>
* libgomp.h (struct splay_tree_key_s): Substitute dynamic_refcount * libgomp.h (struct splay_tree_key_s): Substitute dynamic_refcount
field for virtual_refcount. field for virtual_refcount.
......
...@@ -1157,6 +1157,7 @@ extern void gomp_copy_host2dev (struct gomp_device_descr *, ...@@ -1157,6 +1157,7 @@ extern void gomp_copy_host2dev (struct gomp_device_descr *,
extern void gomp_copy_dev2host (struct gomp_device_descr *, extern void gomp_copy_dev2host (struct gomp_device_descr *,
struct goacc_asyncqueue *, void *, const void *, struct goacc_asyncqueue *, void *, const void *,
size_t); size_t);
extern uintptr_t gomp_map_val (struct target_mem_desc *, void **, size_t);
extern struct target_mem_desc *gomp_map_vars (struct gomp_device_descr *, extern struct target_mem_desc *gomp_map_vars (struct gomp_device_descr *,
size_t, void **, void **, size_t, void **, void **,
......
...@@ -303,12 +303,8 @@ GOACC_parallel_keyed (int flags_m, void (*fn) (void *), ...@@ -303,12 +303,8 @@ GOACC_parallel_keyed (int flags_m, void (*fn) (void *),
devaddrs = gomp_alloca (sizeof (void *) * mapnum); devaddrs = gomp_alloca (sizeof (void *) * mapnum);
for (i = 0; i < mapnum; i++) for (i = 0; i < mapnum; i++)
if (tgt->list[i].key != NULL) devaddrs[i] = (void *) gomp_map_val (tgt, hostaddrs, i);
devaddrs[i] = (void *) (tgt->list[i].key->tgt->tgt_start
+ tgt->list[i].key->tgt_offset
+ tgt->list[i].offset);
else
devaddrs[i] = NULL;
if (aq == NULL) if (aq == NULL)
acc_dev->openacc.exec_func (tgt_fn, mapnum, hostaddrs, devaddrs, dims, acc_dev->openacc.exec_func (tgt_fn, mapnum, hostaddrs, devaddrs, dims,
tgt); tgt);
......
...@@ -493,7 +493,7 @@ gomp_map_fields_existing (struct target_mem_desc *tgt, ...@@ -493,7 +493,7 @@ gomp_map_fields_existing (struct target_mem_desc *tgt,
(void *) cur_node.host_end); (void *) cur_node.host_end);
} }
static inline uintptr_t attribute_hidden uintptr_t
gomp_map_val (struct target_mem_desc *tgt, void **hostaddrs, size_t i) gomp_map_val (struct target_mem_desc *tgt, void **hostaddrs, size_t i)
{ {
if (tgt->list[i].key != NULL) if (tgt->list[i].key != NULL)
...@@ -713,7 +713,7 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep, ...@@ -713,7 +713,7 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep,
{ {
/* Not present, hence, skip entry - including its MAP_POINTER, /* Not present, hence, skip entry - including its MAP_POINTER,
when existing. */ when existing. */
tgt->list[i].offset = 0; tgt->list[i].offset = OFFSET_POINTER;
if (i + 1 < mapnum if (i + 1 < mapnum
&& ((typemask & get_kind (short_mapkind, kinds, i + 1)) && ((typemask & get_kind (short_mapkind, kinds, i + 1))
== GOMP_MAP_POINTER)) == GOMP_MAP_POINTER))
......
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