[Openmp-commits] [PATCH] D23115: __kmp_free_task: Fix for serial explicit tasks producing proxy tasks

Jonas Hahnfeld via Openmp-commits openmp-commits at lists.llvm.org
Thu Aug 4 08:04:58 PDT 2016

Hahnfeld added inline comments.

Comment at: runtime/src/kmp_tasking.c:599
@@ -603,3 +598,3 @@
         // instead of walking up ancestor tree to avoid premature deallocation of ancestors.
-        if ( team_or_tasking_serialized || taskdata -> td_flags.tasktype == TASK_IMPLICIT )
+        if ( taskdata -> td_flags.tasktype == TASK_IMPLICIT )
AndreyChurbanov wrote:
> This change breaks the following code:
>   #pragma omp task
>   {
>     #pragma omp task
>     {
>     }
>   }
> The problem is that for a serial task its parent task is most likely still running and thus cannot be freed prematurely.
> To me, the correct fix would be to remember the status of initial task at the beginning of the routine, e.g.
>   kmp_int32 task_serial = taskdata->td_flags.task_serial;
> then in the loop check this condition:
>         if ( task_serial || taskdata -> td_flags.tasktype == TASK_IMPLICIT )
>             return;
> I think checking task_serial flag here is better than team_serial or tasking_serial (as was done before the change), because a task can be serialized even if team is active and tasking is active (e.g. no room in thread's task queue).
I'm afraid your proposal doesn't work as expected: I've just committed another test for nested task creation (I thought there already was one) and it will fail with this patch. Will have a deeper look at it tomorrow


More information about the Openmp-commits mailing list