Hi Julian! Thanks for walking me through this.
On 2019-12-14T00:19:04+0000, Julian Brown <jul...@codesourcery.com> wrote: > On Fri, 13 Dec 2019 16:25:25 +0100 > Thomas Schwinge <tho...@codesourcery.com> wrote: >> On 2019-10-29T12:15:01+0000, Julian Brown <jul...@codesourcery.com> >> wrote: >> > static int >> > -find_pointer (int pos, size_t mapnum, unsigned short *kinds) >> > +find_group_last (int pos, size_t mapnum, unsigned short *kinds) >> > { >> > - if (pos + 1 >= mapnum) >> > - return 0; >> > + unsigned char kind0 = kinds[pos] & 0xff; >> > + int first_pos = pos, last_pos = pos; >> > >> > - unsigned char kind = kinds[pos+1] & 0xff; >> > - >> > - if (kind == GOMP_MAP_TO_PSET) >> > - return 3; >> > - else if (kind == GOMP_MAP_POINTER) >> > - return 2; >> > + if (kind0 == GOMP_MAP_TO_PSET) >> > + { >> > + while (pos + 1 < mapnum && (kinds[pos + 1] & 0xff) == >> > GOMP_MAP_POINTER) >> > + last_pos = ++pos; >> > + /* We expect at least one GOMP_MAP_POINTER after a >> > GOMP_MAP_TO_PSET. */ >> > + assert (last_pos > first_pos); >> > + } >> > + else >> > + { >> > + /* GOMP_MAP_ALWAYS_POINTER can only appear directly after some other >> > + mapping. */ >> > + if (pos + 1 < mapnum >> > + && (kinds[pos + 1] & 0xff) == GOMP_MAP_ALWAYS_POINTER) >> > + return pos + 1; >> > + >> > + /* We can have one or several GOMP_MAP_POINTER mappings after a >> > to/from >> > + (etc.) mapping. */ >> > + while (pos + 1 < mapnum && (kinds[pos + 1] & 0xff) == >> > GOMP_MAP_POINTER) >> > + last_pos = ++pos; >> > + } >> > >> > - return 0; >> > + return last_pos; >> > } Given: program test implicit none integer, parameter :: n = 64 integer :: a(n) call test_array(a) contains subroutine test_array(a) implicit none integer :: a(n) !$acc enter data copyin(a) !$acc exit data delete(a) end subroutine test_array end program test ..., we get a 'GOMP_MAP_TO' followed by a 'GOMP_MAP_POINTER'. That got us 'find_pointer () == 2', and now we get 'find_group_last (i) == i + 1' (so, the same). > In a previous iteration of the refcount overhaul patch, we had the > "magic" code fragment: > >> + for (int j = 0; j < 2; j++) >> + gomp_map_vars_async (acc_dev, aq, >> + (j == 0 || pointer == 2) ? 1 : 2, >> + &hostaddrs[i + j], NULL, >> + &sizes[i + j], &kinds[i + j], true, >> + GOMP_MAP_VARS_OPENACC_ENTER_DATA); > The "pointer == 2" case (i.e. with a GOMP_MAP_TO and a > GOMP_MAP_POINTER) So, that's the example given above. > will also handle the mappings separately in both the > earlier patch iteration ACK, given the "previous iteration" code presented above. > and this one. NACK? Given 'find_group_last (i) == i + 1', that means that 'GOMP_MAP_TO' and 'GOMP_MAP_POINTER' get mapped as one group? On the other hand, it still does match the current 'find_pointer' behavior? But what should the behavior here be: 'GOMP_MAP_TO', 'GOMP_MAP_POINTER' each separate, or as one group? Confusing stuff. :-| Grüße Thomas
signature.asc
Description: PGP signature