diff options
author | Joachim Protze <protze@itc.rwth-aachen.de> | 2018-05-07 12:42:21 +0000 |
---|---|---|
committer | Joachim Protze <protze@itc.rwth-aachen.de> | 2018-05-07 12:42:21 +0000 |
commit | 9be9cf20bf81b48bbb08b9d324beabd6a7785889 (patch) | |
tree | b36ef2ac906f38c6ed1dd0f731151a6e532386ff /openmp | |
parent | 8fc39f6b19a98838b590462a3d37cebc060c6796 (diff) | |
download | bcm5719-llvm-9be9cf20bf81b48bbb08b9d324beabd6a7785889.tar.gz bcm5719-llvm-9be9cf20bf81b48bbb08b9d324beabd6a7785889.zip |
[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
llvm-svn: 331632
Diffstat (limited to 'openmp')
-rw-r--r-- | openmp/runtime/src/kmp_csupport.cpp | 2 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_gsupport.cpp | 1 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_runtime.cpp | 17 | ||||
-rw-r--r-- | openmp/runtime/src/ompt-internal.h | 1 |
4 files changed, 16 insertions, 5 deletions
diff --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp index 61a8c89fdf1..6bbae57ea71 100644 --- a/openmp/runtime/src/kmp_csupport.cpp +++ b/openmp/runtime/src/kmp_csupport.cpp @@ -486,7 +486,7 @@ void __kmpc_end_serialized_parallel(ident_t *loc, kmp_int32 global_tid) { 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 diff --git a/openmp/runtime/src/kmp_gsupport.cpp b/openmp/runtime/src/kmp_gsupport.cpp index b1923e307e1..be645e21d3c 100644 --- a/openmp/runtime/src/kmp_gsupport.cpp +++ b/openmp/runtime/src/kmp_gsupport.cpp @@ -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; } diff --git a/openmp/runtime/src/kmp_runtime.cpp b/openmp/runtime/src/kmp_runtime.cpp index 0e9619028ea..c4e2579e0b9 100644 --- a/openmp/runtime/src/kmp_runtime.cpp +++ b/openmp/runtime/src/kmp_runtime.cpp @@ -1386,6 +1386,8 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 global_tid) { 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 gtid, 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 gtid, 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 gtid, 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 gtid, 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 gtid, 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 gtid, 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 gtid 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 diff --git a/openmp/runtime/src/ompt-internal.h b/openmp/runtime/src/ompt-internal.h index 73132177fea..6b44a06eb6c 100644 --- a/openmp/runtime/src/ompt-internal.h +++ b/openmp/runtime/src/ompt-internal.h @@ -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; |