-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang][OpenMP] Do not skip privatization of linear variable if it is OmpPreDetermined #144315
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
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.
If FIR can privatize LINEAR symbols correctly, why are we using OpenMPIRBuilder? If it cannot (as the comment below suggests), why are we skipping these?
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.
While working on lowering and translation of linear clause, I observed that Flang Semantics marks
OmpLinear
as a symbol to be privatised, whichcollectSymbolsForPrivatization
fetches and privatizes. But it does not add code for any of the other linear semantics: (1) adding linear step based on the loop iteration, (2) generating code for finalization based on the last loop iteration, (3) storing the final variable value to its actual storage in the final iteration, and (4) emitting synchronization barrier. These four tasks had to be newly implemented; I added relevant functionality in the IRBuilder for these. Also, tasks (2) and (3) require knowledge of%lastiter
variable of the canonical loop; I am not sure if FIR has access to this or an equivalent.I think it would have been possible to let the FIR lowering continue with privatization here, and pass a tuple
(linear-var MLIR value, private-copy MLIR value)
to the IRBuilder to allow it to operate upon the two. But I thought it to be cleaner that all functionality wrt. linear semantics to be contained within the IRBuilder (hence added a new classLinearClauseProcessor
in #139386).I can perhaps modify the comment to reflect that while the FIR can privatize the linear variables, it is cleaner to simply let IRBuilder do so.
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.
Plus, in case we privatize during FIR lowering and then delegate rest of the functionality to
LinearClauseProcessor
, we will have to document thatLinearClauseProcessor
(or the IRBuilder in general) expects the frontend to privatize the linear variable and relay the information toLinearClauseProcessor
.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 your plan is to make implicitly LINEAR variables PRIVATE instead of LINEAR?