-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang][OpenMP] Capture mapped pointers on target
by reference.
#145454
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
Open
abhinavgaba
wants to merge
3
commits into
llvm:main
Choose a base branch
from
abhinavgaba:tgt-capture-mapped-ptrs-by-ref
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+368
−156
Open
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
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.
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.
Looks like this is not sufficient for cases like
map(sp, sp->x)
. In that case, the problem is that sp->x populates PartialStruct inllvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp
Lines 8985 to 8990 in 90f3147
And even though initially after going through generateInfoFroCapture,
map(sp)
occupies the top of the map-chain in CurInfo:After, emitCombinedEntry, a new entry gets added for:
and all existing entries in CurInfo get the MEMBER_OF(1) bit applied to them.
llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp
Line 9516 in 90f3147
So the final CombinedInfo after emitCombinedEntry and then appending CurInfo to it becomes:
instead of the desired:
(Note that this &sp getting MEMBER_OF(1) issue currently exists on target enter data as well.)
Maybe we can split up
llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp
Lines 9489 to 9491 in 90f3147
@alexey-bataev, do you have any suggestions/feedback?
Future Issue:
The problem long-term is that we currently assume that all component-lists for the same VAR should contribute towards a single combined PartialStruct, if any. That should not be the case for cases like:
In the above case, we should get two independent "containing-structs" mapped by themselves:
So we need to loop-over all component-lists, and only process those together that share the same attachable-base-pointer (sp or sp->sq in this case).
So, our second invocation for the "remaining component-lists" would become something like:
Alexey, do you foresee any issues with this?
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.
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.
And I'm also not sure yet how the lambda captures function would interact with this if we split g`enerateInfoForCapture.
For a three-level pointer case like this:
map(to: sp->x, sp->y) map(to: sp->sq->a, sp->sq->b) map(to: sp->sq->sr->c, sp->sq->sr->d) map(sp)
We should eventually have something like:
The
for (Expr* AttachBasePtr: AttachBasePtrs)
loop would need to run three times, once each for the for the attachable-base-pointersp
,sp->sq
, andsp->sq->sr
.And we can think of the first invocation to be for the component-lists that have no base-pointer, and pull that into the loop as well.
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.
Try to fix in a single loop at first. If it does not work, try splitting