From: Jakub Jelinek <jakub@redhat.com>
To: Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch] OpenMP 5.1: Add proc-bind 'primary' support
Date: Thu, 12 Aug 2021 13:31:23 +0200 [thread overview]
Message-ID: <20210812113123.GA2380545@tucnak> (raw)
In-Reply-To: <7c8ee5ba-8a6d-a254-2e3b-31611b57abee@codesourcery.com>
On Thu, Aug 12, 2021 at 12:52:17PM +0200, Tobias Burnus wrote:
> gcc/c/ChangeLog:
>
> * c-parser.c (c_parser_omp_clause_proc_bind): Accept
> 'primary' as alias for 'master'.
>
> gcc/cp/ChangeLog:
>
> * parser.c (cp_parser_omp_clause_proc_bind): Accept
> 'primary' as alias for 'master'.
>
> gcc/fortran/ChangeLog:
>
> * dump-parse-tree.c (show_omp_clauses): Add TODO comment to
> change 'master' to 'primary' in proc_bind for OpenMP 5.1.
> * intrinsic.texi (OMP_LIB): Mention OpenMP 5.1; add
> omp_proc_bind_primary.
> * openmp.c (gfc_match_omp_clauses): Accept
> 'primary' as alias for 'master'.
>
> gcc/ChangeLog:
>
> * tree-pretty-print.c (dump_omp_clause): Add TODO comment to
> change 'master' to 'primary' in proc_bind for OpenMP 5.1.
>
> libgomp/ChangeLog:
>
> * env.c (parse_bind_var): Accept 'primary' as alias for
> 'master'.
> (omp_display_env): Add TODO comment to
> change 'master' to 'primary' in proc_bind for OpenMP 5.1.
> * libgomp.texi: Change 'master thread' to 'primary thread'
> in line with OpenMP 5.1.
> (omp_get_proc_bind): Add omp_proc_bind_primary and note that
> omp_proc_bind_master is an alias of it.
> (OMP_PROC_BIND): Mention 'PRIMARY'.
> * omp.h.in (__GOMP_DEPRECATED_5_1): Define.
> (omp_proc_bind_primary): Add.
> (omp_proc_bind_master): Deprecate for OpenMP 5.1.
> * omp_lib.f90.in (omp_proc_bind_primary): Add.
> (omp_proc_bind_master): Deprecate for OpenMP 5.1.
> * omp_lib.h.in (omp_proc_bind_primary): Add.
> * testsuite/libgomp.c/affinity-1.c: Check that
> 'primary' works and is identical to 'master'.
>
> gcc/testsuite/ChangeLog:
>
> * c-c++-common/gomp/pr61486-2.c: Duplicate one proc_bind(master)
> testcase and test proc_bind(primary) instead.
> * gfortran.dg/gomp/affinity-1.f90: Likewise.
LGTM, some nits below.
> @@ -15975,7 +15976,9 @@ c_parser_omp_clause_proc_bind (c_parser *parser, tree list)
> if (c_parser_next_token_is (parser, CPP_NAME))
> {
> const char *p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
> - if (strcmp ("master", p) == 0)
> + if (strcmp ("primary", p) == 0)
> + kind = OMP_CLAUSE_PROC_BIND_MASTER;
> + else if (strcmp ("master", p) == 0)
Maybe in tree-core.h do:
- OMP_CLAUSE_PROC_BIND_MASTER = 2,
+ OMP_CLAUSE_PROC_BIND_PRIMARY = 2,
+ OMP_CLAUSE_PROC_BIND_MASTER = OMP_CLAUSE_PROC_BIND_PRIMARY,
and use OMP_CLAUSE_PROC_BIND_PRIMARY for the "primary" cases?
I'd keep tree-pretty-print.c as is though for now (so print master).
And in omp-expand we actually just count on those enumerators
matching the omp.h omp_proc_bind_* ones.
> @@ -39037,7 +39038,9 @@ cp_parser_omp_clause_proc_bind (cp_parser *parser, tree list,
> tree id = cp_lexer_peek_token (parser->lexer)->u.value;
> const char *p = IDENTIFIER_POINTER (id);
>
> - if (strcmp ("master", p) == 0)
> + if (strcmp ("primary", p) == 0)
> + kind = OMP_CLAUSE_PROC_BIND_MASTER;
> + else if (strcmp ("master", p) == 0)
Ditto.
> - if (gfc_match ("proc_bind ( master )") == MATCH_YES)
> + /* Primary is new and master is deprecated in OpenMP 5.1. */
> + if (gfc_match ("proc_bind ( primary )") == MATCH_YES)
> + c->proc_bind = OMP_PROC_BIND_MASTER;
> + else if (gfc_match ("proc_bind ( master )") == MATCH_YES)
Maybe here too with gfortran.h change?
> --- a/libgomp/omp_lib.f90.in
> +++ b/libgomp/omp_lib.f90.in
> @@ -48,6 +48,8 @@
> parameter :: omp_proc_bind_false = 0
> integer (omp_proc_bind_kind), &
> parameter :: omp_proc_bind_true = 1
> + integer (omp_proc_bind_kind), &
> + parameter :: omp_proc_bind_primary = 2
> integer (omp_proc_bind_kind), &
> parameter :: omp_proc_bind_master = 2
> integer (omp_proc_bind_kind), &
> @@ -670,6 +672,10 @@
>
> #if _OPENMP >= 201811
> !GCC$ ATTRIBUTES DEPRECATED :: omp_get_nested, omp_set_nested
> +#endif
> +
> +#if _OPENMP >= 202011
> +!GCC$ ATTRIBUTES DEPRECATED :: omp_proc_bind_master
> #endif
I must say I have no idea how this will work, but for omp_*_nested
it is like that already. I think the file is *.f90, not *.F90 and
so it isn't preprocessed (and is it compiled with -fopenmp at all)?
But let's deal with it incrementally.
Jakub
next prev parent reply other threads:[~2021-08-12 11:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 10:52 Tobias Burnus
2021-08-12 11:31 ` Jakub Jelinek [this message]
2021-08-12 13:17 ` Tobias Burnus
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=20210812113123.GA2380545@tucnak \
--to=jakub@redhat.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=tobias@codesourcery.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).