-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Fix constant folding cloning constants #152273
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
Conversation
Summary: Bug fix for #135060 Simple review: https://github.com/pytorch/pytorch/pull/135060/files#diff-f23386709ff7e1235b15e18f835a48e5124e0ddd596aeb33c201daad1abbedd7R357 We mistakenly typed get_attr into getattr. This causes constants never get untagged, and forces all constants get cloned twice which greatly increases the memory consumption. Test Plan: python test/inductor/test_aot_inductor.py -k test_empty_constant_folding Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/152273
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 768803f with merge base a0d440a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Summary: Bug fix for #135060 Simple review: https://github.com/pytorch/pytorch/pull/135060/files#diff-f23386709ff7e1235b15e18f835a48e5124e0ddd596aeb33c201daad1abbedd7R357 We mistakenly typed get_attr into getattr. This causes constants never get untagged, and forces all constants get cloned twice which greatly increases the memory consumption. Test Plan: python test/inductor/test_aot_inductor.py -k test_empty_constant_folding Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 4ee4b54 Pull Request resolved: #152273
trieuat
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the fix!
| # any folding opportunity, we keep it in main gm. | ||
| for node in gm.graph.nodes: | ||
| if node.op == "getattr" or (node.name in (lifted_constant_names or ())): | ||
| if node.op == "get_attr" or (node.name in (lifted_constant_names or ())): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of pulling these magic strings out as constants like META_TAG is?
|
@pytorchbot merge |
Merge failedReason: Approvers from one of the following sets are needed:
|
|
@pytorchbot merge |
Merge startedYour 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 |
Stack from ghstack (oldest at bottom):
Summary:
Bug fix for #135060
Simple review:
https://github.com/pytorch/pytorch/pull/135060/files#diff-f23386709ff7e1235b15e18f835a48e5124e0ddd596aeb33c201daad1abbedd7R357
We mistakenly typed get_attr into getattr.
This causes constants never get untagged, and forces all constants get
cloned twice which greatly increases the memory consumption.
Test Plan:
python test/inductor/test_aot_inductor.py -k test_empty_constant_folding
Reviewers:
Subscribers:
Tasks:
Tags:
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @amjames @chauhang @aakhundov