[Openmp-commits] [PATCH] D14566: Add ompt_event_task_switch event into OMPT/OpenMP
Harald Servat via Openmp-commits
openmp-commits at lists.llvm.org
Wed Nov 11 02:58:00 PST 2015
harald.servat created this revision.
harald.servat added reviewers: openmp-commits, llvm-commits.
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).
http://reviews.llvm.org/D14566
Files:
runtime/src/include/41/ompt.h.var
runtime/src/kmp_tasking.c
runtime/src/ompt-event-specific.h
Index: runtime/src/ompt-event-specific.h
===================================================================
--- runtime/src/ompt-event-specific.h
+++ 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
Index: runtime/src/kmp_tasking.c
===================================================================
--- runtime/src/kmp_tasking.c
+++ runtime/src/kmp_tasking.c
@@ -1144,9 +1144,22 @@
// Thunks generated by gcc take a different argument list.
//
if (!discard) {
+
KMP_COUNT_BLOCK(TASK_executed);
KMP_TIME_BLOCK (TASK_execution);
#endif // OMP_40_ENABLED
+
+#if OMPT_SUPPORT
+ /* 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);
@@ -1156,6 +1169,18 @@
{
(*(task->routine))(gtid, task);
}
+
+#if OMPT_SUPPORT
+ /* 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
Index: runtime/src/include/41/ompt.h.var
===================================================================
--- runtime/src/include/41/ompt.h.var
+++ 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 @@
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) (
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14566.39891.patch
Type: text/x-patch
Size: 3716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20151111/8fa4521e/attachment-0001.bin>
More information about the Openmp-commits
mailing list