Index: runtime/src/kmp_csupport.c =================================================================== --- runtime/src/kmp_csupport.c +++ runtime/src/kmp_csupport.c @@ -306,7 +306,7 @@ kmp_team_t *parent_team = master_th->th.th_team; if (ompt_enabled) { parent_team->t.t_implicit_task_taskdata[tid]. - ompt_task_info.frame.reenter_runtime_frame = __builtin_frame_address(0); + ompt_task_info.frame.reenter_runtime_frame = __builtin_frame_address(1); } #endif @@ -341,7 +341,7 @@ #if OMPT_SUPPORT if (ompt_enabled) { parent_team->t.t_implicit_task_taskdata[tid]. - ompt_task_info.frame.reenter_runtime_frame = 0; + ompt_task_info.frame.reenter_runtime_frame = NULL; } #endif } @@ -396,7 +396,7 @@ int tid = __kmp_tid_from_gtid( gtid ); if (ompt_enabled) { parent_team->t.t_implicit_task_taskdata[tid]. - ompt_task_info.frame.reenter_runtime_frame = __builtin_frame_address(0); + ompt_task_info.frame.reenter_runtime_frame = __builtin_frame_address(1); } #endif @@ -678,6 +678,14 @@ __kmp_check_barrier( global_tid, ct_barrier, loc ); } +#if OMPT_SUPPORT && OMPT_TRACE + ompt_frame_t * ompt_frame; + if (ompt_enabled ) { + ompt_frame = &( __kmp_threads[ global_tid ] -> th.th_team -> + t.t_implicit_task_taskdata[__kmp_tid_from_gtid(global_tid)].ompt_task_info.frame); + ompt_frame->reenter_runtime_frame = __builtin_frame_address(1); + } +#endif __kmp_threads[ global_tid ]->th.th_ident = loc; // TODO: explicit barrier_wait_id: // this function is called when 'barrier' directive is present or @@ -687,6 +695,11 @@ // 4) no sync is required __kmp_barrier( bs_plain_barrier, global_tid, FALSE, 0, NULL, NULL ); +#if OMPT_SUPPORT && OMPT_TRACE + if (ompt_enabled ) { + ompt_frame->reenter_runtime_frame = NULL; + } +#endif } /* The BARRIER for a MASTER section is always explicit */ Index: runtime/src/kmp_gsupport.c =================================================================== --- runtime/src/kmp_gsupport.c +++ runtime/src/kmp_gsupport.c @@ -442,7 +442,7 @@ if (ompt_enabled) { parent_frame = __ompt_get_task_frame_internal(0); - parent_frame->reenter_runtime_frame = __builtin_frame_address(0); + parent_frame->reenter_runtime_frame = __builtin_frame_address(1); } #endif @@ -495,7 +495,7 @@ // Record that we re-entered the runtime system in the implicit // task frame representing the parallel region. ompt_frame = &task_info->frame; - ompt_frame->reenter_runtime_frame = __builtin_frame_address(0); + ompt_frame->reenter_runtime_frame = __builtin_frame_address(1); // unlink if necessary. no-op if there is not a lightweight task. ompt_lw_taskteam_t *lwt = __ompt_lw_taskteam_unlink(thr); @@ -509,7 +509,7 @@ // remaining deepest task knows the stack frame where the runtime // was reentered. ompt_frame = __ompt_get_task_frame_internal(0); - ompt_frame->reenter_runtime_frame = __builtin_frame_address(0); + ompt_frame->reenter_runtime_frame = __builtin_frame_address(1); } #endif } @@ -525,7 +525,7 @@ // Set reenter frame in parent task, which will become current task // in the midst of join. This is needed before the end_parallel callback. ompt_frame = __ompt_get_task_frame_internal(1); - ompt_frame->reenter_runtime_frame = __builtin_frame_address(0); + ompt_frame->reenter_runtime_frame = __builtin_frame_address(1); } #endif @@ -555,7 +555,7 @@ if (ompt_enabled) { // Record that we re-entered the runtime system in the frame that // created the parallel region. - ompt_frame->reenter_runtime_frame = __builtin_frame_address(0); + ompt_frame->reenter_runtime_frame = __builtin_frame_address(1); if (ompt_callbacks.ompt_callback(ompt_event_parallel_end)) { ompt_task_info_t *task_info = __ompt_get_taskinfo(0); @@ -898,7 +898,7 @@ ompt_frame_t *parent_frame; \ if (ompt_enabled) { \ parent_frame = __ompt_get_task_frame_internal(0); \ - parent_frame->reenter_runtime_frame = __builtin_frame_address(0); \ + parent_frame->reenter_runtime_frame = __builtin_frame_address(1); \ } @@ -1101,7 +1101,7 @@ if (ompt_enabled) { parent_frame = __ompt_get_task_frame_internal(0); - parent_frame->reenter_runtime_frame = __builtin_frame_address(0); + parent_frame->reenter_runtime_frame = __builtin_frame_address(1); } #endif Index: runtime/src/kmp_tasking.c =================================================================== --- runtime/src/kmp_tasking.c +++ runtime/src/kmp_tasking.c @@ -1334,7 +1334,7 @@ #if OMPT_SUPPORT if (ompt_enabled) { new_taskdata->ompt_task_info.frame.reenter_runtime_frame = - __builtin_frame_address(0); + __builtin_frame_address(1); } #endif @@ -1419,7 +1419,7 @@ my_task_id = taskdata->ompt_task_info.task_id; my_parallel_id = team->t.ompt_team_info.parallel_id; - taskdata->ompt_task_info.frame.reenter_runtime_frame = __builtin_frame_address(0); + taskdata->ompt_task_info.frame.reenter_runtime_frame = __builtin_frame_address(1); if (ompt_callbacks.ompt_callback(ompt_event_taskwait_begin)) { ompt_callbacks.ompt_callback(ompt_event_taskwait_begin)( my_parallel_id, my_task_id); Index: runtime/test/ompt/parallel/nested.c =================================================================== --- runtime/test/ompt/parallel/nested.c +++ runtime/test/ompt/parallel/nested.c @@ -7,16 +7,22 @@ int main() { omp_set_nested(1); + print_frame(0); #pragma omp parallel num_threads(4) { + print_frame(1); print_ids(0); print_ids(1); + print_frame(0); #pragma omp parallel num_threads(4) { + print_frame(1); print_ids(0); print_ids(1); print_ids(2); + print_frame(0); + #pragma omp barrier } } @@ -40,18 +46,23 @@ // CHECK: {{^}}[[MASTER_ID]]: ompt_event_parallel_end: parallel_id=[[PARALLEL_ID]], task_id=[[PARENT_TASK_ID]], invoker=[[PARALLEL_INVOKER]] - // THREADS: 0: NULL_POINTER=[[NULL:.*$]] - // THREADS: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, parallel_function=0x{{[0-f]+}}, invoker=[[PARALLEL_INVOKER:.+]] + // THREADS: {{^}}0: NULL_POINTER=[[NULL:.*$]] + // THREADS: {{^}}[[MASTER_ID:[0-9]+]]: __builtin_frame_address(0)=[[MAIN_REENTER:0x[0-f]+]] + // THREADS: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[PARENT_TASK_ID:[0-9]+]], parent_task_frame.exit=[[NULL]], parent_task_frame.reenter=[[MAIN_REENTER]], parallel_id=[[PARALLEL_ID:[0-9]+]], requested_team_size=4, parallel_function=0x{{[0-f]+}}, invoker=[[PARALLEL_INVOKER:.+]] // nested parallel masters // THREADS: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID:[0-9]+]] - // THREADS: {{^}}[[MASTER_ID]]: level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] - // THREADS: {{^}}[[MASTER_ID]]: level 1: parallel_id=0, task_id=[[PARENT_TASK_ID]] - // THREADS: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[IMPLICIT_TASK_ID]], parent_task_frame.exit={{0x[0-f]+}}, parent_task_frame.reenter={{0x[0-f]+}}, parallel_id=[[NESTED_PARALLEL_ID:[0-9]+]], requested_team_size=4, parallel_function=[[NESTED_PARALLEL_FUNCTION:0x[0-f]+]], invoker=[[PARALLEL_INVOKER]] + // THREADS: {{^}}[[MASTER_ID]]: __builtin_frame_address(1)=[[EXIT:0x[0-f]+]] + // THREADS: {{^}}[[MASTER_ID]]: level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[NULL]] + // THREADS: {{^}}[[MASTER_ID]]: level 1: parallel_id=0, task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[MAIN_REENTER]] + // THREADS: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[REENTER:0x[0-f]+]] + // THREADS: {{^}}[[MASTER_ID]]: ompt_event_parallel_begin: parent_task_id=[[IMPLICIT_TASK_ID]], parent_task_frame.exit=[[EXIT]], parent_task_frame.reenter=[[REENTER]], parallel_id=[[NESTED_PARALLEL_ID:[0-9]+]], requested_team_size=4, parallel_function=[[NESTED_PARALLEL_FUNCTION:0x[0-f]+]], invoker=[[PARALLEL_INVOKER]] // THREADS: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_begin: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID:[0-9]+]] - // THREADS: {{^}}[[MASTER_ID]]: level 0: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]] - // THREADS: {{^}}[[MASTER_ID]]: level 1: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]] - // THREADS: {{^}}[[MASTER_ID]]: level 2: parallel_id=0, task_id=[[PARENT_TASK_ID]] + // THREADS: {{^}}[[MASTER_ID]]: __builtin_frame_address(1)=[[NESTED_EXIT:0x[0-f]+]] + // THREADS: {{^}}[[MASTER_ID]]: level 0: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]], exit_frame=[[NESTED_EXIT]], reenter_frame=[[NULL]] + // THREADS: {{^}}[[MASTER_ID]]: level 1: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[EXIT]], reenter_frame=[[REENTER]] + // THREADS: {{^}}[[MASTER_ID]]: level 2: parallel_id=0, task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[MAIN_REENTER]] + // THREADS: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[NESTED_REENTER:0x[0-f]+]] // THREADS-NOT: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]] // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]]