-
Notifications
You must be signed in to change notification settings - Fork 22k
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
AutogradMeta is nullptr for non-differentiable tensors on creation #128746
base: gh/soulitzer/308/base
Are you sure you want to change the base?
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/128746
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New Failures, 17 Unrelated FailuresAs of commit ba5c404 with merge base 93a33bf (): NEW FAILURES - The following jobs have failed:
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. |
…ors" [ghstack-poisoned]
ghstack-source-id: dd5c869c8167b10d1059a3788260f426b5cfa0fa Pull Request resolved: #128746
…ors" [ghstack-poisoned]
…ors" After this PR, I expect AutogradMeta to ALWAYS be nullptr for tensor of non-differentiable dtype: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (sets to nullptr) - make_variable (only non-null when requires_grad=True) Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
ghstack-source-id: 85a8c93d8591ecd16183db320416a2e3e9a3a795 Pull Request resolved: #128746
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
ghstack-source-id: 518e5940fcf7e63237ec2724104b595b56e332f4 Pull Request resolved: #128746
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
ghstack-source-id: a2b620818a08d94a9974882114c7ec31b02b3faa Pull Request resolved: #128746
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
…creation" After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases: - TensorImpl's autograd_meta_ field are only set in: - set_requires_grad (only non-null when requires_grad=True) - set_autograd_meta is called in... - materialize_autograd_meta (only set when accessing autograd APIs like add/remove hook, set name, create_gradient_edge) - variable_data (sets to nullptr) - make_variable_differentiable_view (requires differentiable dtype) - make_variable_non_differentiable_view (?) - make_variable (only non-null when requires_grad=True) Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta. Previously materialize_autograd_meta was also unconditionally called in `detach_`. [ghstack-poisoned]
ghstack-source-id: 8ef2b543026a2aba9d74a65dc89f060e03051eb6 Pull Request resolved: #128746
Some failures may be legit - the traced out ops may be different than before Doing some measuring, there does not seem to be a significant difference in runtime and instruction count. click to see scriptimport torch
from torch.utils.benchmark import Timer
from torch.utils.benchmark import Measurement
setup="""
"""
stmt="""
a = torch.empty((0,), requires_grad=False)
"""
timer = Timer(stmt, setup)
m = timer.blocked_autorange(min_run_time=1)
print(m)
print(timer.collect_callgrind(100)) |
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
Stack from ghstack (oldest at bottom):
After this PR, I expect AutogradMeta to be nullptr for tensor of non-differentiable dtype for more cases:
Views performed on tensor of non-differentiable dtype still need to be recorded, leading to non-nullptr AutogradMeta.
Previously materialize_autograd_meta was also unconditionally called in
detach_
.