[Openmp-commits] [PATCH] D80480: [OpenMP] Fix a race in task queue reallocation
Joachim Protze via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon May 25 01:34:22 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3895148d7cd8: [OpenMP] Fix a race in task queue reallocation (authored by protze.joachim).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80480/new/
https://reviews.llvm.org/D80480
Files:
openmp/runtime/src/kmp_tasking.cpp
Index: openmp/runtime/src/kmp_tasking.cpp
===================================================================
--- openmp/runtime/src/kmp_tasking.cpp
+++ openmp/runtime/src/kmp_tasking.cpp
@@ -298,6 +298,7 @@
static void __kmp_realloc_task_deque(kmp_info_t *thread,
kmp_thread_data_t *thread_data) {
kmp_int32 size = TASK_DEQUE_SIZE(thread_data->td);
+ KMP_DEBUG_ASSERT(TCR_4(thread_data->td.td_deque_ntasks) == size);
kmp_int32 new_size = 2 * size;
KE_TRACE(10, ("__kmp_realloc_task_deque: T#%d reallocating deque[from %d to "
@@ -381,8 +382,11 @@
} else {
__kmp_acquire_bootstrap_lock(&thread_data->td.td_deque_lock);
locked = 1;
- // expand deque to push the task which is not allowed to execute
- __kmp_realloc_task_deque(thread, thread_data);
+ if (TCR_4(thread_data->td.td_deque_ntasks) >=
+ TASK_DEQUE_SIZE(thread_data->td)) {
+ // expand deque to push the task which is not allowed to execute
+ __kmp_realloc_task_deque(thread, thread_data);
+ }
}
}
// Lock the deque for the task push operation
@@ -3659,7 +3663,11 @@
return result;
__kmp_acquire_bootstrap_lock(&thread_data->td.td_deque_lock);
- __kmp_realloc_task_deque(thread, thread_data);
+ if (TCR_4(thread_data->td.td_deque_ntasks) >=
+ TASK_DEQUE_SIZE(thread_data->td)) {
+ // expand deque to push the task which is not allowed to execute
+ __kmp_realloc_task_deque(thread, thread_data);
+ }
} else {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80480.265976.patch
Type: text/x-patch
Size: 1538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200525/12af837c/attachment.bin>
More information about the Openmp-commits
mailing list