This is an archive of the discontinued LLVM Phabricator instance.

[flang][OpenMP] Add parser support for order clause
ClosedPublic

Authored by kavitha-natarajan on Jan 25 2023, 12:27 AM.

Details

Summary

Added parser support for OpenMP 5.0 feature ORDER(CONCURRENT) clause for the following OpenMP directives:
do
"simd"
do simd
parallel do
parallel do simd
target simd
target parallel do
target parallel do simd
teams distribute simd
teams distribute parallel do
teams distribute parallel do simd
target teams distribute simd
target teams distribute parallel do
target teams distribute parallel do simd
taskloop simd

Other OpenMP directives that are not yet supported by flang which has order(concurrent) clause:
loop
parallel loop
target parallel loop
teams loop
target teams loop
masked taskloop simd
parallel masked taskloop simd

Diff Detail

Event Timeline

kavitha-natarajan requested review of this revision.Jan 25 2023, 12:27 AM
kavitha-natarajan edited the summary of this revision. (Show Details)Jan 25 2023, 12:31 AM
kavitha-natarajan edited the summary of this revision. (Show Details)

Updated line number in flang/test/Examples/omp-order-clause.f90

Looks good.
There are changes to this clause in 5.1 and later standards with an order-modifier added and the order clause applying to constructs like the distribute construct. Is the plan to add these later?

flang/lib/Parser/unparse.cpp
2626

OMP ORDER -> OMP order-type

Looks good.
There are changes to this clause in 5.1 and later standards with an order-modifier added and the order clause applying to constructs like the distribute construct. Is the plan to add these later?

Thanks for reviewing. Currently, we are planning to support OpenMP 5.0 which does not have order-modifier. But I can add the parser support as this is the only change that would be required for order clause support. I shall update the patch with this change.
If I understand correctly, DISTRIBUTE region has to be strictly nested inside TEAMS region. In that case, I have added support for 'TEAMS DISTRIBUTE' and 'TARGET TEAMS DISTRIBUTE' constructs.

Enhanced ORDER(concurrent) clause to support OpenMP 5.1 feature which adds an optional order-modifier, such as, ORDER( [order-modifier :] concurrent ), where order-modifier can be 'reproducible' or 'unconstrained'.

LGTM. Thanks for your first patch in Flang and welcome.

Two Nit comments inline.

flang/test/Parser/omp-order-clause02.f90
1 ↗(On Diff #499068)

Nit: Use test_errors.py for error tests.

llvm/include/llvm/Frontend/OpenMP/OMP.td
2008

Nit: Isn't this also 50?

This revision is now accepted and ready to land.Feb 21 2023, 3:14 AM

LGTM. Thanks for your first patch in Flang and welcome.

Two Nit comments inline.

Thank you!

flang/test/Parser/omp-order-clause02.f90
1 ↗(On Diff #499068)

test_errors.py and its modules are located in flang/test/Semantics/ directory. All the error tests in Parser directory are written this way. Do you think we should start using test_errors.py for all error tests? If so, we may have to relocate the scripts from Semantics directory. Please let me know your comments.

llvm/include/llvm/Frontend/OpenMP/OMP.td
2008

Yes, will change it.

flang/test/Parser/omp-order-clause02.f90
1 ↗(On Diff #499068)

I believe this is a Semantics error, so you can move the test itself to the Semantics directory.

flang/test/Parser/omp-order-clause02.f90
1 ↗(On Diff #499068)

Sure. I agree.

Applied review comments.

This revision was landed with ongoing or failed builds.Feb 21 2023, 6:01 AM
This revision was automatically updated to reflect the committed changes.