Hi Julian! On 2019-12-17T21:03:47-0800, Julian Brown <jul...@codesourcery.com> wrote: > This part contains the libgomp runtime support for the GOMP_MAP_ATTACH and > GOMP_MAP_DETACH mapping kinds
> --- a/libgomp/target.c > +++ b/libgomp/target.c > @@ -1203,6 +1211,32 @@ gomp_map_vars_internal (struct gomp_device_descr > *devicep, > + case GOMP_MAP_ATTACH: > + { > + cur_node.host_start = (uintptr_t) hostaddrs[i]; > + cur_node.host_end = cur_node.host_start + sizeof (void *); > + splay_tree_key n = splay_tree_lookup (mem_map, &cur_node); > + if (n != NULL) > + { > + tgt->list[i].key = n; > + tgt->list[i].offset = cur_node.host_start - n->host_start; > + tgt->list[i].length = n->host_end - n->host_start; > + tgt->list[i].copy_from = false; > + tgt->list[i].always_copy_from = false; > + tgt->list[i].do_detach > + = (pragma_kind != GOMP_MAP_VARS_OPENACC_ENTER_DATA); > + n->refcount++; > + } > + else > + { > + gomp_mutex_unlock (&devicep->lock); > + gomp_fatal ("outer struct not mapped for attach"); > + } > + gomp_attach_pointer (devicep, aq, mem_map, n, > + (uintptr_t) hostaddrs[i], sizes[i], > + cbufp); > + continue; > + } For the OpenACC runtime API 'acc_attach' etc. routines they don't, so what's the conceptual reason that for the corresponding OpenACC directive variants, 'GOMP_MAP_ATTACH' etc. here participate in reference counting ('n->refcount++' above)? I understand OpenACC 'attach'/'detach' clauses to be simple "executable clauses", which just update some values somewhere (say, like 'GOMP_MAP_ALWAYS_POINTER'), but they don't alter any mapping state, thus wouldn't appear to need reference counting? 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