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

Carlo Bertolli via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 16:02:14 PST 2023


carlo.bertolli added inline comments.


================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:7791
+    OpenMPBindClauseKind bindParam = C->getBindKind();
+    switch (bindParam) {
+    case OMPC_BIND_parallel: {
----------------
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!


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