[Openmp-commits] [PATCH] D21558: Bug fix for hang when tasks used in nested parallel.

Terry Wilmarth via Openmp-commits openmp-commits at lists.llvm.org
Tue Jun 21 09:44:19 PDT 2016


tlwilmar created this revision.
tlwilmar added reviewers: jlpeyton, AndreyChurbanov.
tlwilmar added a subscriber: openmp-commits.
tlwilmar set the repository for this revision to rL LLVM.

Bug fix for hang when omp task and nested parallelism used together.
Still some problem remains with task state saving/restoring, but
user's case works fine now.  All tasking unit tests passed as well.

Patch by Andrey Churbanov


Repository:
  rL LLVM

http://reviews.llvm.org/D21558

Files:
  runtime/src/kmp_runtime.c

Index: runtime/src/kmp_runtime.c
===================================================================
--- runtime/src/kmp_runtime.c
+++ runtime/src/kmp_runtime.c
@@ -1459,8 +1459,8 @@
 
     // Nested level will be an index in the nested nthreads array
     level         = parent_team->t.t_level;
-#if OMP_40_ENABLED
     active_level  = parent_team->t.t_active_level; // is used to launch non-serial teams even if nested is not allowed
+#if OMP_40_ENABLED
     teams_level    = master_th->th.th_teams_level; // needed to check nesting inside the teams
 #endif
 #if KMP_NESTED_HOT_TEAMS
@@ -2051,7 +2051,7 @@
                       __kmp_gtid_from_thread( master_th ), master_th->th.th_task_team,
                       parent_team, team->t.t_task_team[master_th->th.th_task_state], team ) );
 
-        if ( level || master_th->th.th_task_team ) {
+        if ( active_level || master_th->th.th_task_team ) {
             // Take a memo of master's task_state
             KMP_DEBUG_ASSERT(master_th->th.th_task_state_memo_stack);
             if (master_th->th.th_task_state_top >= master_th->th.th_task_state_stack_sz) { // increase size
@@ -2074,7 +2074,7 @@
             master_th->th.th_task_state_memo_stack[master_th->th.th_task_state_top] = master_th->th.th_task_state;
             master_th->th.th_task_state_top++;
 #if KMP_NESTED_HOT_TEAMS
-            if (team == master_th->th.th_hot_teams[level].hot_team) { // Restore master's nested state if nested hot team
+            if (team == master_th->th.th_hot_teams[active_level].hot_team) { // Restore master's nested state if nested hot team
                 master_th->th.th_task_state = master_th->th.th_task_state_memo_stack[master_th->th.th_task_state_top];
             }
             else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21558.61393.patch
Type: text/x-patch
Size: 1761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160621/a9c1ea26/attachment.bin>


More information about the Openmp-commits mailing list