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