Skip to content
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

[quant][graphmode] quant_fusion jit pass #24427

Closed
wants to merge 16 commits into from

Conversation

jerryzh168
Copy link
Contributor

@jerryzh168 jerryzh168 commented Aug 15, 2019

Stack from ghstack:

Summary:
Added following pass:

  • _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
    to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:

Differential Revision: D17001142

Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
@nishantpdce
Copy link
Contributor

What is the order? First we do fusion and then quant-dequant or otherway.
Eg for conv->relu. can u explain

@nishantpdce
Copy link
Contributor

I think in future you will have more fusion patterns. How will the QuantFusion look like ? Should you not iterate over set of patterns ? I will let Mikhail provide more comments as he is better familiar with the fusion patterns

@jerryzh168
Copy link
Contributor Author

What is the order? First we do fusion and then quant-dequant or otherway.
Eg for conv->relu. can u explain

conv->relu fusion will happen here as well, this PR is just used as a placeholder for quant_fusion pass, and we'll extend this later.

Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Copy link

@ZolotukhinM ZolotukhinM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nishantpdce, when we have several patterns, they will be matched in order they are registered, so it's up to us to decide what we want first. In our case I'd expect the order will be from bigger to smaller, e.g:

  1. DQ-Conv-Relu-Q --> QConvRelu
  2. Conv-Relu --> ConvRelu

IOW, we would like to first check patterns that include Q/DQ before we check patterns from generic fusion.

torch/csrc/jit/passes/quantization.cpp Outdated Show resolved Hide resolved
torch/csrc/jit/passes/quantization.cpp Outdated Show resolved Hide resolved
torch/csrc/jit/passes/quantization.cpp Outdated Show resolved Hide resolved
test/test_jit.py Outdated Show resolved Hide resolved
Copy link

@ZolotukhinM ZolotukhinM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, some remarks are inline!

Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
@jerryzh168 jerryzh168 mentioned this pull request Aug 23, 2019
Closed
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:
@zou3519 zou3519 deleted the gh/jerryzh168/30/head branch August 26, 2019 18:18
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 9a9ef21.

xxtEchjovs44 pushed a commit to xxtEchjovs44/pytorch that referenced this pull request Jan 29, 2020
Summary:
Added following pass:
- _jit_pass_quant_fusion: Fusion pass that replaces the dequant->conv->quant patterns
to quantized_conv

Test Plan:
python test/test_jit.py

Reviewers:
pt1quant

Subscribers:

Tasks:

Tags:

ghstack-source-id: 34aa4a870d51a63137b37f39773c0081b1b4b99d
Pull Request resolved: pytorch/pytorch#24427
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merged oncall: jit Add this issue/PR to JIT oncall triage queue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants