llvm-project
9e8e6a06 - [OpenMP][libomp] Ensure memory barrier before publishing dn.task = NULL (#240070)

Commit
1 day ago
[OpenMP][libomp] Ensure memory barrier before publishing dn.task = NULL (#240070) Fixes #237247 On weakly ordered architectures like AArch64, the lock acquire in KMP_ACQUIRE_DEPNODE does not prevent prior memory writes from the task body from floating past it. When dn.task = NULL is written, another thread reading dn.task without locks in __kmp_depnode_link_successor() can observe NULL before all stores from the predecessor task have committed, causing dependent tasks to read stale memory. Insert KMP_MB() before KMP_ACQUIRE_DEPNODE in __kmp_release_deps() to ensure task body memory writes are visible before the task is marked finished. Fixes #237247 Tool disclosure: The patch and unit tests were authored manually; Google Antigravity was used to review the diff, run local tests, and write this PR description.
Author
Parents
Loading