-
Notifications
You must be signed in to change notification settings - Fork 24.4k
[dynamo] Account for function id reuse in relevant Dynamo decorators #148385
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/148385
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit f6ee148 with merge base aade4fb ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torch/_dynamo/decorators.py
Outdated
trace_rules._allowed_callable_ids.remove(fn_id) | ||
trace_rules._nonstrict_trace_callable_ids.remove(fn_id) |
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.
do we need to remove stuff from _disallowed_callable_ids?
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.
OOps copy paste error.
Removed trace_rules._nonstrict_trace_callable_ids.remove(fn_id)
, and we don't need to touch _disallowed_callable_ids
because allow_in_graph
was removing fn_id
from it, so it's safe.
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.
nice
Starting merge as part of PR stack under #148007 |
…ant`-ed instances (#148007) As title, this enables `nonstrict_trace`-ed function to take in object whose type has been `pytree.register_constant`-ed, as long as the object existed outside the `torch.compile` region. This also forces Dynamo to emit a `EQUALS_MATCH` guard on the object. Pull Request resolved: #148007 Approved by: https://github.com/zou3519 ghstack dependencies: #148385
This fixes a recent series of flaky failure from `nonstrict_trace` unit tests: #148166, #148056, #148055, #148054, #148034, #148033, #148032, #148031. For now we don't need to worry about the other decorators because they are either meant for builtin/numpy functions (which should never deallocate in practice), or used for polyfills which keeps the function object in `get_torch_obj_rule_map()`. Fixes #147777. ghstack-source-id: d9bea5f Pull Request resolved: #148385
Stack from ghstack (oldest at bottom):
functools.partial
objects #148386nonstrict_trace
work with somepytree.register_constant
-ed instances #148007This fixes a recent series of flaky failure from
nonstrict_trace
unittests: #148166, #148056, #148055, #148054, #148034, #148033, #148032, #148031.
For now we don't need to worry about the other decorators because they
are either meant for builtin/numpy functions (which should never
deallocate in practice), or used for polyfills which keeps the function
object in
get_torch_obj_rule_map()
.Fixes #147777.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames