-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Make DDP Quantization hooks backend Agnostic #138816
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/138816
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 714097b with merge base d2ec289 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
fegin
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.
LGTM, I'll wait for the CI signals.
|
@pytorchbot rebase |
|
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
|
Successfully rebased |
ab6ca60 to
714097b
Compare
|
@fegin , CI is passed, Could you pls merge the change. |
kwen2501
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.
LGTM
|
|
||
|
|
||
| def _quantize_per_tensor_cuda(x, scale, zero_point): | ||
| def _quantize_per_tensor_backend(x, scale, zero_point): |
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: maybe just name it _quantize_per_tensor?
|
|
||
|
|
||
| def _quantize_per_channel_cuda(x, scale, zero_point): | ||
| def _quantize_per_channel_backend(x, scale, zero_point): |
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: maybe just name it _quantize_per_channel?
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Current ddp hooks quantization code use .cuda() API to move tensors and parameter on backend devices. This limits only cuda backend to work with ddp quantization hooks. Change is to make code backend agnostic and move tensors/parameters based on **tensor.device.** Pull Request resolved: pytorch#138816 Approved by: https://github.com/kwen2501
Current ddp hooks quantization code use .cuda() API to move tensors and parameter on backend devices. This limits only cuda backend to work with ddp quantization hooks.
Change is to make code backend agnostic and move tensors/parameters based on tensor.device.
cc @H-Huang @awgu @kwen2501 @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @c-p-i-o