Skip to content

Conversation

@jerryzh168
Copy link
Contributor

@jerryzh168 jerryzh168 commented Aug 23, 2019

Stack from ghstack:

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:

python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: D17001137

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:
jerryzh168 added a commit that referenced this pull request Aug 23, 2019
Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

ghstack-source-id: c58f347
Pull Request resolved: #25127
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:
jerryzh168 added a commit that referenced this pull request Aug 24, 2019
Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

ghstack-source-id: bff14e6
Pull Request resolved: #25127
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
jerryzh168 added a commit that referenced this pull request Aug 26, 2019
Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

ghstack-source-id: 6cfcf34
Pull Request resolved: #25127
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
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.

I think we should not duplicate the logic from insertObservers for figuring out what values we need to quantize. Instead we should just look for the corresponding CallMethod nodes and replace them with Q-DQ nodes. This logic was introduced earlier, but earlier it was slightly better "justified" than now.


} // namespace

TORCH_API void InsertObservers(

Choose a reason for hiding this comment

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

Please avoid unnecessary code movements to make the diffs smaller. I'd suggest undoing this part of this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh the reason is I'm separating out a InsertObserversImpl function and put that into a anonymous namespace

Choose a reason for hiding this comment

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

Ah, ok. Please try to split such changes in future as they are not related to what the commit message says.


for (Value* v : values_to_quantize) {
if (v->type()->isSubtypeOf(TensorType::get())) {
if (v->node()->kind() == prim::CallMethod && v->node()->s(attr::name) == "forward") {

Choose a reason for hiding this comment

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

Do we need to replicate the logic of insertObservers in the loop above? We had to do it previously, but now we can just rely on having prim::CallMethod nodes and replace them with Q-DQ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or should I remove these in a separate PR? that change seems unrelated actually

…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
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.

Yeah, it's fine if you do it in a separate PR.


} // namespace

TORCH_API void InsertObservers(

Choose a reason for hiding this comment

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

Ah, ok. Please try to split such changes in future as they are not related to what the commit message says.

…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
…dict"

Summary:
Extend insert_quant_dequant pass to go through forward function graphs

Test Plan:
```
python test/test_jit.py 'TestJit.test_insert_quant_dequant'
python test/test_quantizer.py
```

Reviewers:
pt1quant
Subscribers:

Tasks:

Tags:

Differential Revision: [D17001137](https://our.internmc.facebook.com/intern/diff/D17001137)
script::Module InsertQuantDeQuant(
script::Module& input_module,
c10::optional<script::Module> QuantizeHelper::findChildModuleToQuantize(Value* v) {
if (v->node()->kind() == prim::CallMethod && v->node()->s(attr::name) == "forward") {

Choose a reason for hiding this comment

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

Nit: you could use early exits to avoid staircase indentation.

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 96db3ad.

@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/38/head branch October 28, 2019 22:15
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