Skip to content

[quant][graphmode] Quantizing traced modules#39826

Closed
jerryzh168 wants to merge 13 commits intogh/jerryzh168/340/basefrom
gh/jerryzh168/340/head
Closed

[quant][graphmode] Quantizing traced modules#39826
jerryzh168 wants to merge 13 commits intogh/jerryzh168/340/basefrom
gh/jerryzh168/340/head

Conversation

@jerryzh168
Copy link
Copy Markdown
Contributor

@jerryzh168 jerryzh168 commented Jun 10, 2020

Stack from ghstack:

Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D21991266

Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@dr-ci
Copy link
Copy Markdown

dr-ci Bot commented Jun 10, 2020

💊 CI failures summary and remediations

As of commit 7fda2e9 (more details on the Dr. CI page):



🚧 1 fixed upstream failure:

These were probably caused by upstream breakages that were already fixed.

Please rebase on the viable/strict branch (expand for instructions)

Since your merge base is older than viable/strict, run these commands:

git fetch https://github.com/pytorch/pytorch viable/strict
git rebase FETCH_HEAD

Check out the recency history of this "viable master" tracking branch.


ci.pytorch.org: 2 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 48 times.

Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request Jun 11, 2020
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: ebf14c8
Pull Request resolved: #39826
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
jerryzh168 added a commit that referenced this pull request Jun 11, 2020
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: f271b65
Pull Request resolved: #39826
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Copy link
Copy Markdown
Contributor

@vkuzo vkuzo left a comment

Choose a reason for hiding this comment

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

accepting to unblock. Would be great if we added some comments inline on the why behind these changes, i.e. what specifically is different between the graphs generated by scripting vs tracing.

Comment thread aten/src/ATen/native/quantized/cpu/qmul.cpp Outdated
fn(*args, **kwargs)
return wrapper

def get_script_module(model, tracing, data):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is used in test, you probably missed the changes in test_quantize_script.py, it's too large so the change is not displayed by default in github..

}

template <bool ReLUFused = false>
Tensor qadd_scalar_tensor(Tensor qa, Tensor b) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wondering if there is context for this...b is a tensor which represents a scalar? Is this related to how tracing works? Maybe we can add a comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, will add a comment. tracing will trace a Scalar as tensor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

makes sense, thx!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wondering if the comment is accurate: add and add_scalar cannot be merged as add_scalar does not require a scale and zero-point.

Copy link
Copy Markdown
Contributor Author

@jerryzh168 jerryzh168 Jun 12, 2020

Choose a reason for hiding this comment

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

it's a little bit confusing, I meant when we add boradcasting support, we can merge add_scalar with that op, a separate task is to merge all variations of quantized::add into quantized::add, since we have overloading.

Comment thread aten/src/ATen/native/quantized/cpu/qadd.cpp

const PatternInfo mul_nn_relu = PatternInfo::parse_from_str(R"(
graph(%self, %a, %b):
graph(%self, %a, %b, %relu):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

more for my own understanding, this is not a logic change and just moving %relu out, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is a logic change, we are improving the support here to be able to match relu modules used multiple times and the matching in is_relu_module is also more accurate than match::module["ReLU"]

Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
def __init__(self, dim, inplace):
super(ConvNdRelu, self).__init__()
self.conv = conv_module[dim](1, 4, 2, 3).float()
self.conv = conv_module[dim](3, 3, 3).float()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is the dimension changed here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you mean the argument? they are changed because I changed the input dimensions

Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
Summary:
Expanding operator test coverage to traced modules

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

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

[ghstack-poisoned]
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 246d7bb.

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

This pull request has been merged in 246d7bb.

@facebook-github-bot facebook-github-bot deleted the gh/jerryzh168/340/head branch June 15, 2020 14:15
xwang233 pushed a commit to xwang233/pytorch that referenced this pull request Jun 20, 2020
Summary:
Pull Request resolved: pytorch#39826

Expanding operator test coverage to traced modules

Test Plan: Imported from OSS

Differential Revision: D21991266

fbshipit-source-id: 73b1d94caa6ad41bb0d6cbde7ba0de343da3e7ff
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Pull Request resolved: pytorch#39826

Expanding operator test coverage to traced modules

Test Plan: Imported from OSS

Differential Revision: D21991266

fbshipit-source-id: 73b1d94caa6ad41bb0d6cbde7ba0de343da3e7ff
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