[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
Mon Mar 6 06:50:13 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: {
----------------
koops wrote:
> 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.
Do you mean that this patch adds up to existing support - adding support for bind - and that existing support is already based on runtime support to decide on the case I mentioned?


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