[PATCH] D78075: [WIP][Clang][OpenMP] Added support for nowait target in CodeGen

Ye Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 14 18:11:04 PDT 2020


ye-luo added a comment.

In D78075#2272474 <https://reviews.llvm.org/D78075#2272474>, @tianshilei1992 wrote:

> In D78075#2272398 <https://reviews.llvm.org/D78075#2272398>, @ye-luo wrote:
>
>>> However, OpenMP task has a problem that it must be within
>>> to a parallel region; otherwise the task will be executed immediately. As a
>>> result, if we directly wrap to a regular task, the nowait target outside of a
>>> parallel region is still a synchronous version.
>>
>> The spec says an implicit task can be generated by an implicit parallel region which can be the whole OpenMP program. For this reason, the need of explicit parallel region is a limitation of the llvm OpenMP runtime, right?
>>
>> Can I have an option to run the nowait region as a regular task instead of an unshackled task? So I can use "parallel" and well established ways to control the thread affinity.
>
> According to the spec, an implicit parallel region is an inactive parallel region that is not generated from a parallel construct. And based on the definition of active parallel region, which is a parallel region that is executed by a team consisting of more than one thread, an inactive parallel region only has one thread. Since we only have one thread, if we encounter a task, executing it immediately does make sense as we don't have another thread to execute it.

If I remember correctly, you may yield the thread inside a target region after enqueuing kernels and transfers. So even with 1 thread, there is chance to run other tasks without finishing this target. Isn't that possible?

> I do remember your request about the regular task. This patch is exactly what you need. Later when I finish the RTL, I could provide an option.

Thanks. I see, we will be able to control that in the runtime library.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78075



More information about the cfe-commits mailing list