[Openmp-commits] [openmp] r285678 - Add more conditions to check whether task waiting is necessary in kmp_omp_taskwait.

Andrey Churbanov via Openmp-commits openmp-commits at lists.llvm.org
Tue Nov 1 01:33:36 PDT 2016


Author: achurbanov
Date: Tue Nov  1 03:33:36 2016
New Revision: 285678

URL: http://llvm.org/viewvc/llvm-project?rev=285678&view=rev
Log:
Add more conditions to check whether task waiting is necessary in kmp_omp_taskwait.

Differential Revision: https://reviews.llvm.org/D26058

Patch by Victor Campos

Modified:
    openmp/trunk/runtime/src/kmp_tasking.c

Modified: openmp/trunk/runtime/src/kmp_tasking.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_tasking.c?rev=285678&r1=285677&r2=285678&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_tasking.c (original)
+++ openmp/trunk/runtime/src/kmp_tasking.c Tue Nov  1 03:33:36 2016
@@ -1480,13 +1480,13 @@ __kmpc_omp_taskwait( ident_t *loc_ref, k
             __kmp_itt_taskwait_starting( gtid, itt_sync_obj );
 #endif /* USE_ITT_BUILD */
 
+        bool must_wait = ! taskdata->td_flags.team_serial && ! taskdata->td_flags.final;
+
 #if OMP_45_ENABLED
-        if ( ! taskdata->td_flags.team_serial || (thread->th.th_task_team != NULL && thread->th.th_task_team->tt.tt_found_proxy_tasks) )
-#else
-        if ( ! taskdata->td_flags.team_serial )
+        must_wait = must_wait || (thread->th.th_task_team != NULL && thread->th.th_task_team->tt.tt_found_proxy_tasks);
 #endif
+        if (must_wait)
         {
-            // GEH: if team serialized, avoid reading the volatile variable below.
             kmp_flag_32 flag(&(taskdata->td_incomplete_child_tasks), 0U);
             while ( TCR_4(taskdata -> td_incomplete_child_tasks) != 0 ) {
                 flag.execute_tasks(thread, gtid, FALSE, &thread_finished




More information about the Openmp-commits mailing list