-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[flang][OpenMP]Add parsing support for MAP(MAPPER(name) ...) #116274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ! RUN: not %flang_fc1 -emit-fir -fopenmp -fopenmp-version=50 %s 2>&1 | FileCheck %s | ||
| program p | ||
| integer, parameter :: n = 256 | ||
| real(8) :: a(256) | ||
| !! TODO: Add declare mapper, when it works to lower this construct | ||
| !!type t1 | ||
| !! integer :: x | ||
| !!end type t1 | ||
| !!!$omp declare mapper(xx : t1 :: nn) map(nn, nn%x) | ||
| !$omp target map(mapper(xx), from:a) | ||
| !CHECK: not yet implemented: OmpMapClause(MAPPER(...)) | ||
| do i=1,n | ||
| a(i) = 4.2 | ||
| end do | ||
| !$omp end target | ||
| end program p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| ! RUN: %flang_fc1 -fdebug-dump-symbols -fopenmp -fopenmp-version=50 %s | FileCheck %s | ||
| program main | ||
| !CHECK-LABEL: MainProgram scope: main | ||
| integer, parameter :: n = 256 | ||
| real(8) :: a(256) | ||
| !$omp target map(mapper(xx), from:a) | ||
| do i=1,n | ||
| a(i) = 4.2 | ||
| end do | ||
| !$omp end target | ||
| !CHECK: OtherConstruct scope: size=0 alignment=1 sourceRange=74 bytes | ||
| !CHECK: OtherClause scope: size=0 alignment=1 sourceRange=0 bytes | ||
| !CHECK: xx: Misc ConstructName | ||
| end program main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It reads a bit strangely to me that the optional mapper identifier looks non-optional (if one doesn't look up at the type definition). Could the
std::optionalbe moved outside of the type so it is visible here?Don't worry about it if it becomes a headache to do - this is very nitpicky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this was my solution to making the
maybework. Since we need to parse the"MAPPER"and thenparenthesized(name)and a comma. If I move the optional around, the maybe parsing doesn't work.Unless someone can let me know how to make something
maybeparse to produce the wrapper thing optional.Everything I've tried (and that's a lot - I couldn't list them all, but
std::optional<Name>in thestd::tuplewas one of them.The
TypeModifierandIteratorModiferandTypegets away with it, because they don't have a keyword with a parenthesized "argument". so they can just do a list (which is allowed to be empty).I did try again just now, but I can't come up with something that compiles...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way this was intended to work is that
std::optional<std::list<YourModifier>>to the tuple in here.ModParserlist in MapModifiers in openmp-parsers.cpp.makeMapClauseand pass it to theOmpMapClauseconstructor.Then in check-omp-structure.cpp you can verify that there is at most one mapper modifier in the list, and print a meaningful message.
Having said that, I'm working on modifier verification right now, which will change how they are organized and parsed, so it's not a big deal if you leave it as is, since I'll have to change it anyway. (One problem with the current code that I'm trying to address is that the modifiers can be specified in any order, which the current parsers don't allow.)