[Openmp-commits] [openmp] [OpenMP] Fix work-stealing stack clobber with taskwait (PR #126049)
Julian Brown via Openmp-commits
openmp-commits at lists.llvm.org
Thu Feb 6 09:48:14 PST 2025
jtb20 wrote:
> > If you run into issues at this part of the code, not the depnode on the stack is the issue, but somewhere else in the code is causing an error with the reference counting.
>
> That is exactly what I think after a second thought. If allocating stack memory for later task can overwrite the existing stack, that is definitely wrong, and a stack corruption.
Everything works fine if task stealing is forcibly disabled. The problem is that two different threads can access the same depnode, and hence the same refcounts -- that makes things go haywire. Quite rarely, but still.
One giveaway is that __kmp_node_deref sometimes tries to free a stack-allocated depnode. That happens because two different threads can be executing __kmp_release_deps at the same time, pointing at the same depnode on what is supposed to be one of the threads' local stack.
I can try to paste more debug logs from my investigation if that would be helpful, but they're not easy to follow...
https://github.com/llvm/llvm-project/pull/126049
More information about the Openmp-commits
mailing list