[gomp4.1] Support #pragma omp target {enter,exit} data
Jakub Jelinek
jakub@redhat.com
Thu Nov 14 11:28:00 GMT 2019
On Thu, Nov 14, 2019 at 12:08:45PM +0100, Thomas Schwinge wrote:
> > @@ -794,7 +807,7 @@ gomp_offload_image_to_device (struct gomp_device_descr *devicep,
> > /* Insert host-target address mapping into splay tree. */
> > struct target_mem_desc *tgt = gomp_malloc (sizeof (*tgt));
> > tgt->array = gomp_malloc ((num_funcs + num_vars) * sizeof (*tgt->array));
> > - tgt->refcount = 1;
> > + tgt->refcount = REFCOUNT_INFINITY;
> > tgt->tgt_start = 0;
> > tgt->tgt_end = 0;
> > tgt->to_free = NULL;
>
> I had understood that 'REFCOUNT_INFINITY' is only meant to be used for
> the 'refcount' in 'struct splay_tree_key_s', but here it's used for the
> 'refcount' in 'struct target_mem_desc'. However, all the other 'struct
> target_mem_desc' 'refcount' handling doesn't seem to take care of the
> special 'REFCOUNT_INFINITY' value.
>
> This might not be an actually observable bug (I have not verified, have
> not tried to construct a test case), but should this be changed anyway?
> (Back to 'tgt->refcount = 1'; not yet tested?)
No, we certainly don't want the code to free this unless the image is
unloaded. So, if anything, REFCOUNT_INFINITY needs to be special cased
even in the target_mem_desc handling. But, do you actually see any code
path where the current code doesn't work properly?
Jakub
More information about the Gcc-patches
mailing list