[Mlir-commits] [flang] [mlir] [flang][OpenMP] Support for "!$omp dispatch". (PR #203320)

Abid Qadeer llvmlistbot at llvm.org
Mon Aug 17 10:52:21 PDT 2026


================
@@ -578,6 +580,63 @@ Fortran::lower::genCallOpAndResult(
     funcType = *modifiedFuncType;
   }
 
+  // OpenMP dispatch `novariants`/`nocontext`: at runtime pick the right target
+  // via an indirect call, evaluating arguments once. All candidate procedures
+  // share one signature; revisit if declare-variant `adjust_args`/`append_args`
+  // land.
----------------
abidh wrote:

I've opened #216781 as a draft: it implements run-time user conditions on declare variant (match(user={condition(expr)}) where the expression isn't a constant), by resolving the variants into a ranked candidate list and lowering the call as an if/else cascade of direct calls with the base as the fallback. 

My suggestion is that dispatch reuse the cascade rather than add a second run-time selection mechanism: novariants as a condition that forces the base, nocontext as a re-ranking with the dispatch construct removed. Each branch then stays a direct call, which also avoids the indirect-call limitation for adjust_args/append_args. 

https://github.com/llvm/llvm-project/pull/203320


More information about the Mlir-commits mailing list