-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[quant][fx] Relax the constraint for input of custom module nodes #74510
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
Summary: Previously we require the dequantize before custom module to have one user, this is because we are removing the dequantize node before custom module while we transform an observed custom module to a quantized custom module, but actually we don't need to remove it, we can just change the input of custom module with quantize node instead. If the dequantize node only has one user, it will be removed by the dead code elimination pass that was added recently. Test Plan: python test/test_quantization.py TestQuantizeFx.test_custom_module_class_input_has_multiple_users Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Previously we require the dequantize before custom module to have one user, this is because we are removing the dequantize node before custom module while we transform an observed custom module to a quantized custom module, but actually we don't need to remove it, we can just change the input of custom module with quantize node instead. If the dequantize node only has one user, it will be removed by the dead code elimination pass that was added recently. Test Plan: python test/test_quantization.py TestQuantizeFx.test_custom_module_class_input_has_multiple_users Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: fef8bb6 Pull Request resolved: #74510
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 8597311 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
|
@jerryzh168 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
…e nodes" Summary: Previously we require the dequantize before custom module to have one user, this is because we are removing the dequantize node before custom module while we transform an observed custom module to a quantized custom module, but actually we don't need to remove it, we can just change the input of custom module with quantize node instead. If the dequantize node only has one user, it will be removed by the dead code elimination pass that was added recently. Test Plan: python test/test_quantization.py TestQuantizeFx.test_custom_module_class_input_has_multiple_users Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D35034626](https://our.internmc.facebook.com/intern/diff/D35034626) [ghstack-poisoned]
Summary: Previously we require the dequantize before custom module to have one user, this is because we are removing the dequantize node before custom module while we transform an observed custom module to a quantized custom module, but actually we don't need to remove it, we can just change the input of custom module with quantize node instead. If the dequantize node only has one user, it will be removed by the dead code elimination pass that was added recently. Test Plan: python test/test_quantization.py TestQuantizeFx.test_custom_module_class_input_has_multiple_users Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 33ff7f1 Pull Request resolved: #74510
|
@jerryzh168 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
thanks for the suggestion @vkuzo, I think it makes sense, also added an item in our BE task list to remove DCE in our code base |
andrewor14
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.
Does the latest code not rely on DCE? If so I think the PR description is out of date now.
yeah, we remove the dequantize op directly after that now, will update the PR description |
…4510) Summary: Pull Request resolved: #74510 Previously we require the dequantize before custom module to have one user, this is because we are removing the dequantize node before custom module while we transform an observed custom module to a quantized custom module, but actually we don't need to remove it, we can just change the input of custom module with quantize node instead. If the dequantize node only has one user, it will be removed by the dead code elimination pass that was added recently. Test Plan: python test/test_quantization.py TestQuantizeFx.test_custom_module_class_input_has_multiple_users Imported from OSS Reviewed By: dzdang Differential Revision: D35034626 fbshipit-source-id: eea9fbf9fb34c61f114c6431377be347632ce36d
|
Hey @jerryzh168. |
…4510) Summary: Pull Request resolved: #74510 Previously we require the dequantize before custom module to have one user, this is because we are removing the dequantize node before custom module while we transform an observed custom module to a quantized custom module, but actually we don't need to remove it, we can just change the input of custom module with quantize node instead. If the dequantize node only has one user, it will be removed by the dead code elimination pass that was added recently. Test Plan: python test/test_quantization.py TestQuantizeFx.test_custom_module_class_input_has_multiple_users Imported from OSS Reviewed By: dzdang Differential Revision: D35034626 fbshipit-source-id: eea9fbf9fb34c61f114c6431377be347632ce36d (cherry picked from commit 2878085)
Stack from ghstack (oldest at bottom):
Summary:
Previously we require the dequantize before custom module to have one user, this is because we are removing the dequantize node
before custom module while we transform an observed custom module to a quantized custom module, but actually we don't need to remove it,
we can just change the input of custom module with quantize node instead. If the dequantize node only has one user, it will be removed. We are removing the node directly instead of relying on dead code elimination to improve the debugability of the system, since people will see the final graph after the conversion, instead of introducing the dce as a step that changes the graph. We will remove the dependence on DCE in the future as well.
Test Plan:
python test/test_quantization.py TestQuantizeFx.test_custom_module_class_input_has_multiple_users
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D35034626