]> git.ipfire.org Git - thirdparty/gcc.git/commit
openmp: Add taskwait nowait depend support [PR105378]
authorJakub Jelinek <jakub@redhat.com>
Tue, 5 Jul 2022 07:11:46 +0000 (09:11 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Tue, 5 Jul 2022 07:17:18 +0000 (09:17 +0200)
commita25ddca52deba998c1ac6962a690f6ecca6a1ddb
treeff8449a7176f959cd18e83a4c9dbf7b817c17d9d
parent9bde4b46eb0f812cdd322e0dde78b4454d3c05ec
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.

(cherry picked from commit b43836914bdc2a37563cf31359b2c4803bfe4374)
15 files changed:
gcc/ChangeLog.omp
gcc/c/ChangeLog.omp
gcc/c/c-parser.cc
gcc/cp/ChangeLog.omp
gcc/cp/parser.cc
gcc/gimplify.cc
gcc/omp-builtins.def
gcc/omp-expand.cc
gcc/testsuite/ChangeLog.omp
gcc/testsuite/c-c++-common/gomp/taskwait-depend-nowait-1.c [new file with mode: 0644]
libgomp/ChangeLog.omp
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]