[all-commits] [llvm/llvm-project] 981012: [flang][OpenMP] Support lowering of metadirective ...
Chi-Chun, Chen via All-commits
all-commits at lists.llvm.org
Tue Jun 2 14:56:49 PDT 2026
Branch: refs/heads/users/cchen/flang-metadirective-dynamic-user-cond
Home: https://github.com/llvm/llvm-project
Commit: 9810122ecd0918db74c3efaf533e0fcc4242049f
https://github.com/llvm/llvm-project/commit/9810122ecd0918db74c3efaf533e0fcc4242049f
Author: Chi Chun, Chen <chichun.chen at hpe.com>
Date: 2026-06-02 (Tue, 02 Jun 2026)
Changed paths:
M flang/lib/Lower/OpenMP/OpenMP.cpp
R flang/test/Lower/OpenMP/Todo/metadirective-dynamic.f90
M flang/test/Lower/OpenMP/metadirective-user.f90
Log Message:
-----------
[flang][OpenMP] Support lowering of metadirective (part 2)
Lower non-constant user={condition(expr)} selectors in metadirectives
to a fir.if/else chain.
Only statically applicable when-clauses participate in dynamic
selection. Dynamic conditions are evaluated at runtime in declaration
order, with the best static match, an explicit otherwise/default
clause, or implicit nothing as the final fallback.
This patch is part of the feature work for #188820.
Assisted with copilot and GPT-5.4
Commit: 40fd4d8a840b6627dd5a1368c578c7be42fed7d4
https://github.com/llvm/llvm-project/commit/40fd4d8a840b6627dd5a1368c578c7be42fed7d4
Author: chichunchen <chichunchen844 at gmail.com>
Date: 2026-06-02 (Tue, 02 Jun 2026)
Changed paths:
M flang/lib/Lower/OpenMP/OpenMP.cpp
M flang/test/Lower/OpenMP/metadirective-user.f90
Log Message:
-----------
Fix dynamic metadirective candidate selection
- Use one scored candidate path for static and dynamic metadirective variants.
- Dynamic user conditions are statically filtered and scored using their
non-user traits, then guarded at runtime with fir.if.
- Keeps construct/device/implementation traits enforced for dynamic
candidates and lets higher-scored static candidates beat lower-scored dynamic
candidates.
- Add regressions for construct mismatch, score ordering, and
implicit-nothing tie-breaking.
Commit: fe999a970d276e06658e841921cdee4e8c8e88ae
https://github.com/llvm/llvm-project/commit/fe999a970d276e06658e841921cdee4e8c8e88ae
Author: Chi Chun, Chen <chichun.chen at hpe.com>
Date: 2026-06-02 (Tue, 02 Jun 2026)
Changed paths:
M flang/lib/Lower/OpenMP/OpenMP.cpp
M flang/test/Lower/OpenMP/metadirective-user.f90
Log Message:
-----------
Clarify dynamic metadirective selection lowering
Explain that statically applicable variants are ranked before dynamic
user conditions. When a dynamic condition is selected, it is lowered to a
runtime branch whose else region continues selection among the remaining
candidates.
Add a begin/end variant test that includes clauses, and tighten checks
for the empty `nothing` fallback.
Commit: 13783719ef9d42d2705a9d8a0a5ad5812fa9ebd1
https://github.com/llvm/llvm-project/commit/13783719ef9d42d2705a9d8a0a5ad5812fa9ebd1
Author: Chi Chun, Chen <chichun.chen at hpe.com>
Date: 2026-06-02 (Tue, 02 Jun 2026)
Changed paths:
M flang/lib/Lower/OpenMP/OpenMP.cpp
M flang/lib/Lower/OpenMP/Utils.cpp
M flang/lib/Lower/OpenMP/Utils.h
M flang/test/Lower/OpenMP/metadirective-user.f90
Log Message:
-----------
Place dynamic condition cleanups before branching
A dynamic user condition can create expression temporaries before the
selected variant is lowered. For example, a metadirective condition
such as:
when(user={condition(getbool("hello"))}: barrier)
passes a character literal through an associated temporary. That
temporary belongs to evaluating the condition, so it must be cleaned
up before lowering enters the generated fir.if that selects between
variants.
Finalize the statement context after evaluating the condition and
before creating the branch. Keep the condition expression and source
location together as DynamicUserCondition, use that source for
generated operations, and add a regression for the temporary-producing
condition case.
Commit: f07706dd1919d788e1661cf7c1e96be2956f95c0
https://github.com/llvm/llvm-project/commit/f07706dd1919d788e1661cf7c1e96be2956f95c0
Author: Chi Chun, Chen <chichun.chen at hpe.com>
Date: 2026-06-02 (Tue, 02 Jun 2026)
Changed paths:
M flang/lib/Lower/OpenMP/OpenMP.cpp
M flang/test/Lower/OpenMP/metadirective-user.f90
Log Message:
-----------
Preserve dynamic user condition scores for variant ranking
Dynamic user conditions are bypassed during static applicability
filtering, but their scores must still influence variant ordering.
Previously, the filtering VMI removed `user_condition_unknown`,
inadvertently dropping the score attached to
`user={condition(score(...): expr)}`.
We now preserves that score in the ranking VMI by transferring
any non-zero dynamic condition score onto `user_condition_true`. The
runtime condition remains separate and correctly lowers as a `fir.if`
guard for the selected variant.
Variant ordering now correctly prioritizes scored conditions over
lexically earlier unscored conditions or static fallbacks:
```
if (high) barrier
else if (low) taskyield
else taskwait
```
Added a regression test to verify this ordering.
Commit: 28c61e556237b36d885ead382e88a86e1f483894
https://github.com/llvm/llvm-project/commit/28c61e556237b36d885ead382e88a86e1f483894
Author: Chi Chun, Chen <chichun.chen at hpe.com>
Date: 2026-06-02 (Tue, 02 Jun 2026)
Changed paths:
M flang/lib/Lower/OpenMP/OpenMP.cpp
M flang/test/Lower/OpenMP/metadirective-user.f90
M flang/test/Semantics/OpenMP/metadirective-user.f90
Log Message:
-----------
Preserve dynamic user condition ranking
Non-constant user={condition(expr)} selectors use expr only for runtime
dispatch, so do not let it affect static applicability. Split the VMI:
static: compile-time traits, with runtime user_condition_unknown removed
ranking: static traits + user_condition_{true|unknown} [score] for explicit variants
lowering: if (expr) variant else next candidate
Use the static VMI for applicability and the ranking VMI for score/subset
specificity, so vendor(llvm), user={condition(flag)} still ranks above
vendor(llvm) and keeps any explicit score(...), even when condition(flag)
is unscored.
For extension(match_none), rank with user_condition_unknown instead of
user_condition_true since the latter is active in OMPContext and would
make the candidate reject itself.
Repeated condition traits are rejected semantically, so lowering never has
to choose between multiple runtime expressions in one user selector.
Compare: https://github.com/llvm/llvm-project/compare/47eee1d47716...28c61e556237
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list