[Openmp-commits] [PATCH] D100366: [OpenMP] [OMPD] openmp/runtime code changes required for OMPD
Vignesh Balasubramanian via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Apr 13 01:20:06 PDT 2021
Vigneshbalu created this revision.
Herald added subscribers: guansong, yaxunl.
Vigneshbalu requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.
This patch stems from “ompd-test” branch PRs https://github.com/OpenMPToolsInterface/llvm-project/commit/45e69d3a5fc27af7bf92ed5310987eb25070e538 and https://github.com/OpenMPToolsInterface/llvm-project/commit/e25e8f48b3573845f7a342ca02be3a5b3fac6090
These changes don't come under OMPD guard as it is a movement of existing code to capture parallel behavior correctly.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D100366
Files:
openmp/runtime/src/kmp_csupport.cpp
openmp/runtime/src/ompt-specific.cpp
Index: openmp/runtime/src/ompt-specific.cpp
===================================================================
--- openmp/runtime/src/ompt-specific.cpp
+++ openmp/runtime/src/ompt-specific.cpp
@@ -283,10 +283,6 @@
link_lwt->ompt_team_info = *OMPT_CUR_TEAM_INFO(thr);
*OMPT_CUR_TEAM_INFO(thr) = tmp_team;
- ompt_task_info_t tmp_task = lwt->ompt_task_info;
- link_lwt->ompt_task_info = *OMPT_CUR_TASK_INFO(thr);
- *OMPT_CUR_TASK_INFO(thr) = tmp_task;
-
// link the taskteam into the list of taskteams:
ompt_lw_taskteam_t *my_parent =
thr->th.th_team->t.ompt_serialized_team_info;
@@ -297,6 +293,10 @@
ompd_bp_parallel_begin();
}
#endif
+
+ ompt_task_info_t tmp_task = lwt->ompt_task_info;
+ link_lwt->ompt_task_info = *OMPT_CUR_TASK_INFO(thr);
+ *OMPT_CUR_TASK_INFO(thr) = tmp_task;
} else {
// this is the first serialized team, so we just store the values in the
// team and drop the taskteam-object
@@ -313,6 +313,9 @@
void __ompt_lw_taskteam_unlink(kmp_info_t *thr) {
ompt_lw_taskteam_t *lwtask = thr->th.th_team->t.ompt_serialized_team_info;
if (lwtask) {
+ ompt_task_info_t tmp_task = lwtask->ompt_task_info;
+ lwtask->ompt_task_info = *OMPT_CUR_TASK_INFO(thr);
+ *OMPT_CUR_TASK_INFO(thr) = tmp_task;
#if OMPD_SUPPORT
if (ompd_state & OMPD_ENABLE_BP) {
ompd_bp_parallel_end();
@@ -324,10 +327,6 @@
lwtask->ompt_team_info = *OMPT_CUR_TEAM_INFO(thr);
*OMPT_CUR_TEAM_INFO(thr) = tmp_team;
- ompt_task_info_t tmp_task = lwtask->ompt_task_info;
- lwtask->ompt_task_info = *OMPT_CUR_TASK_INFO(thr);
- *OMPT_CUR_TASK_INFO(thr) = tmp_task;
-
if (lwtask->heap) {
__kmp_free(lwtask);
lwtask = NULL;
@@ -380,7 +379,8 @@
// lightweight teams are exhausted
if (!lwt && taskdata) {
// first try scheduling parent (for explicit task scheduling)
- if (taskdata->ompt_task_info.scheduling_parent) {
+ if (taskdata->td_flags.tasktype == TASK_EXPLICIT &&
+ taskdata->ompt_task_info.scheduling_parent) {
taskdata = taskdata->ompt_task_info.scheduling_parent;
} else if (next_lwt) {
lwt = next_lwt;
Index: openmp/runtime/src/kmp_csupport.cpp
===================================================================
--- openmp/runtime/src/kmp_csupport.cpp
+++ openmp/runtime/src/kmp_csupport.cpp
@@ -577,9 +577,6 @@
__kmp_free(top);
}
- // if( serial_team -> t.t_serialized > 1 )
- serial_team->t.t_level--;
-
/* pop dispatch buffers stack */
KMP_DEBUG_ASSERT(serial_team->t.t_dispatch->th_disp_buffer);
{
@@ -604,6 +601,7 @@
}
#endif /* KMP_ARCH_X86 || KMP_ARCH_X86_64 */
+ __kmp_pop_current_task_from_thread(this_thr);
#if OMPD_SUPPORT
if (ompd_state & OMPD_ENABLE_BP)
ompd_bp_parallel_end();
@@ -622,8 +620,6 @@
this_thr->th.th_dispatch =
&this_thr->th.th_team->t.t_dispatch[serial_team->t.t_master_tid];
- __kmp_pop_current_task_from_thread(this_thr);
-
KMP_ASSERT(this_thr->th.th_current_task->td_flags.executing == 0);
this_thr->th.th_current_task->td_flags.executing = 1;
@@ -644,6 +640,7 @@
}
}
+ serial_team->t.t_level--;
if (__kmp_env_consistency_check)
__kmp_pop_parallel(global_tid, NULL);
#if OMPT_SUPPORT
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100366.337059.patch
Type: text/x-patch
Size: 3316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210413/a64e8fb9/attachment.bin>
More information about the Openmp-commits
mailing list