public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: <gcc-patches@gcc.gnu.org>, <catherine_moore@mentor.com>
Subject: [GCC 9 RM attention] Re: [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior
Date: Mon, 29 Apr 2019 10:48:00 -0000	[thread overview]
Message-ID: <87wojdf72w.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <7fa7637f-e7f5-d43d-13f1-706c77e8e957@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 3378 bytes --]

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 <cesar@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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

  parent reply	other threads:[~2019-04-29 10:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25 20:09 Cesar Philippidis
2018-06-19 16:56 ` Cesar Philippidis
2018-06-19 16:58   ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - C++ Cesar Philippidis
2018-06-20 16:16     ` Jakub Jelinek
2018-06-19 16:59   ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - C Cesar Philippidis
2018-06-20 16:14     ` Jakub Jelinek
2018-06-19 17:00   ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - Fortran Cesar Philippidis
2018-06-20 16:17     ` Jakub Jelinek
2018-06-19 17:01   ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - middle end Cesar Philippidis
2018-06-20 16:20     ` Jakub Jelinek
2018-06-19 17:01   ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - runtime Cesar Philippidis
2018-06-20 16:45     ` Jakub Jelinek
2018-06-20 16:59       ` Cesar Philippidis
2018-06-20 17:03         ` Jakub Jelinek
2018-06-20 17:07           ` Cesar Philippidis
2019-05-02 14:03     ` Thomas Schwinge
2019-05-29 14:32       ` Thomas Schwinge
2019-12-09 11:44     ` In 'libgomp/target.c:gomp_exit_data', remove open-coded 'gomp_remove_var' (was: [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - runtime) Thomas Schwinge
2019-12-11 16:59     ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - runtime Thomas Schwinge
2020-05-19 13:58     ` 'gomp_map_vars' locking protocol (was: [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - runtime) Thomas Schwinge
2018-06-19 17:02   ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - compiler tests Cesar Philippidis
2018-06-19 17:03   ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior - runtime tests Cesar Philippidis
2018-12-14 21:25 ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior Thomas Schwinge
2019-02-22 11:02   ` Thomas Schwinge
2019-04-29 10:48 ` Thomas Schwinge [this message]
2019-04-29 11:05   ` [GCC 9 RM attention] " Jakub Jelinek
2019-04-30  8:28     ` Thomas Schwinge
2019-12-13 14:14 ` [OpenACC] Elaborate/simplify 'exit data' 'finalize' handling (was: [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior) Thomas Schwinge
2019-12-13 23:34   ` Julian Brown
2019-12-18 17:12     ` Thomas Schwinge
2019-12-18 17:13 ` [OpenACC] Update OpenACC data clause semantics to the 2.5 behavior Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wojdf72w.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=catherine_moore@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).