From 3984da560874aa206e37d3e0927f463cb08feff8 Mon Sep 17 00:00:00 2001 From: Andrey Churbanov Date: Tue, 13 Jan 2015 14:47:02 +0000 Subject: [PATCH] small fixes to the hierarchical barrier llvm-svn: 225793 --- openmp/runtime/src/kmp_barrier.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openmp/runtime/src/kmp_barrier.cpp b/openmp/runtime/src/kmp_barrier.cpp index cbd1edd9e7c0..79cfd3afa93e 100644 --- a/openmp/runtime/src/kmp_barrier.cpp +++ b/openmp/runtime/src/kmp_barrier.cpp @@ -834,6 +834,9 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) set team %d arrived(%p) = %u\n", gtid, team->t.t_id, tid, team->t.t_id, &team->t.t_bar[bt].b_arrived, team->t.t_bar[bt].b_arrived)); } + // If nested, but outer level is top-level, resume use of oncore optimization + if (this_thr->th.th_team->t.t_level <=2) thr_bar->use_oncore_barrier = 1; + else thr_bar->use_oncore_barrier = 0; // Is the team access below unsafe or just technically invalid? KA_TRACE(20, ("__kmp_hierarchical_barrier_gather: T#%d(%d:%d) exit for barrier type %d\n", gtid, team->t.t_id, tid, bt)); @@ -896,7 +899,7 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i KMP_MB(); // Flush all pending memory write invalidates. } - if (this_thr->th.th_team->t.t_level == 1) thr_bar->use_oncore_barrier = 1; + if (this_thr->th.th_team->t.t_level <= 1) thr_bar->use_oncore_barrier = 1; else thr_bar->use_oncore_barrier = 0; nproc = this_thr->th.th_team_nproc;