[dynamo, nested graph breaks] small fixes to resume function generation (#151056)

Old: ~pack resume function stack + locals into a list: we need to be able to pass frame stack+locals in lists to hand off to nested functions in the future, so we implement this part first.~

We are no longer doing this right now since GraphModule/guard variable naming gets messed up. Going forward, our approach will be to keep the top frame unpacked, but pack the rest of the contents of other frames in a list.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/151056
Approved by: https://github.com/jansel
This commit is contained in:
William Wen
2025-05-22 15:21:23 -07:00
committed by PyTorch MergeBot
parent 9d04c0f352
commit 28e7aa21c5
3 changed files with 2 additions and 76 deletions

View File

@ -1607,6 +1607,7 @@ def bytecode_from_template(fn, varname_map=None, noreturn=True, noprefix=True):
# If we don't reset starts_line, then the generated
# bytecode's line number will be based on fn's.
inst.starts_line = None
inst.positions = None
if varname_map and inst.argval in varname_map:
inst.argval = varname_map[inst.argval]