[Openmp-commits] [openmp] r252761 - [OMPT] Add ompt_event_task_switch event into OMPT/OpenMP

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Wed Nov 11 09:49:51 PST 2015


Author: jlpeyton
Date: Wed Nov 11 11:49:50 2015
New Revision: 252761

URL: http://llvm.org/viewvc/llvm-project?rev=252761&view=rev
Log:
[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

Modified:
    openmp/trunk/runtime/src/include/30/ompt.h.var
    openmp/trunk/runtime/src/include/40/ompt.h.var
    openmp/trunk/runtime/src/include/41/ompt.h.var
    openmp/trunk/runtime/src/kmp_tasking.c
    openmp/trunk/runtime/src/ompt-event-specific.h

Modified: openmp/trunk/runtime/src/include/30/ompt.h.var
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/include/30/ompt.h.var?rev=252761&r1=252760&r2=252761&view=diff
==============================================================================
--- openmp/trunk/runtime/src/include/30/ompt.h.var (original)
+++ openmp/trunk/runtime/src/include/30/ompt.h.var Wed Nov 11 11:49:50 2015
@@ -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) (

Modified: openmp/trunk/runtime/src/include/40/ompt.h.var
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/include/40/ompt.h.var?rev=252761&r1=252760&r2=252761&view=diff
==============================================================================
--- openmp/trunk/runtime/src/include/40/ompt.h.var (original)
+++ openmp/trunk/runtime/src/include/40/ompt.h.var Wed Nov 11 11:49:50 2015
@@ -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) (

Modified: openmp/trunk/runtime/src/include/41/ompt.h.var
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/include/41/ompt.h.var?rev=252761&r1=252760&r2=252761&view=diff
==============================================================================
--- openmp/trunk/runtime/src/include/41/ompt.h.var (original)
+++ openmp/trunk/runtime/src/include/41/ompt.h.var Wed Nov 11 11:49:50 2015
@@ -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) (

Modified: openmp/trunk/runtime/src/kmp_tasking.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_tasking.c?rev=252761&r1=252760&r2=252761&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_tasking.c (original)
+++ openmp/trunk/runtime/src/kmp_tasking.c Wed Nov 11 11:49:50 2015
@@ -1148,6 +1148,18 @@ __kmp_invoke_task( kmp_int32 gtid, kmp_t
         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_t
         {
             (*(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

Modified: openmp/trunk/runtime/src/ompt-event-specific.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/ompt-event-specific.h?rev=252761&r1=252760&r2=252761&view=diff
==============================================================================
--- openmp/trunk/runtime/src/ompt-event-specific.h (original)
+++ openmp/trunk/runtime/src/ompt-event-specific.h Wed Nov 11 11:49:50 2015
@@ -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




More information about the Openmp-commits mailing list