[Openmp-commits] [openmp] r295461 - [stats] add stats-gathering for static_steal scheduling method

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Fri Feb 17 09:06:16 PST 2017


Author: jlpeyton
Date: Fri Feb 17 11:06:16 2017
New Revision: 295461

URL: http://llvm.org/viewvc/llvm-project?rev=295461&view=rev
Log:
[stats] add stats-gathering for static_steal scheduling method

Add counter to count number of static_steal for loops
Add counter for number of chunks executed per static_steal for loop
Add counter for number of chunks stolen per static_steal for loop

Modified:
    openmp/trunk/runtime/src/kmp_dispatch.cpp
    openmp/trunk/runtime/src/kmp_stats.h

Modified: openmp/trunk/runtime/src/kmp_dispatch.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_dispatch.cpp?rev=295461&r1=295460&r2=295461&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_dispatch.cpp (original)
+++ openmp/trunk/runtime/src/kmp_dispatch.cpp Fri Feb 17 11:06:16 2017
@@ -826,6 +826,7 @@ __kmp_dispatch_init(
 
             ntc = (tc % chunk ? 1 : 0) + tc / chunk;
             if ( nproc > 1 && ntc >= nproc ) {
+                KMP_COUNT_BLOCK(OMP_FOR_static_steal);
                 T id = __kmp_tid_from_gtid(gtid);
                 T small_chunk, extras;
 
@@ -1637,8 +1638,10 @@ __kmp_dispatch_next(
                                 }
                                 // stealing succeded, reduce victim's ub by 1/4 of undone chunks or by 1
                                 if( remaining > 3 ) {
+                                    KMP_COUNT_VALUE(FOR_static_steal_stolen, remaining>>2);
                                     init = ( victim->u.p.ub -= (remaining>>2) ); // steal 1/4 of remaining
                                 } else {
+                                    KMP_COUNT_VALUE(FOR_static_steal_stolen, 1);
                                     init = ( victim->u.p.ub -= 1 ); // steal 1 chunk of 2 or 3 remaining
                                 }
                                 __kmp_release_lock(lck, gtid);
@@ -1739,6 +1742,7 @@ __kmp_dispatch_next(
                                             *VOLATILE_CAST(kmp_int64 *)&vold.b,
                                             *VOLATILE_CAST(kmp_int64 *)&vnew.b ) ) {
                                         // stealing succedded
+                                        KMP_COUNT_VALUE(FOR_static_steal_stolen, vold.p.ub-vnew.p.ub);
                                         status = 1;
                                         while_index = 0;
                                         // now update own count and ub
@@ -1765,6 +1769,7 @@ __kmp_dispatch_next(
                         init *= chunk;
                         limit = chunk + init - 1;
                         incr  = pr->u.p.st;
+                        KMP_COUNT_VALUE(FOR_static_steal_chunks, 1);
 
                         KMP_DEBUG_ASSERT(init <= trip);
                         if ( (last = (limit >= trip)) != 0 )

Modified: openmp/trunk/runtime/src/kmp_stats.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_stats.h?rev=295461&r1=295460&r2=295461&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_stats.h (original)
+++ openmp/trunk/runtime/src/kmp_stats.h Fri Feb 17 11:06:16 2017
@@ -89,6 +89,7 @@ enum stats_state_e {
     macro (OMP_PARALLEL, stats_flags_e::onlyInMaster | stats_flags_e::noTotal, arg) \
     macro (OMP_NESTED_PARALLEL, 0, arg)                         \
     macro (OMP_FOR_static, 0, arg)                              \
+    macro (OMP_FOR_static_steal, 0, arg)                        \
     macro (OMP_FOR_dynamic, 0, arg)                             \
     macro (OMP_DISTRIBUTE, 0, arg)                              \
     macro (OMP_BARRIER, 0, arg)                                 \
@@ -146,6 +147,8 @@ enum stats_state_e {
     macro (OMP_PARALLEL_args,     stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
     macro (FOR_static_iterations, stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
     macro (FOR_dynamic_iterations,stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
+    macro (FOR_static_steal_stolen,stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
+    macro (FOR_static_steal_chunks,stats_flags_e::noUnits | stats_flags_e::noTotal, arg) \
     KMP_FOREACH_DEVELOPER_TIMER(macro, arg)
 
 




More information about the Openmp-commits mailing list