Add most recent bytecode to graph break with torch._dynamo.graph_break() and verbose (#164422)
Summary:
https://github.com/pytorch/pytorch/issues/162858 The issue described the feature implemented.
This adds to the existing graph break log with the latest 20 (or viable user frame) bytecode instructions. The scenario is when the graph_break happens without errors. It happens during the case when user calling torch._dynamo.graph_break().
Meanwhile, in the testing, one can find that the generated frame based on step() is not deterministic as sometimes it reached the maximum amount, sometimes it generated the less than that. The bytecode generation is python version dependent. Thus, the testing plan excludes the bytecode output but generated the total bytecode line count.
This is a helpful process to understand bytecode transformation, symbolic convert, and convert frame. It is a helpful task to provide hands-on experience with dynamo workflow.
X-link: https://github.com/pytorch/pytorch/pull/164422
Approved by: https://github.com/williamwen42, https://github.com/mlazos
Reviewed By: izaitsevfb
Differential Revision: D84354269
fbshipit-source-id: acd32504606fdde14ccbba5b57960b7f219f4040
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>