This is an archive of the discontinued LLVM Phabricator instance.

[flang] OpenMP allocate directive parse tree fix
ClosedPublic

Authored by elmcdonough on Apr 14 2023, 9:59 PM.

Details

Summary

Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:

ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate

After rewriting:

ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate

Co-authored-by: Isaac Perry <isaac.perry@arm.com>

Diff Detail

Event Timeline

elmcdonough created this revision.Apr 14 2023, 9:59 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
elmcdonough requested review of this revision.Apr 14 2023, 9:59 PM

Note: Sometimes declarative OpenMP directives aren't able to be read when there isn't a ExecutionPartConstruct to end the SpecificationPart parsing. In these cases, declarative allocation directives are appended to the end of the SpecificationPart instead of at the beginning of the ExecutionPart. I have local changes that address this, but I excluded them because they would cause the XFAIL test test/Semantics/OpenMP/allocate06.f90 to succeed.

If this is a whitespace sensitive issue, it might require changing how the directive grammar outlined in lib/Parser/openmp-parsers.cpp.

Thanks @elmcdonough for the patch.

Did you mean this does the same as D104391? Since the change is motivated by changes in the other patches, could you add the other authors as co-authors?
Could you expand the Summary to describe the transformation?
Could you add more tests?

elmcdonough edited the summary of this revision. (Show Details)
elmcdonough added a subscriber: I_Perry.

Added another test and updated the patch description.

I'm not sure how to add co-authors in Phabricator, but I can make sure to add @I_Perry as a co-author in the staged commit. I would just need their GitHub username. Is there a Phabricator feature that allows me to directly add another author to this revision?

Thanks @elmcdonough. I am having a look at the patch today.

Regarding adding co-author: You can probably just add
Co-authored-by: Isaac Perry <isaac.perry@arm.com>

kiranchandramohan accepted this revision.May 4 2023, 1:42 PM

Nice. Looks mostly fine. I have some comments about the test. Could you fix?
Conditionally accepting subject to fixing the tests.

flang/test/Parser/OpenMP/allocate-tree-spec-part.f90
13

Shouldn't z have to be allocated in the enclosed allocate statement for this test to be valid?

14

What is a here, it is not declared?

flang/test/Parser/OpenMP/allocate-tree.f90
15

z has to be in the enclosed allocate statement.

16

What is a here, it is not declared?

This revision is now accepted and ready to land.May 4 2023, 1:42 PM

Updated the tests to be semantically sound and added an unparse test.

elmcdonough marked an inline comment as done.May 5 2023, 11:01 AM

@kiranchandramohan Please let me know if these changes look good when you get the chance.

This revision was automatically updated to reflect the committed changes.
elmcdonough edited the summary of this revision. (Show Details)May 5 2023, 12:43 PM

I apologize for the amount of reverts. Arcanist kept stripping out the co-author information when I landed my changes. My latest commit contains the co-author information (Co-authored-by: Isaac Perry <isaac.perry@arm.com>) in the commit message body, but Isaac doesn't show up as a co-author in the UI because of formatting restrictions:

Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate

After rewriting:
ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate

Co-authored-by: Isaac Perry <isaac.perry@arm.com> <--- Where the co-author line is

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D148409


 <--- Where the co-author line should be to show up in UI

I would like to emphasize that Isaac is credited in the commit message. I just wanted to make sure this is okay @kiranchandramohan

I apologize for the amount of reverts. Arcanist kept stripping out the co-author information when I landed my changes. My latest commit contains the co-author information (Co-authored-by: Isaac Perry <isaac.perry@arm.com>) in the commit message body, but Isaac doesn't show up as a co-author in the UI because of formatting restrictions:

Addresses the same issue as the following abandoned revision: D104391.

Rewrite leading declarative allocations so they are nested within their respective executable allocate directive

Original:
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPDeclarativeAllocate
ExecutionPartConstruct -> OpenMPExecutableAllocate

After rewriting:
ExecutionPartConstruct -> OpenMPExecutableAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate
| ExecutionPartConstruct -> OpenMPDeclarativeAllocate

Co-authored-by: Isaac Perry <isaac.perry@arm.com> <--- Where the co-author line is

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D148409


 <--- Where the co-author line should be to show up in UI

I would like to emphasize that Isaac is credited in the commit message. I just wanted to make sure this is okay @kiranchandramohan

If you want the co author line to be the last you have to land it by hand (without arcanist)

Thank you @clementval, that did the trick. I apologize for this whole situation.