Skip to content

Conversation

@jerryzh168
Copy link
Contributor

@jerryzh168 jerryzh168 commented Jun 25, 2020

Stack from ghstack:

Summary:
Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D22251072

Summary:
Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@jerryzh168 jerryzh168 requested a review from apaszke as a code owner June 25, 2020 23:39
jerryzh168 added a commit that referenced this pull request Jun 25, 2020
Summary:
Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: f4112fc
Pull Request resolved: #40596
@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jun 25, 2020

def forward(self, x):
x = self.conv(x)
# add_scalar
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought this was already supported. What was missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the fusion pattern is inconsistent

Comment on lines 508 to 517
std::string add_scalar = R"(
graph(%a_quant, %b_scalar, %alpha):
%a_dequant = aten::dequantize(%a_quant)
%r = aten::add(%a_dequant, %b_scalar, %alpha)
return (%r) )";

std::string quantized_add_scalar = R"(
graph(%a_quant, %b_scalar, %alpha):
%r = quantized::add_scalar(%a_quant, %b_scalar)
return (%r) )";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@raghuramank100 major change is this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

original pattern produces a float tensor and quantized pattern produces a quantized tensor

Copy link
Contributor

Choose a reason for hiding this comment

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

So is it correct to say that the new pattern is: deq->add-> = quantize_add->deq?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

new pattern is:
dq - aten::add -quant --> quantized::add_scalar

@dr-ci
Copy link

dr-ci bot commented Jun 25, 2020

💊 CI failures summary and remediations

As of commit 52b3f05 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

ci.pytorch.org: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 12 times.

…l}_scalar"

Summary:
Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
…l}_scalar"

Summary:
Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D22251072](https://our.internmc.facebook.com/intern/diff/D22251072)

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request Jun 26, 2020
Summary:
Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: fd85acc
Pull Request resolved: #40596
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in e3a9768.

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in e3a9768.

jerryzh168 added a commit to jerryzh168/pytorch that referenced this pull request Jun 26, 2020
…ytorch#40596)

Summary:
Pull Request resolved: pytorch#40596

Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan: Imported from OSS

Differential Revision: D22251072

fbshipit-source-id: e16eb92cf6611578cca1ed8ebde961f8d0610137
@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/367/head branch June 29, 2020 14:16
jerryzh168 added a commit that referenced this pull request Jun 29, 2020
…40596)

Summary:
Pull Request resolved: #40596

Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan: Imported from OSS

Differential Revision: D22251072

fbshipit-source-id: e16eb92cf6611578cca1ed8ebde961f8d0610137
jerryzh168 added a commit that referenced this pull request Jul 2, 2020
…40596)

Summary:
Pull Request resolved: #40596

Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan: Imported from OSS

Differential Revision: D22251072

fbshipit-source-id: e16eb92cf6611578cca1ed8ebde961f8d0610137
malfet pushed a commit that referenced this pull request Jul 7, 2020
… aten::repeat (#40933)

* [quant][graphmode][fix] dequantize propagation for {add/mul}_scalar (#40596)

Summary:
Pull Request resolved: #40596

Previously the fusion patterns for {add/mul}_scalar is inconsistent since the op pattern
produces a non-quantized tensor and the op replacement graph produces a quantized tensor

Test Plan: Imported from OSS

Differential Revision: D22251072

fbshipit-source-id: e16eb92cf6611578cca1ed8ebde961f8d0610137

* [quant][graphmode] Support quantization for `aten::apend` (#40743)

Summary:
Pull Request resolved: #40743

`aten::append` modifies input inplace and the output is ignored, these ops are not
supported right now, so we'll need to first make `aten::append` non-inplace
by change
```
ignored = aten::append(list, x)
```
to
```
x_list = aten::ListConstruct(x)
result = aten::add(list, x_list)
```
and then quantize the aten::add instead.

Test Plan:
TestQuantizeJitOps.test_general_shape_ops

Imported from OSS

Differential Revision: D22302151

fbshipit-source-id: 931000388e7501e9dd17bec2fad8a96b71a5efc5
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.

5 participants