summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2017-09-05 15:45:48 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2017-09-05 15:45:48 +0000
commit52527cd2c11fd7648d4a44b6ea943f30734759f5 (patch)
treec821ec151e33ae6fe98a4bd5fd1b2cc03e01002e
parent6a393f75f4ee7780d10f87a636bc7844f7157fca (diff)
downloadbcm5719-llvm-52527cd2c11fd7648d4a44b6ea943f30734759f5.tar.gz
bcm5719-llvm-52527cd2c11fd7648d4a44b6ea943f30734759f5.zip
Read blocktime value set by kmp_set_blocktime() before reading from KMP_BLOCKTIME
Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D37403 llvm-svn: 312539
-rw-r--r--openmp/runtime/src/kmp.h8
-rw-r--r--openmp/runtime/src/kmp_barrier.cpp6
2 files changed, 9 insertions, 5 deletions
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index ca9a33afa3c..f2895db0e70 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -920,6 +920,8 @@ extern int __kmp_hws_abs_flag; // absolute or per-item number requested
(((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 @@ extern kmp_uint64 __kmp_ticks_per_msec;
#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() \
diff --git a/openmp/runtime/src/kmp_barrier.cpp b/openmp/runtime/src/kmp_barrier.cpp
index b68e015cd5c..cd0dc58426d 100644
--- a/openmp/runtime/src/kmp_barrier.cpp
+++ b/openmp/runtime/src/kmp_barrier.cpp
@@ -1289,7 +1289,7 @@ int __kmp_barrier(enum barrier_type bt, int gtid, int is_split,
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 @@ void __kmp_join_barrier(int gtid) {
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 @@ void __kmp_fork_barrier(int gtid, int tid) {
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
OpenPOWER on IntegriCloud