[Openmp-commits] [PATCH] D21897: Fix checks on schedule struct

Jonathan Peyton via Openmp-commits openmp-commits at lists.llvm.org
Fri Jul 1 11:01:36 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL274371: Fix checks on schedule struct (authored by jlpeyton).

Changed prior to commit:
  http://reviews.llvm.org/D21897?vs=62364&id=62511#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21897

Files:
  openmp/trunk/runtime/src/kmp_runtime.c

Index: openmp/trunk/runtime/src/kmp_runtime.c
===================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c
+++ openmp/trunk/runtime/src/kmp_runtime.c
@@ -1124,22 +1124,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);
     }
 }
 
@@ -2032,7 +2025,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
@@ -4800,7 +4793,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 );
@@ -4825,9 +4819,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 */
         }
@@ -4857,7 +4849,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 */
@@ -4878,7 +4872,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
@@ -5003,7 +4997,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.62511.patch
Type: text/x-patch
Size: 3986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160701/1bb6942d/attachment.bin>


More information about the Openmp-commits mailing list