[Openmp-commits] [PATCH] D135003: [OpenMP] Add upper limit to TPAUSE exponential backoff time

Nawrin Sultana via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Sep 30 17:56:19 PDT 2022


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

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135003

Files:
  openmp/runtime/src/kmp.h


Index: openmp/runtime/src/kmp.h
===================================================================
--- openmp/runtime/src/kmp.h
+++ openmp/runtime/src/kmp.h
@@ -1472,6 +1472,7 @@
 // requested. Uses a timed TPAUSE, and exponential backoff. If TPAUSE isn't
 // available, fall back to the regular CPU pause and yield combination.
 #if KMP_HAVE_UMWAIT
+#define KMP_TPAUSE_MAX_MASK ((kmp_uint64)0xFFFF)
 #define KMP_YIELD_OVERSUB_ELSE_SPIN(count, time)                               \
   {                                                                            \
     if (__kmp_tpause_enabled) {                                                \
@@ -1480,7 +1481,7 @@
       } else {                                                                 \
         __kmp_tpause(__kmp_tpause_hint, (time));                               \
       }                                                                        \
-      (time) *= 2;                                                             \
+      (time) = (time << 1 | 1) & KMP_TPAUSE_MAX_MASK;                          \
     } else {                                                                   \
       KMP_CPU_PAUSE();                                                         \
       if ((KMP_TRY_YIELD_OVERSUB)) {                                           \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135003.464450.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221001/6bc50637/attachment.bin>


More information about the Openmp-commits mailing list