SIGN IN SIGN UP

[dynamo] clarify verbose hint for backend failures (#185419)

BackendCompilerFailed preserves the backend/compiler-call traceback while
ShortenTraceback removes the surrounding Dynamo tracing frames unless
TORCHDYNAMO_VERBOSE=1 is enabled. The generic hint called the hidden portion
"the internal stack trace", which made it look redundant when the visible
backend stack already contained internal compiler frames.

Keep the hint for ShortenTraceback exceptions even when
TracingContext.clear_frame() sets real_stack to None, and describe it as the
full Dynamo stack trace. This distinguishes the visible backend stack from the
additional Dynamo tracing frames revealed by verbose mode. Remove the
traceback-visible source comments from both shortening sites and cover the
default and verbose behavior directly.

Suppressing the hint based only on real_stack would hide actionable guidance:
ShortenTraceback removes frames independently of whether a traced user stack is
available. Checking the exception type models the behavior that the hint
controls.

Fixes #158384
Generated by my agent

Test Plan:

```
python test/dynamo/test_error_messages.py ErrorMessagesTest.test_backend_compiler_failed_traceback ErrorMessagesTest.test_backend_compiler_failed_traceback_verbose ErrorMessagesTest.test_no_internal_compiler_stacktrace ErrorMessagesTest.test_internal_compiler_stacktrace_verbose
python test/dynamo/test_exc.py ExcTests.test_backend_suppress_line
python test/dynamo/test_error_messages.py
python test/dynamo/test_exc.py
lintrunner -a
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/185419
Approved by: https://github.com/bobrenjc93
J
Jason Ansel committed
5e4da85059444fcc889ff73c92871652d58e96a7
Parent: 260849c
Committed by PyTorch MergeBot <pytorchmergebot@users.noreply.github.com> on 8/26/2026, 1:56:08 AM