[Openmp-commits] [PATCH] D21897: Fix checks on schedule struct
Terry Wilmarth via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jun 30 08:06:19 PDT 2016
tlwilmar created this revision.
tlwilmar added reviewers: AndreyChurbanov, jlpeyton.
tlwilmar added a subscriber: openmp-commits.
tlwilmar set the repository for this revision to rL LLVM.
This change fixes an error in comparing the existing schedule on the team to the new schedule, in the chunk field. Also added additional checks and used KMP_CHECK_UPDATE where appropriate.
Patch by Terry Wilmarth.
Repository:
rL LLVM
http://reviews.llvm.org/D21897
Files:
runtime/src/kmp_runtime.c
Index: runtime/src/kmp_runtime.c
===================================================================
--- runtime/src/kmp_runtime.c
+++ runtime/src/kmp_runtime.c
@@ -1122,22 +1122,15 @@
// So, this code achieves what we need whether or not t_fp_control_saved is true.
// By checking whether the value needs updating we avoid unnecessary writes that would put the
// cache-line into a written state, causing all threads in the team to have to read it again.
- if ( team->t.t_x87_fpu_control_word != x87_fpu_control_word ) {
- team->t.t_x87_fpu_control_word = x87_fpu_control_word;
- }
- if ( team->t.t_mxcsr != mxcsr ) {
- team->t.t_mxcsr = mxcsr;
- }
+ KMP_CHECK_UPDATE(team->t.t_x87_fpu_control_word, x87_fpu_control_word);
+ KMP_CHECK_UPDATE(team->t.t_mxcsr, mxcsr);
// Although we don't use this value, other code in the runtime wants to know whether it should restore them.
// So we must ensure it is correct.
- if (!team->t.t_fp_control_saved) {
- team->t.t_fp_control_saved = TRUE;
- }
+ KMP_CHECK_UPDATE(team->t.t_fp_control_saved, TRUE);
}
else {
// Similarly here. Don't write to this cache-line in the team structure unless we have to.
- if (team->t.t_fp_control_saved)
- team->t.t_fp_control_saved = FALSE;
+ KMP_CHECK_UPDATE(team->t.t_fp_control_saved, FALSE);
}
}
@@ -2030,7 +2023,7 @@
}
#endif /* OMP_40_ENABLED */
kmp_r_sched_t new_sched = get__sched_2(parent_team, master_tid);
- if (team->t.t_sched.r_sched_type != new_sched.r_sched_type || new_sched.chunk != new_sched.chunk)
+ if (team->t.t_sched.r_sched_type != new_sched.r_sched_type || team->t.t_sched.chunk != new_sched.chunk)
team->t.t_sched = new_sched; // set master's schedule as new run-time schedule
#if OMP_40_ENABLED
@@ -4798,7 +4791,8 @@
// TODO???: team->t.t_max_active_levels = new_max_active_levels;
kmp_r_sched_t new_sched = new_icvs->sched;
- if (team->t.t_sched.r_sched_type != new_sched.r_sched_type || new_sched.chunk != new_sched.chunk)
+ if (team->t.t_sched.r_sched_type != new_sched.r_sched_type ||
+ team->t.t_sched.chunk != new_sched.chunk)
team->t.t_sched = new_sched; // set master's schedule as new run-time schedule
__kmp_reinitialize_team( team, new_icvs, root->r.r_uber_thread->th.th_ident );
@@ -4823,9 +4817,7 @@
__kmp_partition_places( team );
}
# else
- if ( team->t.t_proc_bind != new_proc_bind ) {
- team->t.t_proc_bind = new_proc_bind;
- }
+ KMP_CHECK_UPDATE(team->t.t_proc_bind, new_proc_bind);
# endif /* KMP_AFFINITY_SUPPORTED */
#endif /* OMP_40_ENABLED */
}
@@ -4855,7 +4847,9 @@
#endif // KMP_NESTED_HOT_TEAMS
team->t.t_nproc = new_nproc;
// TODO???: team->t.t_max_active_levels = new_max_active_levels;
- team->t.t_sched = new_icvs->sched;
+ if (team->t.t_sched.r_sched_type != new_icvs->sched.r_sched_type ||
+ team->t.t_sched.chunk != new_icvs->sched.chunk)
+ team->t.t_sched = new_icvs->sched;
__kmp_reinitialize_team( team, new_icvs, root->r.r_uber_thread->th.th_ident );
/* update the remaining threads */
@@ -4876,7 +4870,7 @@
#endif
#if OMP_40_ENABLED
- team->t.t_proc_bind = new_proc_bind;
+ KMP_CHECK_UPDATE(team->t.t_proc_bind, new_proc_bind);
# if KMP_AFFINITY_SUPPORTED
__kmp_partition_places( team );
# endif
@@ -5001,7 +4995,7 @@
#endif
#if OMP_40_ENABLED
- team->t.t_proc_bind = new_proc_bind;
+ KMP_CHECK_UPDATE(team->t.t_proc_bind, new_proc_bind);
# if KMP_AFFINITY_SUPPORTED
__kmp_partition_places( team );
# endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21897.62364.patch
Type: text/x-patch
Size: 3947 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160630/83d56555/attachment-0001.bin>
More information about the Openmp-commits
mailing list