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

Andrey Churbanov via Openmp-commits openmp-commits at lists.llvm.org
Thu Aug 4 07:33:42 PDT 2016

AndreyChurbanov requested changes to this revision.
This revision now requires changes to proceed.

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 )
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 )

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).


More information about the Openmp-commits mailing list