-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[AMDGPU] Extend SRA i64 simplification for shift amts in range [33:62] #138913
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
7 commits
Select commit
Hold shift + click to select a range
458fd8b
Simplify SRA i64 for shift amts in range [33:62]
LU-JOHN fdba3dc
Freeze hi-half since it will be used twice
LU-JOHN 7188dd9
Test scalar shift of 33 and 62
LU-JOHN 9dc8247
Remove special cases. Rely on DAG simplification
LU-JOHN 5130b1a
Update tests
LU-JOHN 2dac3dc
Move constant to right
LU-JOHN 7441d41
Apply clang-format
LU-JOHN 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
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 fails alive: https://alive2.llvm.org/ce/z/ohLB4J
We need a freeze somewhere, maybe this https://alive2.llvm.org/ce/z/kcwGVF (but need to scale it down to a smaller size to get this to complete)
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.
Added freeze.
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.
Can you post the scaled down alive link that shows this works
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.
I tried to create a scaled down verification for shifting by 33, but alive2 has a timeout if ashr is used:
https://alive2.llvm.org/ce/z/S-gaBW
Replacing ashr with the commented 4-instruction sequence in the link avoids the timeout. Is this an issue with alive2's handling of ashr?
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.
Alive2 verification with 8/16-bit sizes: https://alive2.llvm.org/ce/z/YWP8qy.
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.
Can also add nuw to the shift https://alive2.llvm.org/ce/z/ocnLgT and nuw nsw on the sub: https://alive2.llvm.org/ce/z/tRDbS2
And if the shift is exact, can preserve shift on the new right shift: https://alive2.llvm.org/ce/z/rie9oU
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.
This PR is only handling shifts by a constant. The sub is only in the alive2 verification to validate multiple shift values.
This PR does not use a 'shl' and 'or' to construct the 64-bit value as in the old alive2 verification. Instead it uses 'insertelement' and 'bitcast', https://alive2.llvm.org/ce/z/4bs2mv.