[dynamo, nested graph breaks] support nested closures (#159817)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/159817
Approved by: https://github.com/anijain2305
ghstack dependencies: #159329, #159678
This commit is contained in:
William Wen
2025-08-27 10:30:09 -07:00
committed by PyTorch MergeBot
parent 3f8090809f
commit d0a242e547
6 changed files with 43 additions and 17 deletions

View File

@ -1206,7 +1206,6 @@ def add_graph_break_if_leaf_instructions(instructions: list[Instruction]) -> Non
create_instruction("NOP", argval="GRAPH_BREAK_IF_LEAF"),
create_instruction(inst.opname, argval=inst.argval),
]
# breakpoint()
new_insts.extend(overwrite_instruction(inst, replace_insts))
else:
new_insts.append(inst)