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>,
	Kirill Yukhin <kirill.yukhin@gmail.com>,
	Richard Henderson <rth@redhat.com>
Subject: Re: [gomp4.1] Initial support for some OpenMP 4.1 construct parsing
Date: Wed, 29 Apr 2015 11:55:00 -0000	[thread overview]
Message-ID: <874mnzrw1z.fsf@schwinge.name> (raw)
In-Reply-To: <20150429111406.GE1751@tucnak.redhat.com>

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

Hi Jakub!

(I have not yet read any version of the OpenMP 4.1 standard.)

On Wed, 29 Apr 2015 13:14:06 +0200, Jakub Jelinek <jakub@redhat.com> wrote:
> --- gcc/tree.def.jj	2015-04-29 10:58:01.663745452 +0200
> +++ gcc/tree.def	2015-04-29 11:34:18.293302684 +0200

> +/* OpenMP - #pragma omp target enter data [clause1 ... clauseN]
> +   Operand 0: OMP_TARGET_ENTER_DATA_CLAUSES: List of clauses.  */
> +DEFTREECODE (OMP_TARGET_ENTER_DATA, "omp_target_enter_data", tcc_statement, 1)
> +
> +/* OpenMP - #pragma omp target exit data [clause1 ... clauseN]
> +   Operand 0: OMP_TARGET_EXIT_DATA_CLAUSES: List of clauses.  */
> +DEFTREECODE (OMP_TARGET_EXIT_DATA, "omp_target_exit_data", tcc_statement, 1)

;-) Heh, OpenMP catching up with OpenACC?

> --- gcc/c/c-parser.c.jj	2015-04-29 10:59:20.760504260 +0200
> +++ gcc/c/c-parser.c	2015-04-29 11:03:04.641991095 +0200

>     map ( variable-list )
>  
>     map-kind:
> -     alloc | to | from | tofrom  */
> +     alloc | to | from | tofrom
> +
> +   OpenMP 4.1:
> +   map-kind:
> +     alloc | to | from | tofrom | delete
> +
> +   map ( always [,] map-kind: variable-list ) */

"Funnily", OpenACC 2.5 is said to be dropping the "always" semantics that
OpenMP 4.1 is now adding...  That is, OpenACC 2.5's "copy" will then be
the same as "present_or_copy", and so on.

>  static tree
>  c_parser_omp_target_data (location_t loc, c_parser *parser)
>  {
> -  tree stmt = make_node (OMP_TARGET_DATA);
> -  TREE_TYPE (stmt) = void_type_node;
> -
> -  OMP_TARGET_DATA_CLAUSES (stmt)
> +  tree clauses
>      = c_parser_omp_all_clauses (parser, OMP_TARGET_DATA_CLAUSE_MASK,
>  				"#pragma omp target data");
> +  if (find_omp_clause (clauses, OMP_CLAUSE_MAP) == NULL_TREE)
> +    {
> +      error_at (loc,
> +		"%<#pragma omp target data%> must contain at least one "
> +		"%<map%> clause");
> +      return NULL_TREE;
> +    }
> +
> +  tree stmt = make_node (OMP_TARGET_DATA);
> +  TREE_TYPE (stmt) = void_type_node;
> +  OMP_TARGET_DATA_CLAUSES (stmt) = clauses;

Even if it doesn't make a lot of sense, my reading of OpenMP 4.0 has been
that a target data construct without any map clauses is still valid.
(But I have not verified that now.)

> --- gcc/omp-low.c.jj	2015-04-29 10:58:01.489748182 +0200
> +++ gcc/omp-low.c	2015-04-29 11:03:04.646991017 +0200
> @@ -8994,6 +9017,11 @@ expand_omp_target (struct omp_region *re
>      case GF_OMP_TARGET_KIND_UPDATE:
>        start_ix = BUILT_IN_GOMP_TARGET_UPDATE;
>        break;
> +    case GF_OMP_TARGET_KIND_ENTER_DATA:
> +    case GF_OMP_TARGET_KIND_EXIT_DATA:
> +      /* FIXME */
> +      start_ix = BUILT_IN_GOMP_TARGET_UPDATE;
> +      break;

Actually, I've also wondered (but never verified) whether all of the
OpenACC enter, exit, and update constructs can be implemented via the
same libgomp API.

> @@ -11488,6 +11520,9 @@ lower_omp_target (gimple_stmt_iterator *
>  	      default:
>  		gcc_unreachable ();
>  	      }
> +	    /* FIXME: Temporary hack.  */
> +	    if (talign_shift == 3)
> +	      tkind &= ~GOMP_MAP_FLAG_FORCE;
>  	    gcc_checking_assert (tkind
>  				 < (HOST_WIDE_INT_C (1U) << talign_shift));
>  	    talign = ceil_log2 (talign);

Assuming you'll be changing the relevant functions' APIs, and assigning
new ABI versions, don't forget to also drop the unused offload_table
formal parameter (assuming that it remains unused).

> --- gcc/tree-pretty-print.c.jj	2015-04-29 10:58:01.663745452 +0200
> +++ gcc/tree-pretty-print.c	2015-04-29 11:03:04.648990986 +0200
> @@ -550,22 +560,22 @@ dump_omp_clause (pretty_printer *pp, tre
>  	  pp_string (pp, "tofrom");
>  	  break;
>  	case GOMP_MAP_FORCE_ALLOC:
> -	  pp_string (pp, "force_alloc");
> +	  pp_string (pp, "always,alloc");
>  	  break;
>  	case GOMP_MAP_FORCE_TO:
> -	  pp_string (pp, "force_to");
> +	  pp_string (pp, "always,to");
>  	  break;
>  	case GOMP_MAP_FORCE_FROM:
> -	  pp_string (pp, "force_from");
> +	  pp_string (pp, "always,from");
>  	  break;
>  	case GOMP_MAP_FORCE_TOFROM:
> -	  pp_string (pp, "force_tofrom");
> +	  pp_string (pp, "always,tofrom");
>  	  break;
>  	case GOMP_MAP_FORCE_PRESENT:
>  	  pp_string (pp, "force_present");
>  	  break;
>  	case GOMP_MAP_FORCE_DEALLOC:
> -	  pp_string (pp, "force_dealloc");
> +	  pp_string (pp, "always,delete");
>  	  break;
>  	case GOMP_MAP_FORCE_DEVICEPTR:
>  	  pp_string (pp, "force_deviceptr");

Makes some sense to me to use the same "always,*" syntax also for the
other "force_*" ones, given that these are artificial ("non-OpenACC")
descriptions anyway.


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

  reply	other threads:[~2015-04-29 11:52 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 11:44 Jakub Jelinek
2015-04-29 11:55 ` Thomas Schwinge [this message]
2015-04-29 12:31   ` Jakub Jelinek
2015-04-29 15:20     ` Thomas Schwinge
2015-06-09 18:39     ` Ilya Verbin
2015-06-09 20:25       ` Jakub Jelinek
2015-06-25 19:47         ` Ilya Verbin
2015-06-25 20:31           ` Jakub Jelinek
2015-07-17 16:47             ` Ilya Verbin
2015-07-17 16:54               ` Jakub Jelinek
2015-07-20 16:18                 ` Jakub Jelinek
2015-07-20 18:31                   ` Jakub Jelinek
2015-07-23  0:50                     ` Jakub Jelinek
2015-07-24 20:33                       ` Jakub Jelinek
2015-07-29 17:30                         ` [gomp4.1] Various accelerator updates from OpenMP 4.1 Jakub Jelinek
2015-09-04 18:17                           ` Ilya Verbin
2015-09-04 18:25                             ` Jakub Jelinek
2015-09-07 12:48                             ` Jakub Jelinek
2015-07-20 19:40                 ` [gomp4.1] Initial support for some OpenMP 4.1 construct parsing Ilya Verbin
2015-08-24 12:38                   ` Jakub Jelinek
2015-08-24 19:10                     ` Ilya Verbin
2015-06-11 12:52       ` [gomp4.1] map clause parsing improvements Jakub Jelinek
2015-10-19 10:34         ` Thomas Schwinge
2015-10-19 10:46           ` Jakub Jelinek
2015-10-19 15:14             ` Thomas Schwinge
2015-10-20 10:10               ` Jakub Jelinek
2015-10-26 13:04                 ` Ilya Verbin
2015-10-26 13:17                   ` Jakub Jelinek
2015-10-26 14:16                     ` Ilya Verbin
2016-03-17 14:34             ` Thomas Schwinge
2016-03-17 14:37               ` Jakub Jelinek
2016-03-17 14:55                 ` Jakub Jelinek
2016-03-17 15:13                 ` Rename GOMP_MAP_FORCE_DEALLOC to GOMP_MAP_DELETE (was: [gomp4.1] map clause parsing improvements) 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=874mnzrw1z.fsf@schwinge.name \
    --to=thomas@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=kirill.yukhin@gmail.com \
    --cc=rth@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).