[Openmp-commits] [PATCH] D107316: [OpenMP] Add missing `tt_hidden_helper_task_encountered` along with `tt_found_proxy_tasks`
Shilei Tian via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Mon Aug 2 16:06:54 PDT 2021
tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, AndreyChurbanov, protze.joachim.
Herald added subscribers: guansong, yaxunl.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.
In most cases, hidden helper task behave similar as detached tasks. That means,
for example, if we have to wait for detached tasks, we have to do the same thing
for hidden helper tasks as well. This patch adds the missing condition for hidden
helper task accordingly along with detached task.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107316
Files:
openmp/runtime/src/kmp_barrier.cpp
openmp/runtime/src/kmp_csupport.cpp
openmp/runtime/src/kmp_runtime.cpp
openmp/runtime/src/kmp_taskdeps.cpp
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
@@ -3470,6 +3470,7 @@
TCW_4(task_team->tt.tt_found_tasks, FALSE);
TCW_4(task_team->tt.tt_found_proxy_tasks, FALSE);
+ TCW_4(task_team->tt.tt_hidden_helper_task_encountered, FALSE);
task_team->tt.tt_nproc = nthreads = team->t.t_nproc;
KMP_ATOMIC_ST_REL(&task_team->tt.tt_unfinished_threads, nthreads);
@@ -3632,6 +3633,7 @@
TCW_4(task_team->tt.tt_nproc, team->t.t_nproc);
TCW_4(task_team->tt.tt_found_tasks, FALSE);
TCW_4(task_team->tt.tt_found_proxy_tasks, FALSE);
+ TCW_4(task_team->tt.tt_hidden_helper_task_encountered, FALSE);
KMP_ATOMIC_ST_REL(&task_team->tt.tt_unfinished_threads,
team->t.t_nproc);
TCW_4(task_team->tt.tt_active, TRUE);
@@ -3724,8 +3726,10 @@
"setting active to false, setting local and team's pointer to NULL\n",
__kmp_gtid_from_thread(this_thr), task_team));
KMP_DEBUG_ASSERT(task_team->tt.tt_nproc > 1 ||
- task_team->tt.tt_found_proxy_tasks == TRUE);
+ task_team->tt.tt_found_proxy_tasks == TRUE ||
+ task_team->tt.tt_hidden_helper_task_encountered == TRUE);
TCW_SYNC_4(task_team->tt.tt_found_proxy_tasks, FALSE);
+ TCW_SYNC_4(task_team->tt.tt_hidden_helper_task_encountered, FALSE);
KMP_CHECK_UPDATE(task_team->tt.tt_untied_task_encountered, 0);
TCW_SYNC_4(task_team->tt.tt_active, FALSE);
KMP_MB();
Index: openmp/runtime/src/kmp_taskdeps.cpp
===================================================================
--- openmp/runtime/src/kmp_taskdeps.cpp
+++ openmp/runtime/src/kmp_taskdeps.cpp
@@ -740,8 +740,10 @@
bool ignore = current_task->td_flags.team_serial ||
current_task->td_flags.tasking_ser ||
current_task->td_flags.final;
- ignore = ignore && thread->th.th_task_team != NULL &&
- thread->th.th_task_team->tt.tt_found_proxy_tasks == FALSE;
+ ignore =
+ ignore && thread->th.th_task_team != NULL &&
+ thread->th.th_task_team->tt.tt_found_proxy_tasks == FALSE &&
+ thread->th.th_task_team->tt.tt_hidden_helper_task_encountered == FALSE;
ignore = ignore || current_task->td_dephash == NULL;
if (ignore) {
Index: openmp/runtime/src/kmp_runtime.cpp
===================================================================
--- openmp/runtime/src/kmp_runtime.cpp
+++ openmp/runtime/src/kmp_runtime.cpp
@@ -4050,7 +4050,8 @@
kmp_task_team_t *task_team = thread->th.th_task_team;
// we need to wait for the proxy tasks before finishing the thread
- if (task_team != NULL && task_team->tt.tt_found_proxy_tasks) {
+ if (task_team != NULL && (task_team->tt.tt_found_proxy_tasks ||
+ task_team->tt.tt_hidden_helper_task_encountered)) {
#if OMPT_SUPPORT
// the runtime is shutting down so we won't report any events
thread->th.ompt_thread_info.state = ompt_state_undefined;
Index: openmp/runtime/src/kmp_csupport.cpp
===================================================================
--- openmp/runtime/src/kmp_csupport.cpp
+++ openmp/runtime/src/kmp_csupport.cpp
@@ -533,7 +533,8 @@
kmp_task_team_t *task_team = this_thr->th.th_task_team;
// we need to wait for the proxy tasks before finishing the thread
- if (task_team != NULL && task_team->tt.tt_found_proxy_tasks)
+ if (task_team != NULL && (task_team->tt.tt_found_proxy_tasks ||
+ task_team->tt.tt_hidden_helper_task_encountered))
__kmp_task_team_wait(this_thr, serial_team USE_ITT_BUILD_ARG(NULL));
KMP_MB();
Index: openmp/runtime/src/kmp_barrier.cpp
===================================================================
--- openmp/runtime/src/kmp_barrier.cpp
+++ openmp/runtime/src/kmp_barrier.cpp
@@ -2037,8 +2037,10 @@
}
#endif
- KMP_DEBUG_ASSERT(this_thr->th.th_task_team->tt.tt_found_proxy_tasks ==
- TRUE);
+ KMP_DEBUG_ASSERT(
+ this_thr->th.th_task_team->tt.tt_found_proxy_tasks == TRUE ||
+ this_thr->th.th_task_team->tt.tt_hidden_helper_task_encountered ==
+ TRUE);
__kmp_task_team_wait(this_thr, team USE_ITT_BUILD_ARG(itt_sync_obj));
__kmp_task_team_setup(this_thr, team, 0);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107316.363597.patch
Type: text/x-patch
Size: 4427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210802/50481b52/attachment-0001.bin>
More information about the Openmp-commits
mailing list