[Openmp-commits] [PATCH] D79702: [OpenMP] Fix race condition in the completion/freeing of detached tasks

Joachim Protze via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon May 11 02:38:55 PDT 2020


protze.joachim created this revision.
protze.joachim added reviewers: AndreyChurbanov, hbae, tlwilmar.
protze.joachim added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
Herald added a reviewer: jdoerfert.

Spurious assertion failures are symptoms of a race condition for the handling of detached tasks:
Assertion failure at kmp_tasking.cpp(3744): taskdata->td_flags.complete == 1.
Assertion failure at kmp_tasking.cpp(710): taskdata->td_flags.executing == 0.

in the case of detach=true, all accesses to taskdata in __kmp_task_finish need to happen before (~line 873):

taskdata->td_flags.proxy = TASK_PROXY;

This assignment signals to __kmp_fulfill_event, that the task will need to be freed there. So, conceptionally the ownership of taskdata is moved.

Is it safe to move the call to the destructors up in the code?
Do we need to acquire the lock in __kmp_fulfill_event to make sure the lock is released in __kmp_task_finish, before taskdata is freed?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79702

Files:
  openmp/runtime/src/kmp_tasking.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79702.263122.patch
Type: text/x-patch
Size: 5156 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200511/65aeac12/attachment.bin>


More information about the Openmp-commits mailing list