Hi Jakub!

I know it's very late in the GCC 9 release process, but I'm still
catching up with OpenACC patch review, and just at the end of last week
I'd noticed that this commit (trunk r261813):

On Fri, 25 May 2018 13:01:58 -0700, Cesar Philippidis <ce...@codesourcery.com> 
wrote:
> This patch updates GCC's to support OpenACC 2.5's data clause semantics
> [and other stuff...]

... should get rid off the following special-case handling for the new
OpenACC 'if_present' and 'finalize' clauses added here:

    --- a/gcc/gimplify.c
    +++ b/gcc/gimplify.c
    @@ -10817,6 +10807,53 @@ gimplify_omp_target_update (tree *expr_p, 
gimple_seq *pre_p)
                               ort, TREE_CODE (expr));
       gimplify_adjust_omp_clauses (pre_p, NULL, &OMP_STANDALONE_CLAUSES (expr),
                                 TREE_CODE (expr));
    +  if (TREE_CODE (expr) == OACC_UPDATE
    +      && omp_find_clause (OMP_STANDALONE_CLAUSES (expr),
    +                     OMP_CLAUSE_IF_PRESENT))
    +    {
    +      /* The runtime uses GOMP_MAP_{TO,FROM} to denote the if_present
    +    clause.  */
    +      for (tree c = OMP_STANDALONE_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN 
(c))
    +   if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP)
    +     switch (OMP_CLAUSE_MAP_KIND (c))
    +       {
    +       case GOMP_MAP_FORCE_TO:
    +         OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_TO);
    +         break;
    +       case GOMP_MAP_FORCE_FROM:
    +         OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_FROM);
    +         break;
    +       default:
    +         break;
    +       }
    +    }
    +  else if (TREE_CODE (expr) == OACC_EXIT_DATA
    +      && omp_find_clause (OMP_STANDALONE_CLAUSES (expr),
    +                          OMP_CLAUSE_FINALIZE))
    +    {
    +      /* Use GOMP_MAP_DELETE/GOMP_MAP_FORCE_FROM to denote that "finalize"
    +    semantics apply to all mappings of this OpenACC directive.  */
    +      bool finalize_marked = false;
    +      for (tree c = OMP_STANDALONE_CLAUSES (expr); c; c = OMP_CLAUSE_CHAIN 
(c))
    +   if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP)
    +     switch (OMP_CLAUSE_MAP_KIND (c))
    +       {
    +       case GOMP_MAP_FROM:
    +         OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_FORCE_FROM);
    +         finalize_marked = true;
    +         break;
    +       case GOMP_MAP_RELEASE:
    +         OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_DELETE);
    +         finalize_marked = true;
    +         break;
    +       default:
    +         /* Check consistency: libgomp relies on the very first data
    +            mapping clause being marked, so make sure we did that before
    +            any other mapping clauses.  */
    +         gcc_assert (finalize_marked);
    +         break;
    +       }
    +    }
       stmt = gimple_build_omp_target (NULL, kind, OMP_STANDALONE_CLAUSES 
(expr));
    
       gimplify_seq_add_stmt (pre_p, stmt);

..., plus the corresponding decoding process on the libgomp side.

This should instead use the interface that I added in trunk r267448 'For
libgomp OpenACC entry points, redefine the "device" argument to "flags"'
to communicate such flags from the compiler to libgomp.

I'll cook up a patch, very localized to OpenACC code, which will remove
more lines of code that it'll be adding, but as it's an ABI change, it
needs to go into gcc-9-branch before the 9.1 release is made (planned for
end of week, as I've read).


Grüße
 Thomas

Attachment: signature.asc
Description: PGP signature

Reply via email to