Skip to content

Conversation

@jerryzh168
Copy link
Contributor

@jerryzh168 jerryzh168 commented Mar 22, 2022

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

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]
jerryzh168 added a commit that referenced this pull request Mar 22, 2022
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
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Mar 22, 2022

🔗 Helpful links

💊 CI failures summary and remediations

As 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.

Click here to manually regenerate this comment.

@jerryzh168
Copy link
Contributor Author

@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]
jerryzh168 added a commit that referenced this pull request Mar 23, 2022
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
Copy link
Contributor Author

@jerryzh168 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@jerryzh168
Copy link
Contributor Author

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

@jerryzh168 jerryzh168 requested a review from vkuzo March 23, 2022 01:18
Copy link
Contributor

@andrewor14 andrewor14 left a 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.

@jerryzh168
Copy link
Contributor Author

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

facebook-github-bot pushed a commit that referenced this pull request Mar 23, 2022
…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
@github-actions
Copy link
Contributor

Hey @jerryzh168.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

@jerryzh168 jerryzh168 added release notes: quantization release notes category topic: improvements topic category labels Mar 23, 2022
shahofblah pushed a commit that referenced this pull request Mar 25, 2022
…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)
@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/753/head branch March 27, 2022 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants