[Bug middle-end/92929] OpenACC/OpenMP 'target' 'exit data'/'update' optimizations

tschwinge at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 13 12:13:00 GMT 2019


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

--- Comment #3 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
(In reply to myself from comment #1)
>         /* For target {,enter ,exit }data only the array slice is
>            mapped, but not the pointer to it.  */

Some handling for OpenACC 'data' got added in r236678 "use firstprivate
pointers for subarrays in c and c++",
<http://mid.mail-archive.com/573244BE.5010708@codesourcery.com>, but is
somewhat spread out, and not easy to follow:

    case OACC_DATA:
      if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE)
        break;
      /* FALLTHRU */
    case OMP_TARGET_DATA:
    case [...]:
      if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER
          || (OMP_CLAUSE_MAP_KIND (c)
              == GOMP_MAP_FIRSTPRIVATE_REFERENCE))
        /* For target {,enter ,exit }data only the array slice is
           mapped, but not the pointer to it.  */
        remove = true;
[...]
    if (code == OACC_DATA
        && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
        && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER
            || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_REFERENCE))
      remove = true;
    if (remove)
      *list_p = OMP_CLAUSE_CHAIN (c);

..., and not sure if this also relates to the following:

'omp_notice_variable':

    if (octx->region_type == ORT_ACC_DATA
          && (n2->value & GOVD_MAP_0LEN_ARRAY))
        nflags |= GOVD_MAP_0LEN_ARRAY;
    goto found_outer;

'gimplify_scan_omp_clauses':

    if (code == OACC_DATA
        && OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
        && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_FIRSTPRIVATE_POINTER)
      flags |= GOVD_MAP_0LEN_ARRAY;

(Maybe the idea there is to preserve 'GOMP_MAP_FIRSTPRIVATE_POINTER',
'GOMP_MAP_FIRSTPRIVATE_REFERENCE' until some other processing
('GOVD_MAP_0LEN_ARRAY') has been done, and only then remove them, right at the
end.  But that wouldn't be quite obvious.)


More information about the Gcc-bugs mailing list