-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[dynamo] Remove closure_cells and merge/remove code paths
#140154
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/140154
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit ccca419 with merge base f98c601 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Rebase. |
| # but we'll do it again here so that we don't need to push a dummy variable. | ||
| # We shouldn't actually be doing anything with this variable anyway. | ||
| self.push(self._load_closure(name), name=name) | ||
| elif name.startswith("."): |
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 still need this condition?
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.
Honestly idk, but happy to take a look. This doesn't seem immediately related to closure cells so I didn't touch it.
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.
guess if the tests are passing, it's probably fine then?
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.
Oh I didn't realize I removed the condition lol. Lemme bring it back just to be safe, I'll take a look into this renaming separately.
…ytorch#140155) This is no longer needed now that we've replaced `ClosureVariable` with `NewCellVariable`, i.e., Dynamo now treats `LOAD_CLOSURE` the same as `LOAD_FAST`. Pull Request resolved: pytorch#140155 Approved by: https://github.com/jansel, https://github.com/williamwen42 ghstack dependencies: pytorch#140330, pytorch#140152, pytorch#140436, pytorch#140435, pytorch#140153, pytorch#140154
…140154) Now that all cells are modeled as `NewCellVariable` in Dynamo, we no longer need to put cell variables into this special `closure_cells`, rather we just merge `closure_cells` with `symbolic_locals`. This allows us to merge and remove some code paths, notably make `LOAD_CLOSURE` the same as `LOAD_FAST`, and `LOAD_DEREF` & `STORE_DEREF` the same for inlining or regular `InstructionTranslator`. Pull Request resolved: pytorch#140154 Approved by: https://github.com/jansel ghstack dependencies: pytorch#140330, pytorch#140152, pytorch#140436, pytorch#140435, pytorch#140153
…ytorch#140155) This is no longer needed now that we've replaced `ClosureVariable` with `NewCellVariable`, i.e., Dynamo now treats `LOAD_CLOSURE` the same as `LOAD_FAST`. Pull Request resolved: pytorch#140155 Approved by: https://github.com/jansel, https://github.com/williamwen42 ghstack dependencies: pytorch#140330, pytorch#140152, pytorch#140436, pytorch#140435, pytorch#140153, pytorch#140154
Stack from ghstack (oldest at bottom):
name_stackcode paths insymbolic_convert.py#140155closure_cellsand merge/remove code paths #140154NewCellVariable#140153prune_dead_object_new#140435ExecutionRecorderonly in root frameInstructionTranslator#140152DynamoFrameTypetype above Python frame object #140330Now that all cells are modeled as
NewCellVariablein Dynamo, we nolonger need to put cell variables into this special
closure_cells,rather we just merge
closure_cellswithsymbolic_locals.This allows us to merge and remove some code paths, notably make
LOAD_CLOSUREthe same asLOAD_FAST, andLOAD_DEREF&STORE_DEREFthe same for inlining or regular
InstructionTranslator.cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames