-
Notifications
You must be signed in to change notification settings - Fork 25.6k
retain_graph=True in compiled_autograd #110367
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
keep_graph in compiled_autograd keep_graph in compiled_autograd [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/110367
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (3 Unrelated Failures)As of commit a606c35 with merge base efdf155 ( UNSTABLE - The following jobs failed but were 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. |
"test_hook_closure_cycle_use_custom_function_False_use_tensor_hook_True", # compiled_autograd does not support keep_graph | ||
"test_hook_closure_cycle_use_custom_function_True_use_tensor_hook_False", # compiled_autograd does not support keep_graph | ||
"test_hook_closure_cycle_use_custom_function_True_use_tensor_hook_True", # compiled_autograd does not support keep_graph | ||
"test_accumulate_grad", # RuntimeError: compiled_autograd does not support create_graph |
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.
10 tests passed now, but regenerated all to get new errors.
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.
Looks like tests are failing
torch/_dynamo/compiled_autograd.py
Outdated
def keep_graph(graph, keep_graph): | ||
graph.keep_graph = keep_graph | ||
return graph | ||
|
||
|
||
def should_keep_graph(graph): | ||
return graph.keep_graph |
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.
Why does this need to be in python?
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.
Setting breakpoints / debugging is easier ;)
I can move entirely to C++ setting, reading
keep_graph in compiled_autograd keep_graph in compiled_autograd cc penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler [ghstack-poisoned]
Most of the actual tests seem to pass, I think its a static analysis catching (correctly) a falsey condition leading to uninitialized ptr access. Fixed. |
cache->compiled_fn = check(call_end_capture(py_compiler, state.outputs)); | ||
PyObject* graph = check(call_end_capture(py_compiler, state.outputs)); | ||
cache->compiled_fn = | ||
check(call_keep_graph(check(graph), graph_task.keep_graph_)); |
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.
this can be removed
I agree with the conclusion that |
It is enabled when |
Adds support for retain_graph=True - known as keep_graph_ internally in the autograd engine. cc penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx peterbell10 ipiszy yf225 chenyang78 kadeng muchulee8 aakhundov ColinPeppler [ghstack-poisoned]
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
@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 |
Merge failedReason: 14 mandatory check(s) failed. The first few are:
Dig deeper by viewing the failures on hud |
@pytorchbot merge -f "Flaky CI" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
This change is needed after pytorch/test-infra#4579 and pytorch/test-infra#4610. All invalid cancelled signals have been removed from Dr.CI and HUD. So trymerge should ignore them accordingly for a consistent experience. ### Testing #110367 (comment) is the PR where a bunch of invalid cancelled signals showed up and blocked merges Pull Request resolved: #110690 Approved by: https://github.com/clee2000, https://github.com/ZainRizvi
Stack from ghstack (oldest at bottom):
Adds support for retain_graph=True - known as keep_graph_ internally in the autograd engine.
cc @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @peterbell10 @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @aakhundov @ColinPeppler