You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/dynamo/test_error_messages.py
+124-3Lines changed: 124 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1159,6 +1159,7 @@ def fn(x):
1159
1159
torch._dynamo.graph_break()
1160
1160
1161
1161
NOTE: the most recent `torch.compile` tracing attempt might not be where you applied `torch.compile`! This is due to how graph breaks are implemented - the optimized code object returned by Dynamo will call another Dynamo-generated resume function and tracing is re-enabled by calling the resume function as a normal Python function, which Dynamo intercepts as a top-level frame.
1162
+
1162
1163
Most recent bytecode instructions traced (max 20):
Hint: Remove the `torch._dynamo.graph_break()` call.
1257
+
1258
+
Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}`
1259
+
1260
+
For more details about this graph break, please visit: https://meta-pytorch.github.io/compile-graph-break-site/gb/gb0025.html
1248
1261
User code traceback:
1249
1262
File "test_error_messages.py", line N, in test_graph_break_traceback_above_dynamo_shows_user_code
1250
1263
f3(torch.randn(3))
@@ -1257,8 +1270,12 @@ def post_munge(s):
1257
1270
1258
1271
File "test_error_messages.py", line N, in torch_dynamo_resume_in_f3_at_N
1259
1272
Foo().attr = x
1273
+
File "test_error_messages.py", line N, in __setattr__
1274
+
torch._dynamo.graph_break()
1260
1275
1261
1276
NOTE: the most recent `torch.compile` tracing attempt might not be where you applied `torch.compile`! This is due to how graph breaks are implemented - the optimized code object returned by Dynamo will call another Dynamo-generated resume function and tracing is re-enabled by calling the resume function as a normal Python function, which Dynamo intercepts as a top-level frame.
1277
+
1278
+
Most recent bytecode instructions traced (max 20):
Graph break in user code at test_error_messages.py:N
1518
+
Graph Break Reason: Encountered graph break that we cannot resume from. Compiling up to the previous resumable state, then skipping the rest of the function. Graph break encountered:
1519
+
1520
+
User code traceback:
1521
+
File "test_error_messages.py", line N, in test_step_graph_break
1522
+
fn(torch.ones(3))
1523
+
File "test_error_messages.py", line N, in fn
1524
+
torch._dynamo.step_unsupported()
1525
+
""",
1526
+
)
1527
+
1528
+
torch._dynamo.reset()
1529
+
1530
+
withtorch._dynamo.error_on_graph_break(True):
1531
+
self.assertExpectedInlineMunged(
1532
+
Unsupported,
1533
+
lambda: fn(torch.ones(3)),
1534
+
"""\
1535
+
cannot resume from torch._dynamo.step_unsupported()
1536
+
Explanation: traced torch._dynamo.step_unsupported(), but Dynamo is instructed to error on graph break. This graph break is used for debugging only.
1537
+
Hint: Remove the torch._dynamo.step_unsupported() call.
1538
+
Hint: Make sure fullgraph=False and error_on_graph_break=False.
1539
+
Hint: This is likely to be a Dynamo bug. Please report an issue to PyTorch.
1540
+
1541
+
Developer debug context:
1542
+
1543
+
For more details about this graph break, please visit: https://meta-pytorch.github.io/compile-graph-break-site/gb/gb0283.html
Copy file name to clipboardExpand all lines: torch/_dynamo/graph_break_registry.json
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2851,5 +2851,17 @@
2851
2851
"Move the Placement usage outside the compiled region"
2852
2852
]
2853
2853
}
2854
+
],
2855
+
"GB0283": [
2856
+
{
2857
+
"Gb_type": "cannot resume from torch._dynamo.step_unsupported()",
2858
+
"Context": "",
2859
+
"Explanation": "traced torch._dynamo.step_unsupported(), but Dynamo is instructed to error on graph break. This graph break is used for debugging only.",
2860
+
"Hints": [
2861
+
"Remove the torch._dynamo.step_unsupported() call.",
2862
+
"Make sure fullgraph=False and error_on_graph_break=False.",
2863
+
"This is likely to be a Dynamo bug. Please report an issue to PyTorch."
0 commit comments