-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Register Saved Tensors hooks #60663
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
Register Saved Tensors hooks #60663
Conversation
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit c3fd243 (more details on the Dr. CI page and at hud.pytorch.org/pr/60663): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 Preview docs built from this PR 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 to the (internal) Dr. CI Users group. |
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 9554de6 Pull Request resolved: pytorch#60663
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
|
@Varal7 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466223](https://our.internmc.facebook.com/intern/diff/D29466223) [ghstack-poisoned]
**Summary**: This PR is part of a stack aimed to address #58512. Saves the hooks as a field of `SavedVariable` with type `std::unique_ptr<SavedVariableHooks>`. At this point, from the perspective of the user, `register_hooks` is still a no-op. The purpose of the PR is to create the class that will store the hooks. The logic of packing / unpacking will be added in the next PR. Differential Revision: [D29466223](https://our.internmc.facebook.com/intern/diff/D29466223) [ghstack-poisoned]
albanD
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.
Looks good on my end.
I'll let @soulitzer get a final look
soulitzer
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.
Looks good to me also!
|
Also what's up with the TORCH_API/THP_CLASS macros, I noticed that you were tweaking that in the past couple iterations. What was the idea behind those changes? |
**Summary**: This PR is part of a stack aimed to address #58512. Saves the hooks as a field of `SavedVariable` with type `std::unique_ptr<SavedVariableHooks>`. At this point, from the perspective of the user, `register_hooks` is still a no-op. The purpose of the PR is to create the class that will store the hooks. The logic of packing / unpacking will be added in the next PR. Differential Revision: [D29466223](https://our.internmc.facebook.com/intern/diff/D29466223) [ghstack-poisoned]
|
@Varal7 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
|
Thanks for the review @soulitzer and thank you @albanD for helping me debug this PR. So For posterity: if you have linking problems with symbols not found: If you want to debug windows builds and want to ssh |
**Summary**: This PR is part of a stack aimed to address #58512. Saves the hooks as a field of `SavedVariable` with type `std::unique_ptr<SavedVariableHooks>`. At this point, from the perspective of the user, `register_hooks` is still a no-op. The purpose of the PR is to create the class that will store the hooks. The logic of packing / unpacking will be added in the next PR. Differential Revision: [D29466223](https://our.internmc.facebook.com/intern/diff/D29466223) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
|
@Varal7 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
|
This pull request has been merged in ee5a97d. |
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Inplace operations done by the pack_hook on the original tensor (in the case `leaf || !output`) will be caught if the Saved tensor is used by another op. Inplace operations done by unpack_hook will unfortunately not be caught. We will add a warning in the docs that follows this PR. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Inplace operations done by the pack_hook on the original tensor (in the case `leaf || !output`) will be caught if the Saved tensor is used by another op. Inplace operations done by unpack_hook will unfortunately not be caught. We will add a warning in the docs that follows this PR. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Inplace operations done by the pack_hook on the original tensor (in the case `leaf || !output`) will be caught if the Saved tensor is used by another op. Inplace operations done by unpack_hook will unfortunately not be caught. We will add a warning in the docs that follows this PR. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Inplace operations done by the pack_hook on the original tensor (in the case `leaf || !output`) will be caught if the Saved tensor is used by another op. Inplace operations done by unpack_hook will unfortunately not be caught. We will add a warning in the docs that follows this PR. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Inplace operations done by the pack_hook on the original tensor (in the case `leaf || !output`) will be caught if the Saved tensor is used by another op. Inplace operations done by unpack_hook will unfortunately not be caught. We will add a warning in the docs that follows this PR. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Inplace operations done by the pack_hook on the original tensor (in the case `leaf || !output`) will be caught if the Saved tensor is used by another op. Inplace operations done by unpack_hook will unfortunately not be caught. We will add a warning in the docs that follows this PR. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Inplace operations done by the pack_hook on the original tensor (in the case `leaf || !output`) will be caught if the Saved tensor is used by another op. Inplace operations done by unpack_hook will unfortunately not be caught. We will add a warning in the docs that follows this PR. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Summary: Fixes #58512 Uses the hooks introduced in #60663: upon registering, the pack hook is called and the returned python object is stored. From then on, whenever we need to unpack it, we will use that python object in combination with the unpack hook. The packing can be done with gradient tracking disabled as we will add back the correct grad_fn during unpacking. Inplace operations done by the pack_hook on the original tensor (in the case `leaf || !output`) will be caught if the Saved tensor is used by another op. Inplace operations done by unpack_hook will unfortunately not be caught. We will add a warning in the docs that follows this PR. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: [D29466227](https://our.internmc.facebook.com/intern/diff/D29466227) [ghstack-poisoned]
Stack from ghstack:
Summary:
This PR is part of a stack aimed to address #58512.
Saves the hooks as a field of
SavedVariablewith typestd::unique_ptr<SavedVariableHooks>.At this point, from the perspective of the user,
register_hooksis still a no-op.The purpose of the PR is to create the class that will store the hooks. The logic of packing / unpacking will be added in the next PR.
Differential Revision: D29466223