[Openmp-commits] [PATCH] D37403: Read blocktime value set by kmp_set_blocktime() before reading from KMP_BLOCKTIME

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Sep 5 08:49:13 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL312539: Read blocktime value set by kmp_set_blocktime() before reading from… (authored by jlpeyton).

Changed prior to commit:
  https://reviews.llvm.org/D37403?vs=113606&id=113868#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37403

Files:
  openmp/trunk/runtime/src/kmp.h
  openmp/trunk/runtime/src/kmp_barrier.cpp


Index: openmp/trunk/runtime/src/kmp_barrier.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_barrier.cpp
+++ openmp/trunk/runtime/src/kmp_barrier.cpp
@@ -1289,7 +1289,7 @@
       this_thr->th.th_team_bt_set =
           team->t.t_implicit_task_taskdata[tid].td_icvs.bt_set;
 #else
-      this_thr->th.th_team_bt_intervals = KMP_BLOCKTIME_INTERVAL();
+      this_thr->th.th_team_bt_intervals = KMP_BLOCKTIME_INTERVAL(team, tid);
 #endif
     }
 
@@ -1636,7 +1636,7 @@
     this_thr->th.th_team_bt_set =
         team->t.t_implicit_task_taskdata[tid].td_icvs.bt_set;
 #else
-    this_thr->th.th_team_bt_intervals = KMP_BLOCKTIME_INTERVAL();
+    this_thr->th.th_team_bt_intervals = KMP_BLOCKTIME_INTERVAL(team, tid);
 #endif
   }
 
@@ -1844,7 +1844,7 @@
       this_thr->th.th_team_bt_set =
           team->t.t_implicit_task_taskdata[tid].td_icvs.bt_set;
 #else
-      this_thr->th.th_team_bt_intervals = KMP_BLOCKTIME_INTERVAL();
+      this_thr->th.th_team_bt_intervals = KMP_BLOCKTIME_INTERVAL(team, tid);
 #endif
     }
   } // master
Index: openmp/trunk/runtime/src/kmp.h
===================================================================
--- openmp/trunk/runtime/src/kmp.h
+++ openmp/trunk/runtime/src/kmp.h
@@ -920,6 +920,8 @@
   (((blocktime) + (KMP_BLOCKTIME_MULTIPLIER / (monitor_wakeups)) - 1) /        \
    (KMP_BLOCKTIME_MULTIPLIER / (monitor_wakeups)))
 #else
+#define KMP_BLOCKTIME(team, tid)                                               \
+  (get__bt_set(team, tid) ? get__blocktime(team, tid) : __kmp_dflt_blocktime)
 #if KMP_OS_UNIX && (KMP_ARCH_X86 || KMP_ARCH_X86_64)
 // HW TSC is used to reduce overhead (clock tick instead of nanosecond).
 extern kmp_uint64 __kmp_ticks_per_msec;
@@ -929,14 +931,16 @@
 #define KMP_NOW() __kmp_hardware_timestamp()
 #endif
 #define KMP_NOW_MSEC() (KMP_NOW() / __kmp_ticks_per_msec)
-#define KMP_BLOCKTIME_INTERVAL() (__kmp_dflt_blocktime * __kmp_ticks_per_msec)
+#define KMP_BLOCKTIME_INTERVAL(team, tid)                                      \
+  (KMP_BLOCKTIME(team, tid) * __kmp_ticks_per_msec)
 #define KMP_BLOCKING(goal, count) ((goal) > KMP_NOW())
 #else
 // System time is retrieved sporadically while blocking.
 extern kmp_uint64 __kmp_now_nsec();
 #define KMP_NOW() __kmp_now_nsec()
 #define KMP_NOW_MSEC() (KMP_NOW() / KMP_USEC_PER_SEC)
-#define KMP_BLOCKTIME_INTERVAL() (__kmp_dflt_blocktime * KMP_USEC_PER_SEC)
+#define KMP_BLOCKTIME_INTERVAL(team, tid)                                      \
+  (KMP_BLOCKTIME(team, tid) * KMP_USEC_PER_SEC)
 #define KMP_BLOCKING(goal, count) ((count) % 1000 != 0 || (goal) > KMP_NOW())
 #endif
 #define KMP_YIELD_NOW()                                                        \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37403.113868.patch
Type: text/x-patch
Size: 2736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170905/5beaf28b/attachment.bin>


More information about the Openmp-commits mailing list