https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92854

--- Comment #2 from jules at gcc dot gnu.org ---
For strictly-paired acc_map_data/acc_unmap_data calls that don't interfere with
other mappings -- no, probably not. But (like I guess you noticed too) the
existing code feels wrong (or at least ugly) nonetheless.

It's probably possible to come up with a legal (but odd) test case in which the
condition is false -- maybe something like this (untested!):

int arr1[100], arr2[100], arr3[100];

void foo (void)
{
  #pragma acc data copy(arr1) copy(arr2) copy(arr3)
  {
    void *darr2 = acc_deviceptr (arr2);
    acc_map_data (arr2, darr2, sizeof (arr2));
    [...]
    acc_unmap_data (arr2);
  }
}

Now I think the acc_map_data call will reuse the tgt for the structured data
mapping, which binds together several array copies into a single device block.
Forcing the first key's refcount to infinity (as is done in the current
implementation of acc_map_data) is also wrong in that case.

Reply via email to