diff --git a/openmp/runtime/src/kmp_tasking.cpp b/openmp/runtime/src/kmp_tasking.cpp --- a/openmp/runtime/src/kmp_tasking.cpp +++ b/openmp/runtime/src/kmp_tasking.cpp @@ -938,9 +938,18 @@ // Only need to keep track of count if team parallel and tasking not // serialized, or task is detachable and event has already been fulfilled - if (!(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser) || - taskdata->td_flags.detachable == TASK_DETACHABLE || - taskdata->td_flags.hidden_helper) { + bool track_children = + !(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser); + track_children = track_children || + taskdata->td_flags.detachable == TASK_DETACHABLE || + taskdata->td_flags.hidden_helper; + if (thread->th.th_task_team) + track_children = + track_children || + thread->th.th_task_team->tt.tt_hidden_helper_task_encountered || + thread->th.th_task_team->tt.tt_found_proxy_tasks; + + if (track_children) { __kmp_release_deps(gtid, taskdata); // Predecrement simulated by "- 1" calculation #if KMP_DEBUG @@ -1378,11 +1387,18 @@ if (UNLIKELY(ompt_enabled.enabled)) __ompt_task_init(taskdata, gtid); #endif + bool track_children = + !(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser); + track_children = track_children || flags->proxy == TASK_PROXY || + flags->detachable == TASK_DETACHABLE || flags->hidden_helper; + if (thread->th.th_task_team) + track_children = + track_children || + thread->th.th_task_team->tt.tt_hidden_helper_task_encountered || + thread->th.th_task_team->tt.tt_found_proxy_tasks; // Only need to keep track of child task counts if team parallel and tasking // not serialized or if it is a proxy or detachable or hidden helper task - if (flags->proxy == TASK_PROXY || flags->detachable == TASK_DETACHABLE || - flags->hidden_helper || - !(taskdata->td_flags.team_serial || taskdata->td_flags.tasking_ser)) { + if (track_children) { KMP_ATOMIC_INC(&parent_task->td_incomplete_child_tasks); if (parent_task->td_taskgroup) KMP_ATOMIC_INC(&parent_task->td_taskgroup->count); diff --git a/openmp/runtime/test/tasking/hidden_helper_task/depend.cpp b/openmp/runtime/test/tasking/hidden_helper_task/depend.cpp --- a/openmp/runtime/test/tasking/hidden_helper_task/depend.cpp +++ b/openmp/runtime/test/tasking/hidden_helper_task/depend.cpp @@ -1,4 +1,5 @@ // RUN: %libomp-cxx-compile-and-run +// RUN: %libomp-cxx-compile && env OMP_NUM_THREADS=1 %libomp-run /* * This test aims to check whether hidden helper task can work with regular task diff --git a/openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp b/openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp --- a/openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp +++ b/openmp/runtime/test/tasking/hidden_helper_task/gtid.cpp @@ -1,4 +1,5 @@ // RUN: %libomp-cxx-compile-and-run +// RUN: %libomp-cxx-compile && env OMP_NUM_THREADS=1 %libomp-run /* * This test aims to check whether hidden helper thread has right gtid. We also