[Openmp-commits] [openmp] r258866 - [OMPT]: Fix the order of implicit_task_end_events
Jonathan Peyton via Openmp-commits
openmp-commits at lists.llvm.org
Tue Jan 26 13:45:21 PST 2016
Author: jlpeyton
Date: Tue Jan 26 15:45:21 2016
New Revision: 258866
URL: http://llvm.org/viewvc/llvm-project?rev=258866&view=rev
Log:
[OMPT]: Fix the order of implicit_task_end_events
For implcit barriers in simple parallel for loops, the order of the OMPT events
was wrong. The barrier_{begin,end} events came after the implcit_task_end
event for the implcit barrier at the end of the parallel region. This is wrong
because the implicit task executes the barrier before ending. This patch fixes
the order of the event: It will be triggerd now just before
__kmp_pop_current_task_from_thread() is called.
Patch by Tim Cramer
Differential Revision: http://reviews.llvm.org/D16347
Modified:
openmp/trunk/runtime/src/kmp_runtime.c
Modified: openmp/trunk/runtime/src/kmp_runtime.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.c?rev=258866&r1=258865&r2=258866&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c (original)
+++ openmp/trunk/runtime/src/kmp_runtime.c Tue Jan 26 15:45:21 2016
@@ -2475,6 +2475,18 @@ __kmp_join_call(ident_t *loc, int gtid
}
KMP_DEBUG_ASSERT( root->r.r_in_parallel >= 0 );
+#if OMPT_SUPPORT && OMPT_TRACE
+ if(ompt_enabled){
+ ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
+ if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
+ ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
+ parallel_id, task_info->task_id);
+ }
+ task_info->frame.exit_runtime_frame = 0;
+ task_info->task_id = 0;
+ }
+#endif
+
KF_TRACE( 10, ("__kmp_join_call1: T#%d, this_thread=%p team=%p\n",
0, master_th, team ) );
__kmp_pop_current_task_from_thread( master_th );
@@ -5504,6 +5516,12 @@ __kmp_launch_thread( kmp_info_t *this_th
/* have we been allocated? */
if ( TCR_SYNC_PTR(*pteam) && !TCR_4(__kmp_global.g.g_done) ) {
+#if OMPT_SUPPORT
+ ompt_task_info_t *task_info;
+ if (ompt_enabled) {
+ task_info = __ompt_get_taskinfo(0);
+ }
+#endif
/* we were just woken up, so run our new task */
if ( TCR_SYNC_PTR((*pteam)->t.t_pkfn) != NULL ) {
int rc;
@@ -5517,8 +5535,7 @@ __kmp_launch_thread( kmp_info_t *this_th
this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
// Initialize OMPT task id for implicit task.
int tid = __kmp_tid_from_gtid(gtid);
- (*pteam)->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id =
- __ompt_task_id_new(tid);
+ task_info->task_id = __ompt_task_id_new(tid);
}
#endif
@@ -5533,8 +5550,7 @@ __kmp_launch_thread( kmp_info_t *this_th
#if OMPT_SUPPORT
if (ompt_enabled) {
/* no frame set while outside task */
- int tid = __kmp_tid_from_gtid(gtid);
- (*pteam)->t.t_implicit_task_taskdata[tid].ompt_task_info.frame.exit_runtime_frame = 0;
+ task_info->frame.exit_runtime_frame = 0;
this_thr->th.ompt_thread_info.state = ompt_state_overhead;
}
@@ -5545,6 +5561,17 @@ __kmp_launch_thread( kmp_info_t *this_th
}
/* join barrier after parallel region */
__kmp_join_barrier( gtid );
+#if OMPT_SUPPORT && OMPT_TRACE
+ if (ompt_enabled) {
+ if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
+ int my_parallel_id = (*pteam)->t.ompt_team_info.parallel_id;
+ ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
+ my_parallel_id, task_info->task_id);
+ }
+ task_info->frame.exit_runtime_frame = 0;
+ task_info->task_id = 0;
+ }
+#endif
}
}
TCR_SYNC_PTR((intptr_t)__kmp_global.g.g_done);
@@ -6858,17 +6885,6 @@ __kmp_invoke_task_func( int gtid )
);
}
-#if OMPT_SUPPORT && OMPT_TRACE
- if (ompt_enabled) {
- if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
- ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
- my_parallel_id, my_task_id);
- }
- // the implicit task is not dead yet, so we can't clear its task id here
- team->t.t_implicit_task_taskdata[tid].ompt_task_info.frame.exit_runtime_frame = 0;
- }
-#endif
-
#if USE_ITT_BUILD
if ( __itt_stack_caller_create_ptr ) {
__kmp_itt_stack_callee_leave( (__itt_caller)team->t.t_stack_id ); // inform ittnotify about leaving user's code
More information about the Openmp-commits
mailing list