[dynamo][guards] Support cloning of Guard Manager#140223
[dynamo][guards] Support cloning of Guard Manager#140223anijain2305 wants to merge 11 commits intogh/anijain2305/585/basefrom
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/140223
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 10fb73a with merge base f4ce9ac ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torch/csrc/dynamo/guards.cpp
Outdated
|
|
||
| // For cloning | ||
| GuardManager(RootGuardManager* root, std::string source, bool is_dict) | ||
| : _root(root), _source(source), _is_dict(is_dict) {} |
There was a problem hiding this comment.
| : _root(root), _source(source), _is_dict(is_dict) {} | |
| : _root(root), _source(std::move(source)), _is_dict(is_dict) {} |
torch/csrc/dynamo/guards.cpp
Outdated
|
|
||
| void add_relational_guard_resetter_without_move( | ||
| std::shared_ptr<RelationalGuard> relational_guard) { | ||
| _relational_guard_resetters.emplace_back(relational_guard); |
There was a problem hiding this comment.
| _relational_guard_resetters.emplace_back(relational_guard); | |
| _relational_guard_resetters.emplace_back(std::move(relational_guard)); |
There was a problem hiding this comment.
Surprised this isn't covered by clang-tidy. A lot of things should probably moved by value around here.
torch/csrc/dynamo/guards.cpp
Outdated
| std::vector<Py_ssize_t> indices) | ||
| : DictGuardManager( | ||
| cloned_root, | ||
| source, |
There was a problem hiding this comment.
| source, | |
| std::move(source), |
torch/csrc/dynamo/guards.cpp
Outdated
| size, | ||
| _expected_type, | ||
| is_exact_dict_type, | ||
| indices) {} |
There was a problem hiding this comment.
| indices) {} | |
| std::move(indices)) {} |
torch/csrc/dynamo/guards.cpp
Outdated
| _size(size), | ||
| _expected_type(_expected_type), | ||
| _is_exact_dict_type(is_exact_dict_type), | ||
| _indices(indices) {} |
There was a problem hiding this comment.
| _indices(indices) {} | |
| _indices(std::move(indices)) {} |
Skylion007
left a comment
There was a problem hiding this comment.
Way to many things should be moved in the newly added code. I went through a few of them, but you should really use clang-tidy to find all the args that need to moved though the calls.
torch/csrc/dynamo/guards.cpp
Outdated
| RootGuardManager* root, | ||
| std::shared_ptr<RelationalGuard> guard) { | ||
| // Don't std::move. Shared the pointers between root and cloned_root. | ||
| root->add_relational_guard_resetter_without_move(guard); |
There was a problem hiding this comment.
| root->add_relational_guard_resetter_without_move(guard); | |
| root->add_relational_guard_resetter_without_move(std::move(guard)); |
Thanks for pointing out. This PR will be WIP for a few weeks (trying to build up to a new functionality in follow up PRs). I will fix the std::move problems before the final review. |
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
|
@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 |
Pull Request resolved: #140250 Approved by: https://github.com/jansel ghstack dependencies: #140223
Pull Request resolved: #140251 Approved by: https://github.com/jansel ghstack dependencies: #140223, #140250
Pull Request resolved: pytorch#140223 Approved by: https://github.com/jansel
Pull Request resolved: pytorch#140250 Approved by: https://github.com/jansel ghstack dependencies: pytorch#140223
Pull Request resolved: pytorch#140251 Approved by: https://github.com/jansel ghstack dependencies: pytorch#140223, pytorch#140250
Stack from ghstack (oldest at bottom):
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames