[Openmp-commits] [PATCH] D142247: Fix initialization of th_task_state on each thread on expanding hot teams.

Terry Wilmarth via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Feb 8 15:40:35 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG8d689e5bfde0: Fix initialization of th_task_state on each thread on expanding hot teams. (authored by tlwilmar).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142247/new/

https://reviews.llvm.org/D142247

Files:
  openmp/runtime/src/kmp_runtime.cpp


Index: openmp/runtime/src/kmp_runtime.cpp
===================================================================
--- openmp/runtime/src/kmp_runtime.cpp
+++ openmp/runtime/src/kmp_runtime.cpp
@@ -5445,21 +5445,10 @@
         __kmp_initialize_info(team->t.t_threads[f], team, f,
                               __kmp_gtid_from_tid(f, team));
 
-      if (level) { // set th_task_state for new threads in nested hot team
-        // __kmp_initialize_info() no longer zeroes th_task_state, so we should
-        // only need to set the th_task_state for the new threads. th_task_state
-        // for primary thread will not be accurate until after this in
-        // __kmp_fork_call(), so we look to the primary thread's memo_stack to
-        // get the correct value.
-        for (f = old_nproc; f < team->t.t_nproc; ++f)
-          team->t.t_threads[f]->th.th_task_state =
-              team->t.t_threads[0]->th.th_task_state_memo_stack[level];
-      } else { // set th_task_state for new threads in non-nested hot team
-        // copy primary thread's state
-        kmp_uint8 old_state = team->t.t_threads[0]->th.th_task_state;
-        for (f = old_nproc; f < team->t.t_nproc; ++f)
-          team->t.t_threads[f]->th.th_task_state = old_state;
-      }
+      // set th_task_state for new threads in hot team with older thread's state
+      kmp_uint8 old_state = team->t.t_threads[old_nproc - 1]->th.th_task_state;
+      for (f = old_nproc; f < team->t.t_nproc; ++f)
+        team->t.t_threads[f]->th.th_task_state = old_state;
 
 #ifdef KMP_DEBUG
       for (f = 0; f < team->t.t_nproc; ++f) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142247.495975.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230208/49e8a80c/attachment.bin>


More information about the Openmp-commits mailing list