aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-pretty-print.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-10-01 10:45:48 +0200
committerJakub Jelinek <jakub@redhat.com>2021-10-01 10:45:48 +0200
commite705b8533aa0a00a65734eb5fd6344295723dccc (patch)
tree14b7dfb5ef10b315e88664aba384b3975016c0e1 /gcc/tree-pretty-print.c
parent3749c3aff6512003a61b7cf4a96eff0e8926d781 (diff)
downloadgcc-e705b8533aa0a00a65734eb5fd6344295723dccc.zip
gcc-e705b8533aa0a00a65734eb5fd6344295723dccc.tar.gz
gcc-e705b8533aa0a00a65734eb5fd6344295723dccc.tar.bz2
openmp: Differentiate between order(concurrent) and order(reproducible:concurrent)
While OpenMP 5.1 implies order(concurrent) is the same thing as order(reproducible:concurrent), this is going to change in OpenMP 5.2, where essentially order(concurrent) means nothing is stated on whether it is reproducible or unconstrained (and is determined by other means, e.g. for/do with schedule static or runtime with static being selected is implicitly reproducible, distribute with dist_schedule static is implicitly reproducible, loop is implicitly reproducible) and when the modifier is specified explicitly, it overrides the implicit behavior either way. And, when order(reproducible:concurrent) is used with e.g. schedule(dynamic) or some other schedule that is by definition not reproducible, it is implementation's duty to ensure it is reproducible, either by remembering how it scheduled some loop and then replaying the same schedule when seeing loops with the same directive/schedule/number of iterations, or by overriding the schedule to some reproducible one. This patch doesn't implement the 5.2 wording just yet, but in the FEs differentiates between the 3 states - no explicit modifier, explicit reproducible or explicit unconstrainted, so that the middle-end can easily switch any time. Instead it follows the 5.1 wording where both order(concurrent) (implicit or explicit) or order(reproducible:concurrent) imply reproducibility. And, it implements the easier method, when for/do should be reproducible, it just chooses static schedule. order(concurrent) implies no OpenMP APIs in the loop body nor threadprivate vars, so the exact scheduling isn't (easily at least) observable. 2021-10-01 Jakub Jelinek <jakub@redhat.com> gcc/ * tree.h (OMP_CLAUSE_ORDER_REPRODUCIBLE): Define. * tree-pretty-print.c (dump_omp_clause) <case OMP_CLAUSE_ORDER>: Print reproducible: for OMP_CLAUSE_ORDER_REPRODUCIBLE. * omp-general.c (omp_extract_for_data): If OMP_CLAUSE_ORDER is seen without OMP_CLAUSE_ORDER_UNCONSTRAINED, overwrite sched_kind to OMP_CLAUSE_SCHEDULE_STATIC. gcc/c-family/ * c-omp.c (c_omp_split_clauses): Also copy OMP_CLAUSE_ORDER_REPRODUCIBLE. gcc/c/ * c-parser.c (c_parser_omp_clause_order): Set OMP_CLAUSE_ORDER_REPRODUCIBLE for explicit reproducible: modifier. gcc/cp/ * parser.c (cp_parser_omp_clause_order): Set OMP_CLAUSE_ORDER_REPRODUCIBLE for explicit reproducible: modifier. gcc/fortran/ * gfortran.h (gfc_omp_clauses): Add order_reproducible bitfield. * dump-parse-tree.c (show_omp_clauses): Print REPRODUCIBLE: for it. * openmp.c (gfc_match_omp_clauses): Set order_reproducible for explicit reproducible: modifier. * trans-openmp.c (gfc_trans_omp_clauses): Set OMP_CLAUSE_ORDER_REPRODUCIBLE for order_reproducible. (gfc_split_omp_clauses): Also copy order_reproducible. gcc/testsuite/ * gfortran.dg/gomp/order-5.f90: Adjust scan-tree-dump-times regexps. libgomp/ * testsuite/libgomp.c-c++-common/order-reproducible-1.c: New test. * testsuite/libgomp.c-c++-common/order-reproducible-2.c: New test.
Diffstat (limited to 'gcc/tree-pretty-print.c')
-rw-r--r--gcc/tree-pretty-print.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 35e567c..0b5bdd7 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1165,6 +1165,8 @@ dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
pp_string (pp, "order(");
if (OMP_CLAUSE_ORDER_UNCONSTRAINED (clause))
pp_string (pp, "unconstrained:");
+ else if (OMP_CLAUSE_ORDER_REPRODUCIBLE (clause))
+ pp_string (pp, "reproducible:");
pp_string (pp, "concurrent)");
break;