[Openmp-commits] [openmp] r226283 - few fixes for ittnotify iterface (used by Intel(R) VTune Amplifier)

Andrey Churbanov Andrey.Churbanov at intel.com
Fri Jan 16 07:58:03 PST 2015


Author: achurbanov
Date: Fri Jan 16 09:58:03 2015
New Revision: 226283

URL: http://llvm.org/viewvc/llvm-project?rev=226283&view=rev
Log:
few fixes for ittnotify iterface (used by Intel(R) VTune Amplifier)

Modified:
    openmp/trunk/runtime/src/kmp_itt.h
    openmp/trunk/runtime/src/kmp_itt.inl
    openmp/trunk/runtime/src/kmp_runtime.c

Modified: openmp/trunk/runtime/src/kmp_itt.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_itt.h?rev=226283&r1=226282&r2=226283&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_itt.h (original)
+++ openmp/trunk/runtime/src/kmp_itt.h Fri Jan 16 09:58:03 2015
@@ -68,7 +68,7 @@ __kmp_inline void __kmp_itt_frame_submit
 __kmp_inline void __kmp_itt_metadata_imbalance( int gtid, kmp_uint64 begin, kmp_uint64 end, kmp_uint64 imbalance, kmp_uint64 reduction );
 // sched_type: 0 - static, 1 - dynamic, 2 - guided, 3 - custom (all others); iterations - loop trip count, chunk - chunk size
 __kmp_inline void __kmp_itt_metadata_loop( ident_t * loc, kmp_uint64 sched_type, kmp_uint64 iterations, kmp_uint64 chunk );
-__kmp_inline void __kmp_itt_metadata_single();
+__kmp_inline void __kmp_itt_metadata_single( ident_t * loc );
 
 // --- Barrier reporting ---
 __kmp_inline void * __kmp_itt_barrier_object( int gtid, int bt, int set_name = 0, int delta = 0 );

Modified: openmp/trunk/runtime/src/kmp_itt.inl
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_itt.inl?rev=226283&r1=226282&r2=226283&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_itt.inl (original)
+++ openmp/trunk/runtime/src/kmp_itt.inl Fri Jan 16 09:58:03 2015
@@ -368,7 +368,7 @@ __kmp_itt_metadata_loop( ident_t * loc,
 // -------------------------------------------------------------------------------------------------
 
 LINKAGE void
-__kmp_itt_metadata_single( ) {
+__kmp_itt_metadata_single( ident_t * loc ) {
 #if USE_ITT_NOTIFY
     if( metadata_domain == NULL) {
         __kmp_acquire_bootstrap_lock( & metadata_lock );
@@ -381,8 +381,14 @@ __kmp_itt_metadata_single( ) {
     }
 
     __itt_string_handle * string_handle = __itt_string_handle_create( "omp_metadata_single");
+    kmp_str_loc_t str_loc = __kmp_str_loc_init( loc->psource, 1 );
+    kmp_uint64 single_data[ 2 ];
+    single_data[ 0 ] = str_loc.line;
+    single_data[ 1 ] = str_loc.col;
 
-    __itt_metadata_add(metadata_domain, __itt_null, string_handle, __itt_metadata_u64, 0, NULL);
+    __kmp_str_loc_free( &str_loc );
+
+    __itt_metadata_add(metadata_domain, __itt_null, string_handle, __itt_metadata_u64, 2, single_data);
 #endif
 } // __kmp_itt_metadata_single
 

Modified: openmp/trunk/runtime/src/kmp_runtime.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.c?rev=226283&r1=226282&r2=226283&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c (original)
+++ openmp/trunk/runtime/src/kmp_runtime.c Fri Jan 16 09:58:03 2015
@@ -810,8 +810,8 @@ __kmp_enter_single( int gtid, ident_t *i
     if ( status ) {
         __kmp_itt_single_start( gtid );
     }
-    if( __itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 ) {
-        __kmp_itt_metadata_single();
+    if( __itt_metadata_add_ptr && __kmp_forkjoin_frames_mode == 3 && KMP_MASTER_GTID(gtid)) {
+        __kmp_itt_metadata_single( id_ref );
     }
 
 #endif /* USE_ITT_BUILD */
@@ -1850,7 +1850,7 @@ __kmp_fork_call(
 
 #if USE_ITT_BUILD
     // Mark start of "parallel" region for VTune. Only use one of frame notification scheme at the moment.
-    if ((__itt_frame_begin_v3_ptr && __kmp_forkjoin_frames && !__kmp_forkjoin_frames_mode) || KMP_ITT_DEBUG)
+    if ((__itt_frame_begin_v3_ptr && __kmp_forkjoin_frames && !__kmp_forkjoin_frames_mode) || KMP_ITT_DEBUG) {
 # if OMP_40_ENABLED
         if (!master_th->th.th_teams_microtask || microtask == (microtask_t)__kmp_teams_master)
             // Either not in teams or the outer fork of the teams construct
@@ -1858,24 +1858,27 @@ __kmp_fork_call(
         {
             __kmp_itt_region_forking(gtid, team->t.t_nproc, 0);
         }
-    kmp_uint64 tmp_time = 0;
+    }
 #if USE_ITT_NOTIFY
-    if ( __itt_get_timestamp_ptr )
-        tmp_time = __itt_get_timestamp();
-#endif
-    if ((__itt_frame_submit_v3_ptr && __kmp_forkjoin_frames_mode==3)|| KMP_ITT_DEBUG)
+    kmp_uint64 tmp_time = 0;
+    if (((__kmp_forkjoin_frames_mode == 1 || __kmp_forkjoin_frames_mode == 3) && __itt_frame_submit_v3_ptr) || KMP_ITT_DEBUG) {
+        if (!(team->t.t_active_level > 1)) {
 # if OMP_40_ENABLED
-        if (!master_th->th.th_teams_microtask || microtask == (microtask_t)__kmp_teams_master)
+            if (!master_th->th.th_teams_microtask || microtask == (microtask_t)__kmp_teams_master) {
             // Either not in teams or the outer fork of the teams construct
 # endif /* OMP_40_ENABLED */
-            team->t.t_region_time = tmp_time;
-
+                if ( __itt_get_timestamp_ptr )
+                    tmp_time = __itt_get_timestamp();
     // Internal fork - report frame begin
-    if ((__kmp_forkjoin_frames_mode == 1 || __kmp_forkjoin_frames_mode == 3) && __itt_frame_submit_v3_ptr ) {
-        if (!(team->t.t_active_level > 1)) {
             master_th->th.th_frame_time  = tmp_time;
+                if ( __kmp_forkjoin_frames_mode==3 )
+                    team->t.t_region_time = tmp_time;
+# if OMP_40_ENABLED
+            }
+# endif /* OMP_40_ENABLED */
         }
     }
+#endif /* USE_ITT_NOTIFY */
 #endif /* USE_ITT_BUILD */
 
     /* now go on and do the work */
@@ -1998,7 +2001,7 @@ __kmp_join_call(ident_t *loc, int gtid
     }
 
     // Mark end of "parallel" region for VTune. Only use one of frame notification scheme at the moment.
-    if ( ( __itt_frame_end_v3_ptr && __kmp_forkjoin_frames && ! __kmp_forkjoin_frames_mode ) || KMP_ITT_DEBUG )
+    if ( ( __itt_frame_end_v3_ptr && __kmp_forkjoin_frames && ! __kmp_forkjoin_frames_mode ) || KMP_ITT_DEBUG ) {
 # if OMP_40_ENABLED
     if ( !master_th->th.th_teams_microtask /* not in teams */ ||
          ( !exit_teams && team->t.t_level == master_th->th.th_teams_level ) )
@@ -2009,7 +2012,8 @@ __kmp_join_call(ident_t *loc, int gtid
         master_th->th.th_ident = loc;
         __kmp_itt_region_joined( gtid );
     }
-    if ( ( __itt_frame_submit_v3_ptr && __kmp_forkjoin_frames_mode == 3 ) || KMP_ITT_DEBUG )
+    }
+    if ( ( __itt_frame_submit_v3_ptr && __kmp_forkjoin_frames_mode == 3 ) || KMP_ITT_DEBUG ) {
 # if OMP_40_ENABLED
     if ( !master_th->th.th_teams_microtask /* not in teams */ ||
          ( !exit_teams && team->t.t_level == master_th->th.th_teams_level ) )
@@ -2020,6 +2024,7 @@ __kmp_join_call(ident_t *loc, int gtid
         master_th->th.th_ident = loc;
         __kmp_itt_frame_submit( gtid, team->t.t_region_time, master_th->th.th_frame_time, 0, loc, master_th->th.th_team_nproc, 1 );
     }
+    }
 #endif /* USE_ITT_BUILD */
 
 #if OMP_40_ENABLED





More information about the Openmp-commits mailing list