-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Better decomp for torch.eye #163386
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
Better decomp for torch.eye #163386
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/163386
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit a869842 with merge base 51152ef ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
btw does uint8/uint16 also work here? or no impls for unsigned? |
|
Not sure if all backends implement those types. |
More reason to factor this out in their own utility. It would be good to have a robust check here we could grab the min dtype that is supported on target device. |
Skylion007
left a comment
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 is subtly complicated to do, and we should factor it out into its own function.
|
The dtype thing wasn't the main reason for this change, it matters close to zero for performance. Just an incidental change. (These will be registers in a memory-bound kernel.) The real improvement here was removing the |
|
|
||
| def _strength_reduce_integer(val: int) -> torch.dtype: | ||
| for possible_dtype in (torch.uint8, torch.uint16, torch.int32): | ||
| if val <= torch.iinfo(possible_dtype).max: |
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.
nit: fix for unbacked. If adding guards here is intentional: guard_or_False. Otherwise: statically_known_true(val <= torch.iinfo(possible_dtype).max)
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 is only called for int, for SymInt we use int64.
|
Starting merge as part of PR stack under #163434 |
|
Starting merge as part of PR stack under #163415 |
Fixes #163082 Pull Request resolved: #163419 Approved by: https://github.com/Skylion007, https://github.com/mlazos ghstack dependencies: #163386, #163398, #163387, #163414, #163415
Fixes #163275 Pull Request resolved: #163393 Approved by: https://github.com/eellison, https://github.com/coconutruben ghstack dependencies: #163386, #163398, #163387, #163414, #163415, #163419, #163434
This reverts commit a8cd437. See #163481 (comment) This PR might also cause issues with cudagraphs. Pull Request resolved: #163737 Approved by: https://github.com/ezyang ghstack dependencies: #163386, #163398, #163387, #163414, #163415, #163419, #163434, #163393, #163412, #163422, #163481, #163520, #163482
Fixes pytorch#163328 Pull Request resolved: pytorch#163398 Approved by: https://github.com/eellison ghstack dependencies: pytorch#163386
Fixes pytorch#163243 Fixes pytorch#162561 Pull Request resolved: pytorch#163387 Approved by: https://github.com/eellison ghstack dependencies: pytorch#163386, pytorch#163398
Fixes pytorch#161484 Pull Request resolved: pytorch#163414 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387
…163415) Fixes pytorch#163372 Pull Request resolved: pytorch#163415 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414
Fixes pytorch#163082 Pull Request resolved: pytorch#163419 Approved by: https://github.com/Skylion007, https://github.com/mlazos ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414, pytorch#163415
Fixes pytorch#163300 Pull Request resolved: pytorch#163434 Approved by: https://github.com/drisspg ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414, pytorch#163415, pytorch#163419
Fixes pytorch#163275 Pull Request resolved: pytorch#163393 Approved by: https://github.com/eellison, https://github.com/coconutruben ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414, pytorch#163415, pytorch#163419, pytorch#163434
…63412) Fixes pytorch#162624 Fixes pytorch#162586 Pull Request resolved: pytorch#163412 Approved by: https://github.com/eellison ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414, pytorch#163415, pytorch#163419, pytorch#163434, pytorch#163393
Fixes pytorch#163257 Pull Request resolved: pytorch#163422 Approved by: https://github.com/eellison ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414, pytorch#163415, pytorch#163419, pytorch#163434, pytorch#163393, pytorch#163412
Fixes pytorch#163420 Pull Request resolved: pytorch#163481 Approved by: https://github.com/eellison ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414, pytorch#163415, pytorch#163419, pytorch#163434, pytorch#163393, pytorch#163412, pytorch#163422
Fixes pytorch#163449 Pull Request resolved: pytorch#163520 Approved by: https://github.com/eellison ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414, pytorch#163415, pytorch#163419, pytorch#163434, pytorch#163393, pytorch#163412, pytorch#163422, pytorch#163481
Fixes pytorch#163457 Pull Request resolved: pytorch#163482 Approved by: https://github.com/eellison ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414, pytorch#163415, pytorch#163419, pytorch#163434, pytorch#163393, pytorch#163412, pytorch#163422, pytorch#163481, pytorch#163520
This reverts commit a8cd437. See pytorch#163481 (comment) This PR might also cause issues with cudagraphs. Pull Request resolved: pytorch#163737 Approved by: https://github.com/ezyang ghstack dependencies: pytorch#163386, pytorch#163398, pytorch#163387, pytorch#163414, pytorch#163415, pytorch#163419, pytorch#163434, pytorch#163393, pytorch#163412, pytorch#163422, pytorch#163481, pytorch#163520, pytorch#163482
This reverts commit a8cd437. See #163481 (comment) This PR might also cause issues with cudagraphs. Pull Request resolved: #163737 Approved by: https://github.com/ezyang ghstack dependencies: #163386, #163398, #163387, #163414, #163415, #163419, #163434, #163393, #163412, #163422, #163481, #163520, #163482
ghstack-source-id: 0e21cec Pull-Request: pytorch/pytorch#163386
Stack from ghstack (oldest at bottom):