summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-08-23 10:16:24 +0200
committerJakub Jelinek <jakub@redhat.com>2021-08-23 10:16:24 +0200
commit3bc75533d1f87f0617be6c1af98804f9127ec637 (patch)
treefa6ecc3f9840f638a87d8f4f39884c31ec7e7bab /include
parent6f1a3668f5ee5152bdcca59843802e587339eda1 (diff)
downloadgcc-3bc75533d1f87f0617be6c1af98804f9127ec637.tar.gz
openmp: Add support for strict modifier on grainsize/num_tasks clauses
With strict: modifier on these clauses, the standard is explicit about how many iterations (and which) each generated task of taskloop directive should contain. For num_tasks it actually matches what we were already implementing, but for grainsize it does not (and even violates the old rule - without strict it requires that the number of iterations (unspecified which exactly) handled by each generated task is >= grainsize argument and < 2 * grainsize argument, with strict: it requires that each generated task handles exactly == grainsize argument iterations, except for the generated task handling the last iteration which can handles <= grainsize iterations). The following patch implements it for C and C++. 2021-08-23 Jakub Jelinek <jakub@redhat.com> gcc/ * tree.h (OMP_CLAUSE_GRAINSIZE_STRICT): Define. (OMP_CLAUSE_NUM_TASKS_STRICT): Define. * tree-pretty-print.c (dump_omp_clause) <case OMP_CLAUSE_GRAINSIZE, case OMP_CLAUSE_NUM_TASKS>: Print strict: modifier. * omp-expand.c (expand_task_call): Use GOMP_TASK_FLAG_STRICT in iflags if either grainsize or num_tasks clause has the strict modifier. gcc/c/ * c-parser.c (c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize): Parse the optional strict: modifier. gcc/cp/ * parser.c (cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize): Parse the optional strict: modifier. include/ * gomp-constants.h (GOMP_TASK_FLAG_STRICT): Define. libgomp/ * taskloop.c (GOMP_taskloop): Handle GOMP_TASK_FLAG_STRICT. * testsuite/libgomp.c-c++-common/taskloop-4.c (main): Fix up comment. * testsuite/libgomp.c-c++-common/taskloop-5.c: New test.
Diffstat (limited to 'include')
-rw-r--r--include/gomp-constants.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/gomp-constants.h b/include/gomp-constants.h
index 6e163b02560..ebd08013430 100644
--- a/include/gomp-constants.h
+++ b/include/gomp-constants.h
@@ -222,6 +222,7 @@ enum gomp_map_kind
#define GOMP_TASK_FLAG_NOGROUP (1 << 11)
#define GOMP_TASK_FLAG_REDUCTION (1 << 12)
#define GOMP_TASK_FLAG_DETACH (1 << 13)
+#define GOMP_TASK_FLAG_STRICT (1 << 14)
/* GOMP_target{_ext,update_ext,enter_exit_data} flags argument. */
#define GOMP_TARGET_FLAG_NOWAIT (1 << 0)