[Openmp-commits] [openmp] r331632 - [OMPT] Fix thread_num for implicit_task_end callbacks in nested parallel regions
Joachim Protze via Openmp-commits
openmp-commits at lists.llvm.org
Mon May 7 05:42:21 PDT 2018
Author: jprotze
Date: Mon May 7 05:42:21 2018
New Revision: 331632
URL: http://llvm.org/viewvc/llvm-project?rev=331632&view=rev
Log:
[OMPT] Fix thread_num for implicit_task_end callbacks in nested parallel regions
implicit_task_end callbacks in nested parallel regions did not always give the
correct thread_num, since the inner parallel region may have already been
finalized.
Now, the thread_num is stored at the beginning of the implicit task and
retrieved at the end, whenever necessary.
A testcase was added as well.
Differential Revision: https://reviews.llvm.org/D46260
Modified:
openmp/trunk/runtime/src/kmp_csupport.cpp
openmp/trunk/runtime/src/kmp_gsupport.cpp
openmp/trunk/runtime/src/kmp_runtime.cpp
openmp/trunk/runtime/src/ompt-internal.h
Modified: openmp/trunk/runtime/src/kmp_csupport.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_csupport.cpp?rev=331632&r1=331631&r2=331632&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_csupport.cpp (original)
+++ openmp/trunk/runtime/src/kmp_csupport.cpp Mon May 7 05:42:21 2018
@@ -486,7 +486,7 @@ void __kmpc_end_serialized_parallel(iden
if (ompt_enabled.ompt_callback_implicit_task) {
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_end, NULL, OMPT_CUR_TASK_DATA(this_thr), 1,
- __kmp_tid_from_gtid(global_tid));
+ OMPT_CUR_TASK_INFO(this_thr)->thread_num);
}
// reset clear the task id only after unlinking the task
Modified: openmp/trunk/runtime/src/kmp_gsupport.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_gsupport.cpp?rev=331632&r1=331631&r2=331632&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_gsupport.cpp (original)
+++ openmp/trunk/runtime/src/kmp_gsupport.cpp Mon May 7 05:42:21 2018
@@ -401,6 +401,7 @@ static
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_begin, &(team_info->parallel_data),
&(task_info->task_data), ompt_team_size, __kmp_tid_from_gtid(gtid));
+ task_info->thread_num = __kmp_tid_from_gtid(gtid);
}
thr->th.ompt_thread_info.state = omp_state_work_parallel;
}
Modified: openmp/trunk/runtime/src/kmp_runtime.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.cpp?rev=331632&r1=331631&r2=331632&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.cpp (original)
+++ openmp/trunk/runtime/src/kmp_runtime.cpp Mon May 7 05:42:21 2018
@@ -1386,6 +1386,8 @@ void __kmp_serialized_parallel(ident_t *
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_begin, OMPT_CUR_TEAM_DATA(this_thr),
OMPT_CUR_TASK_DATA(this_thr), 1, __kmp_tid_from_gtid(global_tid));
+ OMPT_CUR_TASK_INFO(this_thr)
+ ->thread_num = __kmp_tid_from_gtid(global_tid);
}
/* OMPT state */
@@ -1551,6 +1553,8 @@ int __kmp_fork_call(ident_t *loc, int gt
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
implicit_task_data, 1, __kmp_tid_from_gtid(gtid));
+ OMPT_CUR_TASK_INFO(master_th)
+ ->thread_num = __kmp_tid_from_gtid(gtid);
}
/* OMPT state */
@@ -1578,7 +1582,7 @@ int __kmp_fork_call(ident_t *loc, int gt
if (ompt_enabled.ompt_callback_implicit_task) {
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_end, NULL, implicit_task_data, 1,
- __kmp_tid_from_gtid(gtid));
+ OMPT_CUR_TASK_INFO(master_th)->thread_num);
}
__ompt_lw_taskteam_unlink(master_th);
@@ -1762,6 +1766,8 @@ int __kmp_fork_call(ident_t *loc, int gt
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
&(task_info->task_data), 1, __kmp_tid_from_gtid(gtid));
+ OMPT_CUR_TASK_INFO(master_th)
+ ->thread_num = __kmp_tid_from_gtid(gtid);
}
/* OMPT state */
@@ -1789,7 +1795,7 @@ int __kmp_fork_call(ident_t *loc, int gt
if (ompt_enabled.ompt_callback_implicit_task) {
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_end, NULL, &(task_info->task_data), 1,
- __kmp_tid_from_gtid(gtid));
+ OMPT_CUR_TASK_INFO(master_th)->thread_num);
}
__ompt_lw_taskteam_unlink(master_th);
@@ -1865,6 +1871,8 @@ int __kmp_fork_call(ident_t *loc, int gt
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th),
implicit_task_data, 1, __kmp_tid_from_gtid(gtid));
+ OMPT_CUR_TASK_INFO(master_th)
+ ->thread_num = __kmp_tid_from_gtid(gtid);
}
/* OMPT state */
@@ -1891,7 +1899,7 @@ int __kmp_fork_call(ident_t *loc, int gt
if (ompt_enabled.ompt_callback_implicit_task) {
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_end, NULL, &(task_info->task_data), 1,
- __kmp_tid_from_gtid(gtid));
+ OMPT_CUR_TASK_INFO(master_th)->thread_num);
}
ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th);
@@ -2494,7 +2502,7 @@ void __kmp_join_call(ident_t *loc, int g
int ompt_team_size = team->t.t_nproc;
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_end, NULL, &(task_info->task_data), ompt_team_size,
- __kmp_tid_from_gtid(gtid));
+ OMPT_CUR_TASK_INFO(master_th)->thread_num);
}
task_info->frame.exit_frame = NULL;
@@ -6919,6 +6927,7 @@ int __kmp_invoke_task_func(int gtid) {
ompt_callbacks.ompt_callback(ompt_callback_implicit_task)(
ompt_scope_begin, my_parallel_data, my_task_data, ompt_team_size,
__kmp_tid_from_gtid(gtid));
+ OMPT_CUR_TASK_INFO(this_thr)->thread_num = __kmp_tid_from_gtid(gtid);
}
#endif
Modified: openmp/trunk/runtime/src/ompt-internal.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/ompt-internal.h?rev=331632&r1=331631&r2=331632&view=diff
==============================================================================
--- openmp/trunk/runtime/src/ompt-internal.h (original)
+++ openmp/trunk/runtime/src/ompt-internal.h Mon May 7 05:42:21 2018
@@ -56,6 +56,7 @@ typedef struct {
ompt_frame_t frame;
ompt_data_t task_data;
struct kmp_taskdata *scheduling_parent;
+ int thread_num;
#if OMP_40_ENABLED
int ndeps;
ompt_task_dependence_t *deps;
More information about the Openmp-commits
mailing list