From a47ca4fc746a663c0e97d55a87815d0965d0a7e9 Mon Sep 17 00:00:00 2001 From: atalman Date: Sat, 21 Jun 2025 14:10:12 +0000 Subject: [PATCH] Revert "[dynamo] Weblink generation when unimplemented_v2() is called (#156033)" (#156546) Broke multiple CI jobs: dynamo/test_reorder_logs.py::ReorderLogsTests::test_constant_mutation [GH job link](https://github.com/pytorch/pytorch/actions/runs/15792695433/job/44521220864) [HUD commit link](https://hud.pytorch.org/pytorch/pytorch/commit/9de23d0c29dfac8dc0f6f234bdbcd85a6375fa81) This reverts commit 9de23d0c29dfac8dc0f6f234bdbcd85a6375fa81. PyTorch bot revert failed: https://github.com/pytorch/pytorch/pull/156033 Pull Request resolved: https://github.com/pytorch/pytorch/pull/156546 Approved by: https://github.com/jansel --- setup.py | 1 - .../fsdp/test_fully_shard_compile.py | 3 +- test/dynamo/test_error_messages.py | 54 +++---------------- test/dynamo/test_exc.py | 2 - test/test_custom_ops.py | 3 +- .../dynamo}/graph_break_registry.json | 0 torch/_dynamo/exc.py | 43 --------------- torch/testing/_internal/common_utils.py | 1 - 8 files changed, 8 insertions(+), 99 deletions(-) rename {torch/_dynamo => tools/dynamo}/graph_break_registry.json (100%) diff --git a/setup.py b/setup.py index b4ebc92f5926..26bfb0a8fd2f 100644 --- a/setup.py +++ b/setup.py @@ -1286,7 +1286,6 @@ def main(): "utils/model_dump/skeleton.html", "utils/model_dump/code.js", "utils/model_dump/*.mjs", - "_dynamo/graph_break_registry.json", ] if not BUILD_LIBTORCH_WHL: diff --git a/test/distributed/_composable/fsdp/test_fully_shard_compile.py b/test/distributed/_composable/fsdp/test_fully_shard_compile.py index 02a3377babf4..de0c61d10dd7 100644 --- a/test/distributed/_composable/fsdp/test_fully_shard_compile.py +++ b/test/distributed/_composable/fsdp/test_fully_shard_compile.py @@ -551,8 +551,7 @@ Unsupported Tensor.backward() call Hint: This graph break is fundamental - it is unlikely that Dynamo will ever be able to trace through your code. Consider finding a workaround. Developer debug context: call_method TensorVariable() backward () {} - - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0123""", # noqa: B950 +""", # noqa: B950 ) else: self.assertGreater(len(counters["graph_break"]), 1) diff --git a/test/dynamo/test_error_messages.py b/test/dynamo/test_error_messages.py index 5a3fe32233f3..1171f837f6a3 100644 --- a/test/dynamo/test_error_messages.py +++ b/test/dynamo/test_error_messages.py @@ -59,7 +59,6 @@ Dynamic shape operator Developer debug context: aten.nonzero.default - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0036 from user code: File "test_error_messages.py", line N, in fn @@ -81,7 +80,6 @@ Dynamic shape operator (no meta kernel) Developer debug context: aten.linalg_lstsq.default - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0037 from user code: File "test_error_messages.py", line N, in fn @@ -104,7 +102,6 @@ Unsupported Tensor.item() call with capture_scalar_outputs=False Developer debug context: call_method TensorVariable() item () {} - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0124 from user code: File "test_error_messages.py", line N, in fn @@ -124,11 +121,10 @@ from user code: """\ Data dependent operator Explanation: Operator `aten.equal.default` has a non-Tensor output whose value is dependent on the data of Tensor inputs. - Hint: Consider wrapping the operator into a PyTorch-understood custom operator (see https://pytorch.org/tutorials/advanced/custom_ops_landing_page.html) + Hint: Consider wrapping the operator into a PyTorch-understood custom operator (see https:/pytorch.org/tutorials/advanced/custom_ops_landing_page.html) Developer debug context: aten.equal.default - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0033 from user code: File "test_error_messages.py", line N, in fn @@ -156,7 +152,6 @@ sort with non-constant keys Developer debug context: TensorVariable() - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0207 from user code: File "test_error_messages.py", line N, in fn @@ -181,7 +176,6 @@ Unsupported method call Developer debug context: call_method UserDefinedObjectVariable(zip) __iter__ () {} - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0156 from user code: File "test_error_messages.py", line N, in fn @@ -209,7 +203,6 @@ Unsupported method call Developer debug context: call_method UserDefinedObjectVariable(dict_items) __iter__ () {} - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0156 from user code: File "test_error_messages.py", line N, in fn @@ -233,7 +226,6 @@ Unsupported function call Developer debug context: call_function UserDefinedObjectVariable(zip) [] {} - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0147 from user code: File "test_error_messages.py", line N, in fn @@ -257,7 +249,6 @@ Unsupported context manager Developer debug context: Attempted SETUP_WITH/BEFORE_WITH on ConstantVariable(int: 3) - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0142 from user code: File "test_error_messages.py", line N, in fn @@ -285,10 +276,7 @@ Backend compiler exception Exception:test Traceback: File "test_error_messages.py", line N, in fn - return x + 1 - - - For more details about this graph break, please visit: None""", + return x + 1""", ) def test_unsupported_builtin(self): @@ -307,7 +295,6 @@ Failed to trace builtin operator Developer debug context: builtin print [] False - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0059 from user code: File "test_error_messages.py", line N, in fn @@ -333,7 +320,6 @@ Attempted to call function marked as skipped Developer debug context: module: unittest.case, qualname: skip, skip reason: - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0007 from user code: File "test_error_messages.py", line N, in fn @@ -355,7 +341,6 @@ Attempted to call function marked as skipped Developer debug context: module: torch._dynamo.decorators, qualname: disable, skip reason: - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0007 from user code: File "test_error_messages.py", line N, in fn @@ -384,7 +369,6 @@ Attempted to inline function marked as skipped Developer debug context: qualname: skip, name: skip, filename: `case.py`, skip reason: skipped according trace_rules.lookup unittest - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0008 from user code: File "test_error_messages.py", line N, in fn @@ -406,7 +390,6 @@ Call to `torch._dynamo.graph_break()` Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}` - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025 from user code: File "test_error_messages.py", line N, in fn @@ -427,7 +410,6 @@ Call to `torch._dynamo.graph_break()` Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{'msg': ConstantVariable(str: 'test graph break')}` - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025 from user code: File "test_error_messages.py", line N, in fn @@ -449,7 +431,6 @@ Attempted to call function marked as skipped Developer debug context: module: _warnings, qualname: warn, skip reason: - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0007 from user code: File "test_error_messages.py", line N, in fn @@ -477,8 +458,7 @@ Attempted to call function marked as skipped Hint: Consider using torch.utils._pytree - https://github.com/pytorch/pytorch/blob/main/torch/utils/_pytree.py Developer debug context: module: optree._C, qualname: PyCapsule.flatten, skip reason: - - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0007""", +""", ) @scoped_load_inline @@ -524,8 +504,7 @@ Attempted to call function marked as skipped Hint: If it is a third-party C/C++ Python extension, please either wrap it into a PyTorch-understood custom operator (see https://pytorch.org/tutorials/advanced/custom_ops_landing_page.html for more details) or, if it is traceable, use `torch.compiler.allow_in_graph`. Developer debug context: module: mylib, qualname: PyCapsule.foobar, skip reason: - - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0007""", +""", ) cpp_source = """ @@ -577,7 +556,6 @@ Dynamic slicing with Tensor arguments Developer debug context: SliceVariable start: ConstantVariable(NoneType: None), stop: TensorVariable(), step: ConstantVariable(NoneType: None) - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0038 from user code: File "test_error_messages.py", line N, in fn @@ -599,7 +577,6 @@ Observed exception Developer debug context: raised exception ExceptionVariable() - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0088 from user code: File "test_error_messages.py", line N, in fn @@ -625,7 +602,6 @@ Uninitialized nn.Module Developer debug context: Foo - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0119 from user code: File "test_error_messages.py", line N, in fn @@ -654,7 +630,6 @@ Unsupported nn.Module attribute type Developer debug context: nn.Module subclass: Foo, name: attr, attribute type: module - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0161 from user code: File "test_error_messages.py", line N, in fn @@ -684,7 +659,6 @@ Graph break under GenericContextWrappingVariable Developer debug context: Active generic context managers: [GenericContextWrappingVariable(GenericCtxMgr), GenericContextWrappingVariable(GenericCtxMgr)] - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0066 from user code: File "test_error_messages.py", line N, in fn @@ -699,8 +673,7 @@ Call to `torch._dynamo.graph_break()` Hint: Remove the `torch._dynamo.graph_break()` call. Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}` - - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025""", +""", ) def test_load_build_class(self): @@ -721,7 +694,6 @@ LOAD_BUILD_CLASS bytecode not supported Developer debug context: - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0075 from user code: File "test_error_messages.py", line N, in fn @@ -750,11 +722,10 @@ from user code: """\ Missing bytecode handler Explanation: Dynamo does not know how to handle the bytecode instruction `GET_AITER`. - Hint: Do not trace code that produces the `GET_AITER` bytecode instruction (see https://docs.python.org/3/library/dis.html for bytecode semantics). + Hint: Do not trace code that produces the `GET_AITER` bytecode instruction (see https:/docs.python.org/3/library/dis.html for bytecode semantics). Hint: It may be possible to write Dynamo tracing rules for this code. Please report an issue to PyTorch if you encounter this graph break often and it is causing performance issues. Developer debug context: GET_AITER with args (, Instruction(GET_AITER) - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0082 from user code: File "test_error_messages.py", line N, in fn @@ -785,7 +756,6 @@ Reconstruction failure Developer debug context: UserMethodVariable(.Foo.meth at 0xmem_addr>, UserDefinedObjectVariable(Foo)) - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0092 from user code: File "test_error_messages.py", line N, in fn @@ -821,7 +791,6 @@ Graph Break Reason: Call to `torch._dynamo.graph_break()` Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}` - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025 User code traceback: File "test_error_messages.py", line N, in test_reconstruction_failure_gb torch.compile(fn, backend="eager")() @@ -841,7 +810,6 @@ Reconstruction failure Developer debug context: UserMethodVariable(.Foo.meth at 0xmem_addr>, UserDefinedObjectVariable(Foo)) - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0092 from user code: File "test_error_messages.py", line N, in fn @@ -870,7 +838,6 @@ NotImplementedError/UnsupportedFakeTensorException when running FX node Developer debug context: - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0087 from user code: File "test_error_messages.py", line N, in fn @@ -894,7 +861,6 @@ Data-dependent branching Developer debug context: attempted to jump with TensorVariable() - For more details about this graph break, please visit: None from user code: File "test_error_messages.py", line N, in fn @@ -961,7 +927,6 @@ Data-dependent assertion failed (cannot compile partial graph) Developer debug context: value: ConstantVariable(bool: False) - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0034 from user code: File "test_error_messages.py", line N, in fn @@ -1005,7 +970,6 @@ torch._dynamo.exc.Unsupported: Call to `torch._dynamo.graph_break()` Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}` - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025 from user code: File "test_error_messages.py", line N, in fn @@ -1058,7 +1022,6 @@ torch._dynamo.exc.Unsupported: Call to `torch._dynamo.graph_break()` Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}` - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025 from user code: File "test_error_messages.py", line N, in fn @@ -1094,7 +1057,6 @@ Graph Break Reason: Call to `torch._dynamo.graph_break()` Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}` - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025 User code traceback: File "test_error_messages.py", line N, in test_nested_compile_user_frames torch.compile(fn, backend="eager")(torch.randn(3)) @@ -1208,7 +1170,6 @@ Graph Break Reason: Call to `torch._dynamo.graph_break()` Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}` - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025 User code traceback: File "test_error_messages.py", line N, in test_graph_break_traceback_collapsed_resume_frames f1(torch.randn(3)) @@ -1243,7 +1204,6 @@ Skip calling `torch.compiler.disable()`d function Developer debug context: .f at 0xmem_addr> - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0098 from user code: File "test_error_messages.py", line N, in outer @@ -1265,7 +1225,6 @@ Skip calling `torch.compiler.disable()`d function Developer debug context: .g at 0xmem_addr> - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0098 from user code: File "test_error_messages.py", line N, in outer @@ -1291,7 +1250,6 @@ Unsupported function call (delayed) Developer debug context: source: LocalSource(local_name='fn', is_input=True, dynamism=None, is_derefed_cell_contents=False) - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0148 from user code: File "test_error_messages.py", line N, in outer diff --git a/test/dynamo/test_exc.py b/test/dynamo/test_exc.py index ce4af812a5f8..acc3fd55f6fb 100644 --- a/test/dynamo/test_exc.py +++ b/test/dynamo/test_exc.py @@ -43,7 +43,6 @@ Call to `torch._dynamo.graph_break()` Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}` - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025 from user code: File "test_exc.py", line N, in fn001 @@ -183,7 +182,6 @@ Graph Break Reason: Call to `torch._dynamo.graph_break()` Developer debug context: Called `torch._dynamo.graph_break()` with args `[]`, kwargs `{}` - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0025 User code traceback: File "test_exc.py", line N, in test_graph_break_log torch.compile(fn001, backend="eager")(torch.randn(1)) diff --git a/test/test_custom_ops.py b/test/test_custom_ops.py index ed2c63d1a817..f9d231a7df85 100644 --- a/test/test_custom_ops.py +++ b/test/test_custom_ops.py @@ -1817,8 +1817,7 @@ Dynamic shape operator Hint: Enable tracing of dynamic shape operators with `torch._dynamo.config.capture_dynamic_output_shape_ops = True` Developer debug context: _torch_testing.numpy_nonzero.default - - For more details about this graph break, please visit: https://compile-graph-break-site.vercel.app/gb/GB0036""", +""", ) # pre-existing problem: torch.compile(dynamic=True) will, by default, diff --git a/torch/_dynamo/graph_break_registry.json b/tools/dynamo/graph_break_registry.json similarity index 100% rename from torch/_dynamo/graph_break_registry.json rename to tools/dynamo/graph_break_registry.json diff --git a/torch/_dynamo/exc.py b/torch/_dynamo/exc.py index ffda65342a37..90f5fbeb1f1d 100644 --- a/torch/_dynamo/exc.py +++ b/torch/_dynamo/exc.py @@ -26,15 +26,12 @@ Error Formatting: - Debugging utilities for error reporting """ -import json import logging import os import re import textwrap import typing from enum import auto, Enum -from functools import lru_cache -from pathlib import Path from traceback import extract_stack, format_exc, format_list, StackSummary from typing import Any, NoReturn, Optional, TYPE_CHECKING @@ -497,42 +494,6 @@ def format_graph_break_message( return msg -@lru_cache(maxsize=1) -def _load_graph_break_registry() -> dict[str, Any]: - """ - Loads the graph break registry from JSON file with caching. - """ - try: - script_dir = Path(__file__).resolve().parent - registry_path = script_dir / "graph_break_registry.json" - with registry_path.open() as f: - return json.load(f) - except (FileNotFoundError, json.JSONDecodeError) as e: - log.error("Error accessing the registry file: %s", e) - return {} - - -def get_gbid_documentation_link(gb_type: str) -> Optional[str]: - """ - Retrieves the GBID documentation link for a given graph break type. - - Args: - gb_type: The graph break type to look up. - - Returns: - A string containing the documentation URL if found, otherwise None. - """ - GRAPH_BREAK_SITE_URL = "https://compile-graph-break-site.vercel.app/gb/" - - registry = _load_graph_break_registry() - - for k, v in registry.items(): - if v and v[0].get("Gb_type") == gb_type: - return f"{GRAPH_BREAK_SITE_URL}{k}" - - return "None" - - # TODO replace old unimplemented later def unimplemented_v2( gb_type: str, @@ -554,10 +515,6 @@ def unimplemented_v2( """ msg = format_graph_break_message(gb_type, context, explanation, hints) - - documentation_link = get_gbid_documentation_link(gb_type) - msg += f"\n For more details about this graph break, please visit: {documentation_link}" - if log_warning: log.warning(msg) if from_exc is not _NOTHING: diff --git a/torch/testing/_internal/common_utils.py b/torch/testing/_internal/common_utils.py index 601eb94fb673..856f22967565 100644 --- a/torch/testing/_internal/common_utils.py +++ b/torch/testing/_internal/common_utils.py @@ -5587,7 +5587,6 @@ def munge_exc(e, *, suppress_suffix=True, suppress_prefix=True, file=None, skip= s = re.sub(r' File "([^"]+)", line \d+, in (.+)\n( .+\n( +[~^]+ *\n)?)+', repl_frame, s) s = re.sub(r"line \d+", "line N", s) s = re.sub(r".py:\d+", ".py:N", s) - s = re.sub(r'https:/([a-zA-Z0-9_.-]+)', r'https://\1', s) s = re.sub(file, _as_posix_path(os.path.basename(file)), s) s = re.sub(_as_posix_path(os.path.join(os.path.dirname(torch.__file__), "")), "", s) if suppress_suffix: