[Openmp-commits] [PATCH] D139867: [OpenMP][libomp] Fix stats-gathering for new MSVC sections API

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Dec 12 11:28:25 PST 2022


jlpeyton created this revision.
jlpeyton added reviewers: tlwilmar, Nawrin, hbae.
jlpeyton added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
jlpeyton requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

Fix `-DLIBOMP_STATS=On` builds.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139867

Files:
  openmp/runtime/src/kmp_dispatch.cpp
  openmp/runtime/src/kmp_stats.h


Index: openmp/runtime/src/kmp_stats.h
===================================================================
--- openmp/runtime/src/kmp_stats.h
+++ openmp/runtime/src/kmp_stats.h
@@ -102,6 +102,7 @@
   macro(OMP_BARRIER, 0, arg)                                                   \
   macro(OMP_CRITICAL, 0, arg)                                                  \
   macro(OMP_SINGLE, 0, arg)                                                    \
+  macro(OMP_SECTIONS, 0, arg)                                                  \
   macro(OMP_MASTER, 0, arg)                                                    \
   macro(OMP_MASKED, 0, arg)                                                    \
   macro(OMP_TEAMS, 0, arg)                                                     \
@@ -150,6 +151,8 @@
   macro (OMP_critical, 0, arg)                                                 \
   macro (OMP_critical_wait, 0, arg)                                            \
   macro (OMP_single, 0, arg)                                                   \
+  macro (OMP_sections, 0, arg)                                                 \
+  macro (OMP_sections_overhead, 0, arg)                                        \
   macro (OMP_master, 0, arg)                                                   \
   macro (OMP_masked, 0, arg)                                                   \
   macro (OMP_task_immediate, 0, arg)                                           \
Index: openmp/runtime/src/kmp_dispatch.cpp
===================================================================
--- openmp/runtime/src/kmp_dispatch.cpp
+++ openmp/runtime/src/kmp_dispatch.cpp
@@ -2387,7 +2387,7 @@
 kmp_int32 __kmpc_next_section(ident_t *loc, kmp_int32 gtid,
                               kmp_int32 numberOfSections) {
 
-  KMP_TIME_PARTITIONED_BLOCK(OMP_sections);
+  KMP_TIME_PARTITIONED_BLOCK(OMP_sections_overhead);
 
   kmp_info_t *th = __kmp_threads[gtid];
 #ifdef KMP_DEBUG
@@ -2460,7 +2460,6 @@
           ompt_dispatch_section, instance);
     }
 #endif
-    KMP_POP_PARTITIONED_TIMER();
   }
 
   return sectionIndex;
@@ -2492,9 +2491,9 @@
           &(task_info->task_data), 0, OMPT_GET_RETURN_ADDRESS(0));
     }
 #endif
-    KMP_POP_PARTITIONED_TIMER();
   }
 
+  KMP_POP_PARTITIONED_TIMER();
   KD_TRACE(100, ("__kmpc_end_sections: T#%d returned\n", gtid));
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139867.482202.patch
Type: text/x-patch
Size: 2339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221212/d555d3e4/attachment.bin>


More information about the Openmp-commits mailing list