[PATCH] D120573: [OpenMP] Support runtime user conditions in metadirective

Giorgis Georgakoudis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 5 14:10:42 PDT 2022

ggeorgakoudis added a comment.

In D120573#3415517 <https://reviews.llvm.org/D120573#3415517>, @abidmalikwaterloo wrote:

> Are you going to work on it? Just confirming. I am working on D122255 <https://reviews.llvm.org/D122255>. The code generation part for the dynamic condition is useful. However, my understanding is that it is not according to the OpenMP 5.2 specification. Correct me if I am wrong.

I'm happy if you'd like to take over in your patch. I'm not sure what is the issue with the OpenMP 5.2 but feel free to re-use/modify parts of this patch. One thing that is problematic with this patch is the need to re-set the tokens in the lexer/parser to their unannotated versions when tentative parsing. The code in the patch is not fault-proof but I have an update for that that I can post, if that's useful. In D122255 <https://reviews.llvm.org/D122255> I see you're taking the route of parsing the associated statement which has its own pitfalls but maybe that's the best approach.

Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:1852
+    int BestIdx = getBestVariantMatchForContext(StaticVMIs, OMPCtx);
+    EmitStmt(StaticWhenClauses[BestIdx]->getDirective());
abidmalikwaterloo wrote:
> ggeorgakoudis wrote:
> > abidmalikwaterloo wrote:
> > > This approach is valid for static conditions. How you are going to take care of multiple dynamic/runtime conditions?
> > See GenerateCond that creates code for dynamic conditions. If the when clause has dynamically evaluated conditions it generates basicblocks and control logic.
> Why get a score for static when clauses for the best clause? Is it according to OpenMP specification?
Because if no runtime conditions evaluate to true then it falls back to the static when with the highest score. I'm not sure about the OpenMP specification. Do you have an example? Could you point me to the related part in the specification it fails to conform to?

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list