aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
diff options
context:
space:
mode:
authorShilei Tian <tianshilei1992@gmail.com>2021-07-23 16:53:56 -0400
committerShilei Tian <tianshilei1992@gmail.com>2021-07-23 16:54:11 -0400
commitc2c43132f69c6f7e89d97c0c2ce32b0cf2f30e90 (patch)
tree67a2dace0d113f11ee7d989969c6cc0421ceac94 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
parente1dedecaa6f83223efde5e0bf98a8f070aa5d6a5 (diff)
downloadllvm-c2c43132f69c6f7e89d97c0c2ce32b0cf2f30e90.zip
llvm-c2c43132f69c6f7e89d97c0c2ce32b0cf2f30e90.tar.gz
llvm-c2c43132f69c6f7e89d97c0c2ce32b0cf2f30e90.tar.bz2
[OpenMP] Fix bug 50022
Bug 50022 [0] reports target nowait fails in certain case, which is added in this patch. The root cause of the failure is, when the second task is created, its parent's `td_incomplete_child_tasks` will not be incremented because there is no parallel region here thus its team is serialized. Therefore, when the initial thread is waiting for its unfinished children tasks, it thought there is only one, the first task, because it is hidden helper task, so it is tracked. The second task will only be pushed to the queue when the first task is finished. However, when the first task finishes, it first decrements the counter of its parent, and then release dependences. Once the counter is decremented, the thread will move on because its counter is reset, but actually, the second task has not been executed at all. As a result, since in this case, the main function finishes, then `libomp` starts to destroy. When the second task is pushed somewhere, all some of the structures might already have already been destroyed, then anything could happen. This patch simply moves `__kmp_release_deps` ahead of decrement of the counter. In this way, we can make sure that the initial thread is aware of the existence of another task(s) so it will not move on. In addition, in order to tackle dependence chain starting with hidden helper thread, when hidden helper task is encountered, we force the task to release dependences. Reference: [0] https://bugs.llvm.org/show_bug.cgi?id=50022 Reviewed By: AndreyChurbanov Differential Revision: https://reviews.llvm.org/D106519
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
0 files changed, 0 insertions, 0 deletions