]> git.ipfire.org Git - thirdparty/gcc.git/commit
openmp: Fix intermittent hanging of task-detach-6 libgomp tests [PR98738]
authorKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 21 Jan 2021 13:38:47 +0000 (05:38 -0800)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Fri, 22 Jan 2021 17:01:39 +0000 (09:01 -0800)
commitffd581af1d2228bc7c5f5f84e1b6fe42e49cdda2
tree5df3ec8319d7088d3eb8dd359808a764081c72c7
parent7a7702433921e4451d2618bb398436c58443e744
openmp: Fix intermittent hanging of task-detach-6 libgomp tests [PR98738]

This adds support for the task detach clause to taskwait, and fixes a
number of problems related to semaphores that may lead to a hang in
some circumstances.

2021-01-21  Kwok Cheung Yeung  <kcy@codesourcery.com>

libgomp/

PR libgomp/98738
* libgomp.h (enum gomp_task_kind): Add GOMP_TASK_DETACHED.
* task.c (task_fulfilled_p): Check detach field as well.
(GOMP_task): Add thread to debug messages.  Use address of task as
the event handle.
(gomp_barrier_handle_tasks): Fix indentation.  Use address of task
as event handle. Set kind of suspended detach task to
GOMP_TASK_DETACHED and decrement task_running_count.  Move
finish_cancelled block out of else branch.  Skip decrement of
task_running_count if task kind is GOMP_TASK_DETACHED.
(GOMP_taskwait): Finish fulfilled detach tasks.  Update comment.
Queue detach tasks that have not been fulfilled.
(omp_fulfill_event): Use address of task as event handle.  Post
to taskwait_sem and taskgroup_sem if necessary.  Check
task_running_count before calling gomp_team_barrier_wake.
* testsuite/libgomp.c-c++-common/task-detach-5.c (main): Change
data-sharing of detach events on enclosing parallel to private.
* testsuite/libgomp.c-c++-common/task-detach-6.c (main): Likewise.
* testsuite/libgomp.fortran/task-detach-5.f90 (task_detach_5):
Likewise.
* testsuite/libgomp.fortran/task-detach-6.f90 (task_detach_6):
Likewise.
libgomp/ChangeLog.omp
libgomp/libgomp.h
libgomp/task.c
libgomp/testsuite/libgomp.c-c++-common/task-detach-5.c
libgomp/testsuite/libgomp.c-c++-common/task-detach-6.c
libgomp/testsuite/libgomp.fortran/task-detach-5.f90
libgomp/testsuite/libgomp.fortran/task-detach-6.f90