[Openmp-commits] [PATCH] D77609: [OpenMP][WIP] Added the support for unshackled task in RTL

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Sep 1 09:54:23 PDT 2020


tianshilei1992 added inline comments.


================
Comment at: openmp/runtime/src/kmp_tasking.cpp:3771
+  if (task_team)
+    while (KMP_ATOMIC_LD_ACQ(&task_team->tt.tt_unfinished_unshackled_tasks))
+      ;
----------------
adurang wrote:
> tianshilei1992 wrote:
> > tianshilei1992 wrote:
> > > adurang wrote:
> > > > It seems to me that this is forcing any taskwait (and possibly taskgroup) to wait for any outstanding "async target" that exist on the team irrespectively of being a part of that synchronization domain or not. 
> > > Not any async target. Only those created in the team.
> > Sorry I still didn't understand this part. Could you please expatiate it?
> 
> For the code below:
> 
> ```
> #pragma omp parallel num_threads(2)
> {
> #pragma omp target nowait
>    blah()
> #pragma omp taskwait
> }
> ```
> 
> With your current code (because you're using a shared counter for the whole team), both thread 1 and 2 are waiting for each others target regions ( so for example, even if target-th1 was finished thread1 would be blocked until target-th2 was completed). Each taskwait should only be waiting for their own child target tasks. 
> 
> Hope this helps.
Thanks for the explanation. But this lines of code are in the function `__kmp_task_team_wait` that is not called by `__kmpc_omp_taskwait`. If I understand correctly, `__kmp_task_team_wait` is called by the master thread of a team to wait for all tasks created in the team to finish so that it can proceed. So we need to wait for all unshackled tasks encountered/created in the task team.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77609/new/

https://reviews.llvm.org/D77609



More information about the Openmp-commits mailing list