diff options
author | Nawrin Sultana <nawrin.sultana@intel.com> | 2022-09-30 16:10:43 -0500 |
---|---|---|
committer | Nawrin Sultana <nawrin.sultana@intel.com> | 2022-10-17 10:22:11 -0500 |
commit | 9f1f1b924f420f0bbbe605b27346d89177c8129a (patch) | |
tree | 2c27b8d486478f90624f9de6f7fddad968322942 /openmp/runtime | |
parent | 8e77458578d601cf714c0f444667f83ea2840621 (diff) | |
download | llvm-9f1f1b924f420f0bbbe605b27346d89177c8129a.zip llvm-9f1f1b924f420f0bbbe605b27346d89177c8129a.tar.gz llvm-9f1f1b924f420f0bbbe605b27346d89177c8129a.tar.bz2 |
[OpenMP] Add upper limit to TPAUSE exponential backoff time
Differential Revision: https://reviews.llvm.org/D135003
Diffstat (limited to 'openmp/runtime')
-rw-r--r-- | openmp/runtime/src/kmp.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h index 6aeb495..df02f40 100644 --- a/openmp/runtime/src/kmp.h +++ b/openmp/runtime/src/kmp.h @@ -1472,6 +1472,7 @@ static inline void __kmp_x86_pause(void) { _mm_pause(); } // 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 @@ static inline void __kmp_x86_pause(void) { _mm_pause(); } } 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)) { \ |