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][PT2E]Make _fuse_conv_bn_ support graph capture by torch._dynamo.export #107951

Conversation

leslie-fang-intel
Copy link
Collaborator

@leslie-fang-intel leslie-fang-intel commented Aug 25, 2023

Stack from ghstack (oldest at bottom):

Summary
The latest check-in a0cfaf0 for the conv-bn folding assumes the graph is captured by the new graph capture API torch._export.capture_pre_autograd_graph. Since we still need to use the original graph capture API torch._dynamo_export in 2.1 release. So, this check-in made negative impact to workloads' performance heavily. Made this PR to fix this issue by trying to make the conv-bn folding function workable with both new and original graph capture API.

@pytorch-bot
Copy link

pytorch-bot bot commented Aug 25, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/107951

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (1 Unrelated Failure)

As of commit 8c28215 with merge base 2bddfb0 (image):

UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@github-actions github-actions bot added the release notes: quantization release notes category label Aug 25, 2023
leslie-fang-intel added a commit that referenced this pull request Aug 25, 2023
ghstack-source-id: 8e25878b43a189b5eecb3c5c25fb580f8025c742
Pull Request resolved: #107951
@leslie-fang-intel leslie-fang-intel added the ciflow/trunk Trigger trunk jobs on your pull request label Aug 25, 2023
@leslie-fang-intel leslie-fang-intel changed the title Make _fuse_conv_bn_ support graph capture by torch._dynamo.export [Quant][PT2E]Make _fuse_conv_bn_ support graph capture by torch._dynamo.export Aug 25, 2023
leslie-fang-intel added a commit that referenced this pull request Aug 25, 2023
ghstack-source-id: 4e39262f14b5d3b08a7adc16824610d4c25b58a1
Pull Request resolved: #107951
@leslie-fang-intel
Copy link
Collaborator Author

@jgong5 @jerryzh168 Please kindly help to take a look of this PR.

Comment on lines +50 to +52
if conv_node.target == torch.ops.aten.convolution.default:
assert type(conv_node.args[6]) is bool
transpose = conv_node.args[6]
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add a TODO to remove these, same for others

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the comments, TODO added here and others in this diff.

leslie-fang-intel added a commit that referenced this pull request Aug 25, 2023
ghstack-source-id: 78e6d6f36dd6355b450d40507811564a4e381b25
Pull Request resolved: #107951
…torch._dynamo.export"


**Summary**
The latest check-in a0cfaf0 for the conv-bn folding assumes the graph is captured by the new graph capture API `torch._export.capture_pre_autograd_graph`. Since we still need to use the original graph capture API `torch._dynamo_export` in 2.1 release. So, this check-in made negative impact to workloads' performance heavily. Made this PR to fix this issue by trying to make the conv-bn folding function workable with both new and original graph capture API.

[ghstack-poisoned]
leslie-fang-intel added a commit that referenced this pull request Aug 25, 2023
ghstack-source-id: fce277b4d8e5db5429f7b3ddc1bea1fc04466a91
Pull Request resolved: #107951
…torch._dynamo.export"


**Summary**
The latest check-in a0cfaf0 for the conv-bn folding assumes the graph is captured by the new graph capture API `torch._export.capture_pre_autograd_graph`. Since we still need to use the original graph capture API `torch._dynamo_export` in 2.1 release. So, this check-in made negative impact to workloads' performance heavily. Made this PR to fix this issue by trying to make the conv-bn folding function workable with both new and original graph capture API.

[ghstack-poisoned]
leslie-fang-intel added a commit that referenced this pull request Aug 26, 2023
ghstack-source-id: fb9124b4c4cfb736844c0f4e75e11fa729eb6713
Pull Request resolved: #107951
…torch._dynamo.export"


**Summary**
The latest check-in a0cfaf0 for the conv-bn folding assumes the graph is captured by the new graph capture API `torch._export.capture_pre_autograd_graph`. Since we still need to use the original graph capture API `torch._dynamo_export` in 2.1 release. So, this check-in made negative impact to workloads' performance heavily. Made this PR to fix this issue by trying to make the conv-bn folding function workable with both new and original graph capture API.

[ghstack-poisoned]
@leslie-fang-intel
Copy link
Collaborator Author

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

voznesenskym pushed a commit that referenced this pull request Aug 27, 2023
…mo.export (#107951)

**Summary**
The latest check-in a0cfaf0 for the conv-bn folding assumes the graph is captured by the new graph capture API `torch._export.capture_pre_autograd_graph`. Since we still need to use the original graph capture API `torch._dynamo_export` in 2.1 release. So, this check-in made negative impact to workloads' performance heavily. Made this PR to fix this issue by trying to make the conv-bn folding function workable with both new and original graph capture API.
Pull Request resolved: #107951
Approved by: https://github.com/jgong5, https://github.com/jerryzh168
ghstack dependencies: #106836, #106838, #106958
leslie-fang-intel added a commit that referenced this pull request Aug 30, 2023
… API"


**TODO**

- Enable Dynamic Shape
- Revert the changes in #107951


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
@facebook-github-bot facebook-github-bot deleted the gh/leslie-fang-intel/78/head branch August 30, 2023 14:16
leslie-fang-intel added a commit that referenced this pull request Aug 31, 2023
…ew graph capture API"


**Summary**

- **TODO** Revert the changes in #107951


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
leslie-fang-intel added a commit that referenced this pull request Aug 31, 2023
… API"


**Summary**

- **TODO** Revert the changes in #107951


cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy ngimel yf225 chenyang78 kadeng muchulee8 aakhundov

[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request Sep 1, 2023
#108317)

**Summary**
Revert the changes in #107951 to make the utils function only support graph captured by `capture_pre_autograd_graph`.

Pull Request resolved: #108317
Approved by: https://github.com/jgong5, https://github.com/jerryzh168
ghstack dependencies: #108214
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants