[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
Mon Oct 17 08:24:22 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f1f1b924f42: [OpenMP] Add upper limit to TPAUSE exponential backoff time (authored by Nawrin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135003/new/

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.468214.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20221017/f8120757/attachment.bin>


More information about the Openmp-commits mailing list