[Openmp-commits] [PATCH] D26058: Add more conditions to check whether task waiting is necessary in kmp_omp_taskwait()

Victor Campos via Openmp-commits openmp-commits at lists.llvm.org
Thu Oct 27 18:25:51 PDT 2016


vhscampos created this revision.
vhscampos added reviewers: jcownie, jlpeyton.
vhscampos added a subscriber: openmp-commits.

From:

- comment in file kmp_tasking.c line 1489
- file kmp_taskdeps.cpp line 558
- file kmp_taskdeps.cpp line 491

I consider that, not only 'team_serial', but also 'tasking_ser' and 'final' flags from kmp_taskdata_t should be used to determine whether it's necessary to read the volatile flag.

By the same logic used in wait_deps and task_with_deps, any of these three flags being set is a sufficient condition for the task to skip the waiting.

Please let me know your opinions. Thanks.


https://reviews.llvm.org/D26058

Files:
  runtime/src/kmp_tasking.c


Index: runtime/src/kmp_tasking.c
===================================================================
--- runtime/src/kmp_tasking.c
+++ runtime/src/kmp_tasking.c
@@ -1480,13 +1480,13 @@
             __kmp_itt_taskwait_starting( gtid, itt_sync_obj );
 #endif /* USE_ITT_BUILD */
 
+        bool must_wait = ! taskdata->td_flags.team_serial && ! taskdata->td_flags.tasking_ser && ! 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26058.76151.patch
Type: text/x-patch
Size: 1093 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20161028/ec6a5c3e/attachment.bin>


More information about the Openmp-commits mailing list