[PATCH] D144634: [Clang][OpenMP] Support for Code Generation of loop bind clause

Sunil K via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 6 03:10:22 PST 2023


koops added inline comments.


================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:7791
+    OpenMPBindClauseKind bindParam = C->getBindKind();
+    switch (bindParam) {
+    case OMPC_BIND_parallel: {
----------------
carlo.bertolli wrote:
> What if you have something like this:
> 
> void foo(..) {
>   #pragma omp loop
>   for (..) {
>   }
> }
> 
> int main() {
> 
>   #pragma omp target teams
>   {
>     ...
>     foo();
>    }
> 
>   #pragma omp target
>    {
>       #pragma omp parallel
>       {
>          foo();
>       }
> }
> 
> In the first invocation, loop is bound to teams. In the second, loop is bound to parallel.
> This is a runtime condition.
> 
> I *believe* that not even OpenMP 6.0 TR1 allows us to decide at compile time if loop should be treated as worksharing or workdistribution....but I might be wrong.
> 
> Thanks!
The loop directive does not have a bind clause. If you examine the current patch it takes care to preserve the old structure as is and the binding is done by default during runtime.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144634



More information about the cfe-commits mailing list