-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[quant] Don't regard MatchAllNode as node matched #74198
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
CI Flow Status⚛️ CI FlowRuleset - Version:
|
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit c2d2ae4 (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. |
|
This pull request was exported from Phabricator. Differential Revision: D34873730 |
|
looks like it breaks some pre-existing tests, please take a look |
|
This pull request was exported from Phabricator. Differential Revision: D34873730 |
467c69f to
cdead83
Compare
|
This pull request was exported from Phabricator. Differential Revision: D34873730 |
cdead83 to
c235b80
Compare
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.
thanks for the comment, can we add a bit more description about how this is tested?
Summary: Pull Request resolved: pytorch#74198 As title, currently in the (add, X, MatchAllNode) pattnern, the node matched with MatchAllNode is regard as part of the pattern instead of the input. As a result, the possible patterns ends with that node will not be matched. For instance, we have two patterns 1. (nn.ReLU, (torch.add, MatchAllNode, (nn.BatchNorm2d, nn.Conv2d))) 2. (nn.ReLU, (nn.BatchNorm2d, nn.Conv2d)) And we wanna fuse the following model Conv2d -> BatchNorm2d -> ReLU + Conv2d -> BatchNorm2d ------ Add -> ReLU The pattern in the first row cannot be matched becaues the end node ReLU is recorded as MatchAllNode already. Test Plan: new unit test ``` [jiaxuzhu@devvm3400.frc0 /data/users/jiaxuzhu/fbsource/fbcode] buck test mode/dev //caffe2/test:quantization_fx -- --exact 'caffe2/test:quantization_fx - test_fusion_pattern_with_matchallnode (quantization.fx.test_quantize_fx.TestFuseFx)' Parsing buck files: finished in 0.9 sec Downloaded 0/2 artifacts, 0.00 bytes, 100.0% cache miss (for updated rules) Building: finished in 12.6 sec (100%) 18546/84011 jobs, 2/84011 updated Total time: 13.5 sec More details at https://www.internalfb.com/intern/buck/build/9d2decdb-d01e-4332-84f5-1728a65d4f7b BUILD SUCCEEDED Tpx test run coordinator for Facebook. See https://fburl.com/tpx for details. Running with tpx session id: d92e10b8-9209-4e9e-95a6-2fcac02db251 Trace available for this run at /tmp/tpx-20220314-161230.347672-d92e10b8-9209-4e9e-95a6-2fcac02db251/trace.log RemoteExecution session id: reSessionID-d92e10b8-9209-4e9e-95a6-2fcac02db251-tpx Started reporting to test run: https://www.internalfb.com/intern/testinfra/testrun/3377699814955263 ✓ ListingSuccess: caffe2/test:quantization_fx : 365 tests discovered (19.275) ✓ Pass: caffe2/test:quantization_fx - test_fusion_pattern_with_matchallnode (quantization.fx.test_quantize_fx.TestFuseFx) (17.760) Summary Pass: 1 ListingSuccess: 1 If you need help understanding your runs, please follow the wiki: https://fburl.com/posting_in_tpx_users Finished test run: https://www.internalfb.com/intern/testinfra/testrun/3377699814955263 ``` Reviewed By: jerryzh168 Differential Revision: D34873730 fbshipit-source-id: 48879eac22eee72665b8fe00605c812573c93009
c235b80 to
c2d2ae4
Compare
|
This pull request was exported from Phabricator. Differential Revision: D34873730 |
Summary: Pull Request resolved: #74198 As title, currently in the (add, X, MatchAllNode) pattnern, the node matched with MatchAllNode is regard as part of the pattern instead of the input. As a result, the possible patterns ends with that node will not be matched. For instance, we have two patterns 1. (nn.ReLU, (torch.add, MatchAllNode, (nn.BatchNorm2d, nn.Conv2d))) 2. (nn.ReLU, (nn.BatchNorm2d, nn.Conv2d)) And we wanna fuse the following model Conv2d -> BatchNorm2d -> ReLU + Conv2d -> BatchNorm2d ------ Add -> ReLU The pattern in the first row cannot be matched becaues the end node ReLU is recorded as MatchAllNode already. Test Plan: new unit test ``` [jiaxuzhu@devvm3400.frc0 /data/users/jiaxuzhu/fbsource/fbcode] buck test mode/dev //caffe2/test:quantization_fx -- --exact 'caffe2/test:quantization_fx - test_fusion_pattern_with_matchallnode (quantization.fx.test_quantize_fx.TestFuseFx)' Parsing buck files: finished in 0.9 sec Downloaded 0/2 artifacts, 0.00 bytes, 100.0% cache miss (for updated rules) Building: finished in 12.6 sec (100%) 18546/84011 jobs, 2/84011 updated Total time: 13.5 sec More details at https://www.internalfb.com/intern/buck/build/9d2decdb-d01e-4332-84f5-1728a65d4f7b BUILD SUCCEEDED Tpx test run coordinator for Facebook. See https://fburl.com/tpx for details. Running with tpx session id: d92e10b8-9209-4e9e-95a6-2fcac02db251 Trace available for this run at /tmp/tpx-20220314-161230.347672-d92e10b8-9209-4e9e-95a6-2fcac02db251/trace.log RemoteExecution session id: reSessionID-d92e10b8-9209-4e9e-95a6-2fcac02db251-tpx Started reporting to test run: https://www.internalfb.com/intern/testinfra/testrun/3377699814955263 ✓ ListingSuccess: caffe2/test:quantization_fx : 365 tests discovered (19.275) ✓ Pass: caffe2/test:quantization_fx - test_fusion_pattern_with_matchallnode (quantization.fx.test_quantize_fx.TestFuseFx) (17.760) Summary Pass: 1 ListingSuccess: 1 If you need help understanding your runs, please follow the wiki: https://fburl.com/posting_in_tpx_users Finished test run: https://www.internalfb.com/intern/testinfra/testrun/3377699814955263 ``` Reviewed By: jerryzh168 Differential Revision: D34873730 fbshipit-source-id: dc78455c7233ba33e9ab215f50754b1656b7dbc7
|
Hey @LiamZhuuu. |
Summary: Pull Request resolved: #74198 As title, currently in the (add, X, MatchAllNode) pattnern, the node matched with MatchAllNode is regard as part of the pattern instead of the input. As a result, the possible patterns ends with that node will not be matched. For instance, we have two patterns 1. (nn.ReLU, (torch.add, MatchAllNode, (nn.BatchNorm2d, nn.Conv2d))) 2. (nn.ReLU, (nn.BatchNorm2d, nn.Conv2d)) And we wanna fuse the following model Conv2d -> BatchNorm2d -> ReLU + Conv2d -> BatchNorm2d ------ Add -> ReLU The pattern in the first row cannot be matched becaues the end node ReLU is recorded as MatchAllNode already. Test Plan: new unit test ``` [jiaxuzhu@devvm3400.frc0 /data/users/jiaxuzhu/fbsource/fbcode] buck test mode/dev //caffe2/test:quantization_fx -- --exact 'caffe2/test:quantization_fx - test_fusion_pattern_with_matchallnode (quantization.fx.test_quantize_fx.TestFuseFx)' Parsing buck files: finished in 0.9 sec Downloaded 0/2 artifacts, 0.00 bytes, 100.0% cache miss (for updated rules) Building: finished in 12.6 sec (100%) 18546/84011 jobs, 2/84011 updated Total time: 13.5 sec More details at https://www.internalfb.com/intern/buck/build/9d2decdb-d01e-4332-84f5-1728a65d4f7b BUILD SUCCEEDED Tpx test run coordinator for Facebook. See https://fburl.com/tpx for details. Running with tpx session id: d92e10b8-9209-4e9e-95a6-2fcac02db251 Trace available for this run at /tmp/tpx-20220314-161230.347672-d92e10b8-9209-4e9e-95a6-2fcac02db251/trace.log RemoteExecution session id: reSessionID-d92e10b8-9209-4e9e-95a6-2fcac02db251-tpx Started reporting to test run: https://www.internalfb.com/intern/testinfra/testrun/3377699814955263 ✓ ListingSuccess: caffe2/test:quantization_fx : 365 tests discovered (19.275) ✓ Pass: caffe2/test:quantization_fx - test_fusion_pattern_with_matchallnode (quantization.fx.test_quantize_fx.TestFuseFx) (17.760) Summary Pass: 1 ListingSuccess: 1 If you need help understanding your runs, please follow the wiki: https://fburl.com/posting_in_tpx_users Finished test run: https://www.internalfb.com/intern/testinfra/testrun/3377699814955263 ``` Reviewed By: jerryzh168 Differential Revision: D34873730 fbshipit-source-id: dc78455c7233ba33e9ab215f50754b1656b7dbc7 (cherry picked from commit 1cc74ca)
Summary:
As title, currently in the (add, X, MatchAllNode) pattnern, the node matched with MatchAllNode is regard as part of the pattern instead of the input. As a result, the possible patterns ends with that node will not be matched.
For instance, we have two patterns
And we wanna fuse the following model
Conv2d -> BatchNorm2d -> ReLU +
Conv2d -> BatchNorm2d ------ Add -> ReLU
The pattern in the first row cannot be matched becaues the end node ReLU is recorded as MatchAllNode already.
Test Plan: updated the unit test test_fusion_pattern_with_multiple_inputs
Differential Revision: D34873730