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

--- Comment #9 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(In reply to Thomas Schwinge from comment #0)
> As of Tobias' recent r277631 "Fortran/OpenMP] Don't create "alloc:" for
> 'target exit data'",
> <http://mid.mail-archive.com/7a5f39e8-a33b-048a-f9c1-
> 1355b9417...@codesourcery.com>, this is done for Fortran OpenMP '!$omp
> target exit data'/'!$omp target update', but not for OpenACC '!$acc exit
> data'/'!$acc update'; see 'gcc/gimplify.c:gimplify_scan_omp_clauses':
> 
>     /* For Fortran, not only the pointer to the data is mapped but also
>        the address of the pointer, the array descriptor etc.; for
>        'exit data' - and in particular for 'delete:' - having an 'alloc:'
>        does not make sense.  Likewise, for 'update' only transferring the
>        data itself is needed as the rest has been handled in previous
>        directives.  */
>     if ((code == OMP_TARGET_EXIT_DATA || code == OMP_TARGET_UPDATE)
>         && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
>             || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO_PSET))
>       remove = true;

Is it actually correct to remove 'GOMP_MAP_TO_PSET' for 'OMP_TARGET_UPDATE'?

Untested -- I'm thinking of the following Fortran scenario:

    arrays a1, a2
    pointer p

    [target] enter data(a1, a2)

    p => a1
    [target] enter data(p)
    ! creates persistent, visible device copy of 'p', initially pointing to
'a1'

    p => a2
    [target] update to(p)
    ! do we now still have 'p => a1' on the device, or 'p => a2'?

What is this '[target] update' to do?  Just update the data pointed to, and
also/or only update the array descriptor on the device?  If the latter, then
didn't get this broken by r277631 (cited above)?  Again: unverified.

But (also unverified), would 'libgomp/target.c:gomp_update' actually do the
right thing for 'GOMP_MAP_TO_PSET', given the current 'GOMP_MAP_COPY_TO_P'
definition?

Am I confused, or the code?

Reply via email to