diff options
| -rw-r--r-- | openmp/runtime/src/include/30/ompt.h.var | 8 | ||||
| -rw-r--r-- | openmp/runtime/src/include/40/ompt.h.var | 8 | ||||
| -rw-r--r-- | openmp/runtime/src/include/41/ompt.h.var | 8 | ||||
| -rw-r--r-- | openmp/runtime/src/kmp_tasking.c | 24 | ||||
| -rw-r--r-- | openmp/runtime/src/ompt-event-specific.h | 2 |
5 files changed, 37 insertions, 13 deletions
diff --git a/openmp/runtime/src/include/30/ompt.h.var b/openmp/runtime/src/include/30/ompt.h.var index b4d5cd83094..83b4f1e3dfc 100644 --- a/openmp/runtime/src/include/30/ompt.h.var +++ b/openmp/runtime/src/include/30/ompt.h.var @@ -121,7 +121,7 @@ macro (ompt_event_initial_task_begin, ompt_parallel_callback_t, 24) /* initial task begin */ \ macro (ompt_event_initial_task_end, ompt_parallel_callback_t, 25) /* initial task end */ \ \ - macro (ompt_event_task_switch, ompt_task_switch_callback_t, 26) /* task switch */ \ + macro (ompt_event_task_switch, ompt_task_pair_callback_t, 26) /* task switch */ \ \ macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \ macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \ @@ -313,9 +313,9 @@ typedef void (*ompt_task_callback_t) ( ompt_task_id_t task_id /* id of task */ ); -typedef void (*ompt_task_switch_callback_t) ( - ompt_task_id_t suspended_task_id, /* tool data for suspended task */ - ompt_task_id_t resumed_task_id /* tool data for resumed task */ +typedef void (*ompt_task_pair_callback_t) ( + ompt_task_id_t first_task_id, + ompt_task_id_t second_task_id ); typedef void (*ompt_new_task_callback_t) ( diff --git a/openmp/runtime/src/include/40/ompt.h.var b/openmp/runtime/src/include/40/ompt.h.var index 4f262f7e069..3a8c30c1657 100644 --- a/openmp/runtime/src/include/40/ompt.h.var +++ b/openmp/runtime/src/include/40/ompt.h.var @@ -121,7 +121,7 @@ macro (ompt_event_initial_task_begin, ompt_parallel_callback_t, 24) /* initial task begin */ \ macro (ompt_event_initial_task_end, ompt_parallel_callback_t, 25) /* initial task end */ \ \ - macro (ompt_event_task_switch, ompt_task_switch_callback_t, 26) /* task switch */ \ + macro (ompt_event_task_switch, ompt_task_pair_callback_t, 26) /* task switch */ \ \ macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \ macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \ @@ -313,9 +313,9 @@ typedef void (*ompt_task_callback_t) ( ompt_task_id_t task_id /* id of task */ ); -typedef void (*ompt_task_switch_callback_t) ( - ompt_task_id_t suspended_task_id, /* tool data for suspended task */ - ompt_task_id_t resumed_task_id /* tool data for resumed task */ +typedef void (*ompt_task_pair_callback_t) ( + ompt_task_id_t first_task_id, + ompt_task_id_t second_task_id ); typedef void (*ompt_new_task_callback_t) ( diff --git a/openmp/runtime/src/include/41/ompt.h.var b/openmp/runtime/src/include/41/ompt.h.var index 6fff2a3dc99..fbd95e858b6 100644 --- a/openmp/runtime/src/include/41/ompt.h.var +++ b/openmp/runtime/src/include/41/ompt.h.var @@ -121,7 +121,7 @@ macro (ompt_event_initial_task_begin, ompt_parallel_callback_t, 24) /* initial task begin */ \ macro (ompt_event_initial_task_end, ompt_parallel_callback_t, 25) /* initial task end */ \ \ - macro (ompt_event_task_switch, ompt_task_switch_callback_t, 26) /* task switch */ \ + macro (ompt_event_task_switch, ompt_task_pair_callback_t, 26) /* task switch */ \ \ macro (ompt_event_loop_begin, ompt_new_workshare_callback_t, 27) /* task at loop begin */ \ macro (ompt_event_loop_end, ompt_parallel_callback_t, 28) /* task at loop end */ \ @@ -313,9 +313,9 @@ typedef void (*ompt_task_callback_t) ( ompt_task_id_t task_id /* id of task */ ); -typedef void (*ompt_task_switch_callback_t) ( - ompt_task_id_t suspended_task_id, /* tool data for suspended task */ - ompt_task_id_t resumed_task_id /* tool data for resumed task */ +typedef void (*ompt_task_pair_callback_t) ( + ompt_task_id_t first_task_id, + ompt_task_id_t second_task_id ); typedef void (*ompt_new_task_callback_t) ( diff --git a/openmp/runtime/src/kmp_tasking.c b/openmp/runtime/src/kmp_tasking.c index 54664ff0dd2..361aaea9b02 100644 --- a/openmp/runtime/src/kmp_tasking.c +++ b/openmp/runtime/src/kmp_tasking.c @@ -1148,6 +1148,18 @@ __kmp_invoke_task( kmp_int32 gtid, kmp_task_t *task, kmp_taskdata_t * current_ta KMP_COUNT_BLOCK(TASK_executed); KMP_TIME_BLOCK (TASK_execution); #endif // OMP_40_ENABLED + +#if OMPT_SUPPORT && OMPT_TRACE + /* let OMPT know that we're about to run this task */ + if (ompt_enabled && + ompt_callbacks.ompt_callback(ompt_event_task_switch)) + { + ompt_callbacks.ompt_callback(ompt_event_task_switch)( + current_task->ompt_task_info.task_id, + taskdata->ompt_task_info.task_id); + } +#endif + #ifdef KMP_GOMP_COMPAT if (taskdata->td_flags.native) { ((void (*)(void *))(*(task->routine)))(task->shareds); @@ -1157,6 +1169,18 @@ __kmp_invoke_task( kmp_int32 gtid, kmp_task_t *task, kmp_taskdata_t * current_ta { (*(task->routine))(gtid, task); } + +#if OMPT_SUPPORT && OMPT_TRACE + /* let OMPT know that we're returning to the callee task */ + if (ompt_enabled && + ompt_callbacks.ompt_callback(ompt_event_task_switch)) + { + ompt_callbacks.ompt_callback(ompt_event_task_switch)( + taskdata->ompt_task_info.task_id, + current_task->ompt_task_info.task_id); + } +#endif + #if OMP_40_ENABLED } #endif // OMP_40_ENABLED diff --git a/openmp/runtime/src/ompt-event-specific.h b/openmp/runtime/src/ompt-event-specific.h index b4dabcc89e6..28c1512ac26 100644 --- a/openmp/runtime/src/ompt-event-specific.h +++ b/openmp/runtime/src/ompt-event-specific.h @@ -91,7 +91,7 @@ #define ompt_event_initial_task_begin_implemented ompt_event_UNIMPLEMENTED #define ompt_event_initial_task_end_implemented ompt_event_UNIMPLEMENTED -#define ompt_event_task_switch_implemented ompt_event_UNIMPLEMENTED +#define ompt_event_task_switch_implemented ompt_event_MAY_ALWAYS_TRACE #define ompt_event_loop_begin_implemented ompt_event_MAY_ALWAYS_TRACE #define ompt_event_loop_end_implemented ompt_event_MAY_ALWAYS_TRACE |

