[OMPT] Add ompt_event_task_switch event into OMPT/OpenMP

The patch adds support for ompt_event_task_switch into LLVM/OpenMP. Note that
the patch has also updated the signature of ompt_event_task_switch to
ompt_task_pair_callback_t (rather than the previous ompt_task_switch_callback_t).

Patch by Harald Servat

Differential Revision: http://reviews.llvm.org/D14566

llvm-svn: 252761
This commit is contained in:
Jonathan Peyton 2015-11-11 17:49:50 +00:00
parent c6638c7561
commit adee8c5a18
5 changed files with 37 additions and 13 deletions

View File

@ -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) (

View File

@ -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) (

View File

@ -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) (

View File

@ -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

View File

@ -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