PyTorch fixes profiler event canonicalization for PEP 657 caret lines
New commit improves profiler accuracy by skipping caret/tilde marker-only lines
PyTorch has merged a critical fix for its profiler, addressing an issue with PEP 657 caret lines. PEP 657 introduced enhanced traceback features in Python 3.11+, adding caret and tilde markers to point to specific syntax errors. In PyTorch's Dynamo-augmented profiler, these marker-only lines were incorrectly included during event canonicalization, cluttering stack traces. The commit, authored by Jeff Daily and approved by the same, skips these extraneous lines entirely, ensuring that profiler event snapshots focus solely on the relevant source code line after FrameSummary column metadata is applied.
This change, implemented in the trunk branch, directly impacts developers using PyTorch’s performance profiler, especially those leveraging TorchDynamo for JIT compilation. By cleaning up the stack trace, engineers can more quickly identify performance bottlenecks and debug model execution without sifting through irrelevant caret markers. The fix is part of a broader effort to maintain PyTorch’s compatibility with modern Python features while preserving profiler accuracy. The PR is linked to issue #184275 and has been merged into the main codebase.
- Skips PEP 657 caret/tilde marker-only lines during profiler event canonicalization
- Fixes Dynamo-augmented profiler to keep stack traces focused on source lines
- PR merged by Jeff Daily (AMD), ensuring cleaner profiling output
Why It Matters
Cleaner profiler traces mean faster debugging and better performance analysis for PyTorch developers.