openmp: Add taskwait nowait depend support [PR105378]
authorJakub Jelinek <jakub@redhat.com>
Tue, 24 May 2022 07:12:44 +0000 (09:12 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 24 May 2022 07:12:44 +0000 (09:12 +0200)
commitb43836914bdc2a37563cf31359b2c4803bfe4374
treeb46c9fd3a7988e119e9dc60919b0866efdd6c52e
parent1adf11822bd48f4d65156b7642514630c08c4d00
openmp: Add taskwait nowait depend support [PR105378]

This patch adds support for (so far C/C++)
  #pragma omp taskwait nowait depend(...)
directive, which is like
  #pragma omp task depend(...)
  ;
but slightly optimized on the library side, so that it creates
the task only for the purpose of dependency tracking and doesn't actually
schedule it and wait for it when the dependencies are satisfied, instead
makes its dependencies satisfied right away.

2022-05-24  Jakub Jelinek  <jakub@redhat.com>

PR c/105378
gcc/
* omp-builtins.def (BUILT_IN_GOMP_TASKWAIT_DEPEND_NOWAIT): New
builtin.
* gimplify.cc (gimplify_omp_task): Diagnose taskwait with nowait
clause but no depend clauses.
* omp-expand.cc (expand_taskwait_call): Use
BUILT_IN_GOMP_TASKWAIT_DEPEND_NOWAIT rather than
BUILT_IN_GOMP_TASKWAIT_DEPEND if nowait clause is present.
gcc/c/
* c-parser.cc (OMP_TASKWAIT_CLAUSE_MASK): Add nowait clause.
gcc/cp/
* parser.cc (OMP_TASKWAIT_CLAUSE_MASK): Add nowait clause.
gcc/testsuite/
* c-c++-common/gomp/taskwait-depend-nowait-1.c: New test.
libgomp/
* libgomp_g.h (GOMP_taskwait_depend_nowait): Declare.
* libgomp.map (GOMP_taskwait_depend_nowait): Export at GOMP_5.1.1.
* task.c (empty_task): New function.
(gomp_task_run_post_handle_depend_hash): Declare earlier.
(gomp_task_run_post_handle_depend): Declare.
(GOMP_task): Optimize fn == empty_task if there is nothing to wait
for.
(gomp_task_run_post_handle_dependers): Optimize task->fn == empty_task.
(GOMP_taskwait_depend_nowait): New function.
* testsuite/libgomp.c-c++-common/taskwait-depend-nowait-1.c: New test.
gcc/c/c-parser.cc
gcc/cp/parser.cc
gcc/gimplify.cc
gcc/omp-builtins.def
gcc/omp-expand.cc
gcc/testsuite/c-c++-common/gomp/taskwait-depend-nowait-1.c [new file with mode: 0644]
libgomp/libgomp.map
libgomp/libgomp_g.h
libgomp/task.c
libgomp/testsuite/libgomp.c-c++-common/taskwait-depend-nowait-1.c [new file with mode: 0644]