-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Dynamo][9/N] Make SkipFilesVariable wrap functions only #115963
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/115963
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit 60f6896 with merge base e3aefe2 ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
value, | ||
( | ||
types.FunctionType, | ||
types.MethodType, |
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.
I think this is typo in my previous PR, general method (non-nn.module) should be wrapped as UserDefinedObjectVariable
as the binding object matters.
|
||
if self.value is contextlib.nullcontext: | ||
return NullContextVariable() | ||
elif self.value is collections.OrderedDict: |
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.
For a lot of logics around collection.OrderedDict
in UDC and UDO, we should do further refactor. I think there are two major things we need to figure out:
- Supporting arbitrary class as dict key - The challenging is how to generate global reference for these classes during installing guard. I was trying to fix this in this PR, but I found it's non-trivial, so I'll leave it as a separate PR. Or probably we only support
int/float/str
as key, arbitrary classes are not very common cases. If we do this, then many logics are not necessary, as they will be handled inConstDictVariable
. - Custom dict support - probably we need to consolidate these code.
@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 |
@pytorchbot revert -m "causing significant performance regression, identified by number of ops in ads, please check internal diff" -c nosignal |
@pytorchbot successfully started a revert job. Check the current status here. |
@yanboliang your PR has been successfully reverted. |
…5963)" This reverts commit bb5a270. Reverted #115963 on behalf of https://github.com/jeanschmidt due to causing significant performance regression, identified by number of ops in ads, please check internal diff ([comment](#115963 (comment)))
@yanboliang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@pytorchbot merge |
Summary: Make ```SkipFilesVariable``` only handle function type, and route skipped classes to ```UserDefinedClassVariable```. The reasons behind this are: * We'd like to remove ```is_allowed```, so the allowed/disallowed torch classes should have a proper place to handle. We can put them in either ```SkipFilesVariable``` and ```UserDefinedClassVariable``` under the current architecture, but it's confusing to have two places do one thing. - Going forward, let's make ```SkipFilesVariable``` only handle functions, and probably I'll rename it to ```SkippedFunctionVariable``` in the following PRs. - Let's do dispatch by value's type, all torch classes stuff would go to ```UserDefinedClassVariable``` in the next PR. * We'd merge in_graph/skip/inline trace decision into the same API ```trace_rule.lookup```, so probably we have to limit the input to only function for better organizing ```VariableBuilder._wrap``` logics. - Next step, I'll merge ```skipfiles.check``` into ```trace_rules.lookup```, and do the skipfile check before wrapping them into correct variable tracker. - Though the ```TorchCtxManagerClassVariable``` is decided by ```trace_rules.lookup```, I'll refactor it out in the following PRs. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 aakhundov kadeng X-link: pytorch/pytorch#115963 Reviewed By: williamwen42 Differential Revision: D52342184 Pulled By: yanboliang fbshipit-source-id: 1dbc134384bc9bb5139e71796fa3796574c197fe
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 |
) Make ```SkipFilesVariable``` only handle function type, and route skipped classes to ```UserDefinedClassVariable```. The reasons behind this are: * We'd like to remove ```is_allowed```, so the allowed/disallowed torch classes should have a proper place to handle. We can put them in either ```SkipFilesVariable``` and ```UserDefinedClassVariable``` under the current architecture, but it's confusing to have two places do one thing. - Going forward, let's make ```SkipFilesVariable``` only handle functions, and probably I'll rename it to ```SkippedFunctionVariable``` in the following PRs. - Let's do dispatch by value's type, all torch classes stuff would go to ```UserDefinedClassVariable``` in the next PR. * We'd merge in_graph/skip/inline trace decision into the same API ```trace_rule.lookup```, so probably we have to limit the input to only function for better organizing ```VariableBuilder._wrap``` logics. - Next step, I'll merge ```skipfiles.check``` into ```trace_rules.lookup```, and do the skipfile check before wrapping them into correct variable tracker. - Though the ```TorchCtxManagerClassVariable``` is decided by ```trace_rules.lookup```, I'll refactor it out in the following PRs. Pull Request resolved: pytorch#115963 Approved by: https://github.com/jansel
…orch#115963)" This reverts commit bb5a270. Reverted pytorch#115963 on behalf of https://github.com/jeanschmidt due to causing significant performance regression, identified by number of ops in ads, please check internal diff ([comment](pytorch#115963 (comment)))
Make
SkipFilesVariable
only handle function type, and route skipped classes toUserDefinedClassVariable
. The reasons behind this are:is_allowed
, so the allowed/disallowed torch classes should have a proper place to handle. We can put them in eitherSkipFilesVariable
andUserDefinedClassVariable
under the current architecture, but it's confusing to have two places do one thing.SkipFilesVariable
only handle functions, and probably I'll rename it toSkippedFunctionVariable
in the following PRs.UserDefinedClassVariable
in the next PR.trace_rule.lookup
, so probably we have to limit the input to only function for better organizingVariableBuilder._wrap
logics.skipfiles.check
intotrace_rules.lookup
, and do the skipfile check before wrapping them into correct variable tracker.TorchCtxManagerClassVariable
is decided bytrace_rules.lookup
, I'll refactor it out in the following PRs.cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @aakhundov @kadeng