[Openmp-commits] [PATCH] D16347: [OMPT]: Fix the order of implicit_task_end_events

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 26 13:49:20 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL258866: [OMPT]: Fix the order of implicit_task_end_events (authored by jlpeyton).

Changed prior to commit:
  http://reviews.llvm.org/D16347?vs=45362&id=46047#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D16347

Files:
  openmp/trunk/runtime/src/kmp_runtime.c

Index: openmp/trunk/runtime/src/kmp_runtime.c
===================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c
+++ openmp/trunk/runtime/src/kmp_runtime.c
@@ -2475,6 +2475,18 @@
     }
     KMP_DEBUG_ASSERT( root->r.r_in_parallel >= 0 );
 
+#if OMPT_SUPPORT && OMPT_TRACE
+    if(ompt_enabled){
+        ompt_task_info_t *task_info = __ompt_get_taskinfo(0);
+        if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
+             ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
+               parallel_id, task_info->task_id);
+        }
+        task_info->frame.exit_runtime_frame = 0;
+        task_info->task_id = 0;
+    }
+#endif
+
     KF_TRACE( 10, ("__kmp_join_call1: T#%d, this_thread=%p team=%p\n",
                    0, master_th, team ) );
     __kmp_pop_current_task_from_thread( master_th );
@@ -5504,6 +5516,12 @@
 
         /* have we been allocated? */
         if ( TCR_SYNC_PTR(*pteam) && !TCR_4(__kmp_global.g.g_done) ) {
+#if OMPT_SUPPORT
+            ompt_task_info_t *task_info;
+            if (ompt_enabled) {
+                task_info = __ompt_get_taskinfo(0);
+            }
+#endif
             /* we were just woken up, so run our new task */
             if ( TCR_SYNC_PTR((*pteam)->t.t_pkfn) != NULL ) {
                 int rc;
@@ -5517,8 +5535,7 @@
                     this_thr->th.ompt_thread_info.state = ompt_state_work_parallel;
                     // Initialize OMPT task id for implicit task.
                     int tid = __kmp_tid_from_gtid(gtid);
-                    (*pteam)->t.t_implicit_task_taskdata[tid].ompt_task_info.task_id =
-                    __ompt_task_id_new(tid);
+                    task_info->task_id = __ompt_task_id_new(tid);
                 }
 #endif
 
@@ -5533,8 +5550,7 @@
 #if OMPT_SUPPORT
                 if (ompt_enabled) {
                     /* no frame set while outside task */
-                    int tid = __kmp_tid_from_gtid(gtid);
-                    (*pteam)->t.t_implicit_task_taskdata[tid].ompt_task_info.frame.exit_runtime_frame = 0;
+                    task_info->frame.exit_runtime_frame = 0;
 
                     this_thr->th.ompt_thread_info.state = ompt_state_overhead;
                 }
@@ -5545,6 +5561,17 @@
             }
             /* join barrier after parallel region */
             __kmp_join_barrier( gtid );
+#if OMPT_SUPPORT && OMPT_TRACE
+            if (ompt_enabled) {
+                if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
+                    int my_parallel_id = (*pteam)->t.ompt_team_info.parallel_id;
+                    ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
+                        my_parallel_id, task_info->task_id);
+                }
+                task_info->frame.exit_runtime_frame = 0;
+                task_info->task_id = 0;
+            }
+#endif 
         }
     }
     TCR_SYNC_PTR((intptr_t)__kmp_global.g.g_done);
@@ -6858,17 +6885,6 @@
                                      );
     }
 
-#if OMPT_SUPPORT && OMPT_TRACE
-    if (ompt_enabled) {
-        if (ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)) {
-            ompt_callbacks.ompt_callback(ompt_event_implicit_task_end)(
-                my_parallel_id, my_task_id);
-        }
-        // the implicit task is not dead yet, so we can't clear its task id here
-        team->t.t_implicit_task_taskdata[tid].ompt_task_info.frame.exit_runtime_frame = 0;
-    }
-#endif
-
 #if USE_ITT_BUILD
     if ( __itt_stack_caller_create_ptr ) {
         __kmp_itt_stack_callee_leave( (__itt_caller)team->t.t_stack_id ); // inform ittnotify about leaving user's code


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16347.46047.patch
Type: text/x-patch
Size: 3693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160126/dc185f6e/attachment.bin>


More information about the Openmp-commits mailing list