-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[OpenACC] Reduction 'init' lowering for all-ones/least/largest #156535
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
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.
This probably isn't what you want. For example, for
InitKind::Onethis will generate1+1ibut the identity value for complex multiplication is1 + 0i. Maybe best to leave it as an error-producing case.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.
Could you guide me as to what the right answer is for them? I could definitely split these up into separate functions, but I'd love to know what the '0', '1', All-Ones, Least and Largest should be here?
I think I'd one day soon want to enable complex here.
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'm having a hard time picturing the use case for all-ones with floating point, but I suppose literally all ones for both components makes as much sense as anything. You could define starting points for minimum and maximum, but in general complex numbers can't be ordered in any meaningful sense. There is no
<operator for complex values, for instance. When I googled this, I saw a few suggestions that you could compare the magnitude of the values, for which, largest or least for both component values would work. So I guess,InitKind::Oneis the only one for which what you did here wouldn't work. Trying to answer this question, on the other hand, clarified for me why the OpenACC standard wouldn't generally want to accept complex values.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.
Ah, hmm.. ok then, I think leaving complex as ill-formed is the best idea.
I DID just realize my test before was wrong, and I HAVEN'T been disallowing complex, so I'm going to go through and do that as a RAC patch.
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.
Oops. Magnitude is an absolute value, so I guess you'd need {0, 0} for the LEAST case. Anyway, it's probably just a bad idea to allow it at all.
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 could probably make complex legal for some operators (+/*?), but it doesn't seem worth the effort until someone asks for it. In the meantime, I've made sure it is ill-formed always, here: 7a0dfb1