@@ -301,12 +301,20 @@ __kmpc_fork_call(ident_t *loc, kmp_int32 argc, kmpc_micro microtask, ...)
301301 va_start ( ap , microtask );
302302
303303#if OMPT_SUPPORT
304- int tid = __kmp_tid_from_gtid ( gtid );
305- kmp_info_t * master_th = __kmp_threads [ gtid ];
306- kmp_team_t * parent_team = master_th -> th .th_team ;
304+ ompt_frame_t * ompt_frame ;
307305 if (ompt_enabled ) {
308- parent_team -> t .t_implicit_task_taskdata [tid ].
309- ompt_task_info .frame .reenter_runtime_frame = __builtin_frame_address (1 );
306+ kmp_info_t * master_th = __kmp_threads [ gtid ];
307+ kmp_team_t * parent_team = master_th -> th .th_team ;
308+ ompt_lw_taskteam_t * lwt = parent_team -> t .ompt_serialized_team_info ;
309+ if (lwt )
310+ ompt_frame = & (lwt -> ompt_task_info .frame );
311+ else
312+ {
313+ int tid = __kmp_tid_from_gtid ( gtid );
314+ ompt_frame = & (parent_team -> t .t_implicit_task_taskdata [tid ].
315+ ompt_task_info .frame );
316+ }
317+ ompt_frame -> reenter_runtime_frame = __builtin_frame_address (1 );
310318 }
311319#endif
312320
@@ -340,8 +348,7 @@ __kmpc_fork_call(ident_t *loc, kmp_int32 argc, kmpc_micro microtask, ...)
340348
341349#if OMPT_SUPPORT
342350 if (ompt_enabled ) {
343- parent_team -> t .t_implicit_task_taskdata [tid ].
344- ompt_task_info .frame .reenter_runtime_frame = 0 ;
351+ ompt_frame -> reenter_runtime_frame = NULL ;
345352 }
346353#endif
347354 }
@@ -678,6 +685,14 @@ __kmpc_barrier(ident_t *loc, kmp_int32 global_tid)
678685 __kmp_check_barrier ( global_tid , ct_barrier , loc );
679686 }
680687
688+ #if OMPT_SUPPORT && OMPT_TRACE
689+ ompt_frame_t * ompt_frame ;
690+ if (ompt_enabled ) {
691+ ompt_frame = & ( __kmp_threads [ global_tid ] -> th .th_team ->
692+ t .t_implicit_task_taskdata [__kmp_tid_from_gtid (global_tid )].ompt_task_info .frame );
693+ ompt_frame -> reenter_runtime_frame = __builtin_frame_address (1 );
694+ }
695+ #endif
681696 __kmp_threads [ global_tid ]-> th .th_ident = loc ;
682697 // TODO: explicit barrier_wait_id:
683698 // this function is called when 'barrier' directive is present or
@@ -687,6 +702,11 @@ __kmpc_barrier(ident_t *loc, kmp_int32 global_tid)
687702 // 4) no sync is required
688703
689704 __kmp_barrier ( bs_plain_barrier , global_tid , FALSE, 0 , NULL , NULL );
705+ #if OMPT_SUPPORT && OMPT_TRACE
706+ if (ompt_enabled ) {
707+ ompt_frame -> reenter_runtime_frame = NULL ;
708+ }
709+ #endif
690710}
691711
692712/* The BARRIER for a MASTER section is always explicit */
0 commit comments