-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Flang][OpenMP] Align map clause generation and fix issue with non-shared allocations for assumed shape/size descriptor types #97855
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
2 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
Oops, something went wrong.
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.
@jeanPerier @tblah I am not the most familiar with HLFIR (or FIR) yet unfortunately, however, I was interested in knowing if there was any possible side effects of utilising the memref/input from a HLFIR declare operation as opposed to the other possible result which seems to carry more information?
I believe, at least for the moment, we don't need the extra information provided by the HLFIR DeclareOp's other result from my (possibly flawed) understanding, As we already generate and carry the bounds around as part of the MapInfoOp, and we don't need any further information it currently provides from what I can tell. The main benefit of utilising the rawInput (result 1, of the declare op when there, otherwise just the symbol adcress) is it simplifies the maps we generate in certain scenarios as we end up processing less BoxTypes (as in certain cases, the HLFIR declare op's result 0 provides the more complex to map BoxType as opposed to the simpler original input type, presumably to help carry more information).
Essentially wondering if utilising the rawInput in all cases (at least that we currently handle) seems reasonable and sane from a FIR/HLFIR perspective. If we ever required the more complex result, it would be possible to do so, just with a slight extra layer of complexity to the lowering and a (likely mild) performance hit from extra mappings in certain cases.
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.
Yeah if you are sure you don't need the extra information, using the raw input will avoid unnecessary embox operations etc (for the unused result).
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.
Thank you very much @tblah, at least for the moment I don't believe we need the extra information (and testing against the little local map test suite I have made it seems to function as correctly as it did previously), as we tend to package the bounds as a seperate input to Map Info and at least for the moment that's all we care about, it could change in the future but we can likely cross that bridge if/when we come to a situation that requires it.
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.
I concur with Tom. If you are not directly mapping this "raw" value to the symbol in the OpenMP context, and are not using hlfir tools with this value, you are fine.
Uh oh!
There was an error while loading. Please reload this page.
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.
Thank you very much @jeanPerier! In this case, as the target region is IFA, there's a block argument generation and symbol rebinding that occurs for all map.info operations to corresponding block arguments (that correspond to symbols used inside of the region). However, this binding only extends for the scope of the target region and seems to not pose a problem when utilising the "raw" value as the map input. Would this be something you think would cause an issue (from testing so far, it doesn't appear to)?
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.
As long as this new binding inside the OpenMP region happens by generating a new hlfir.declare with the non default lower bounds (also passed as block arguments?), then it is fine, even if the hlfir.declare input is the "raw" value (just like outside of the OpenMP region).
If you tested something like with n different from 1, you are fine:
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.
Thank you very much @jeanPerier, I took your test and expanded it a bit into a full program, it seems to function as I would expect (although, I am far from a Fortran expert) providing the same results when there is a target region and when there's not.
From IR introspection, it does appear we create a hlfir.declare inside of the target region, and specify a shapeshift (lower bound and extent) calculated from mapped in bounds information.
So, it seems if the above assessment is correct, using the raw input for the moment is fine. At least from a correctness perspective, I am not sure which would come with a higher performance tax (if either).