[Openmp-commits] [PATCH] D77603: [OpenMP] Sync writes to child thread's data before reduction
Bryan Chan via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Apr 13 03:44:22 PDT 2020
bryanpkc updated this revision to Diff 256954.
bryanpkc added a comment.
Add a paired memory barrier to the child thread's path after it finishes writing to its own data and before releasing the parent thread.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77603/new/
https://reviews.llvm.org/D77603
Files:
openmp/runtime/src/kmp_barrier.cpp
Index: openmp/runtime/src/kmp_barrier.cpp
===================================================================
--- openmp/runtime/src/kmp_barrier.cpp
+++ openmp/runtime/src/kmp_barrier.cpp
@@ -538,6 +538,8 @@
__itt_get_timestamp();
}
#endif
+ KMP_MB(); // Synchronize writes to child threads.
+
/* Perform a hypercube-embedded tree gather to wait until all of the threads
have arrived, and reduce any required data as we go. */
kmp_flag_64 p_flag(&thr_bar->b_arrived);
@@ -589,6 +591,7 @@
// Wait for child to arrive
kmp_flag_64 c_flag(&child_bar->b_arrived, new_state);
c_flag.wait(this_thr, FALSE USE_ITT_BUILD_ARG(itt_sync_obj));
+ KMP_MB(); // Synchronize writes to child threads.
ANNOTATE_BARRIER_END(child_thr);
#if USE_ITT_BUILD && USE_ITT_NOTIFY
// Barrier imbalance - write min of the thread time and a child time to
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77603.256954.patch
Type: text/x-patch
Size: 893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200413/69312461/attachment.bin>
More information about the Openmp-commits
mailing list