PyTorch PR #184275 fixes profiler event canonicalization with PEP 657 caret lines
Cleaner stack traces for Deep Learning profilers—no more junk caret lines.
The PyTorch project has merged a critical fix for its built-in profiler: PR #184275, authored by Jeff Daily, addresses a subtle bug in event canonicalization related to PEP 657 (which introduced caret and tilde markers in tracebacks). Before this fix, the profiler would inadvertently include those marker-only lines as separate stack frames, polluting the event snapshots and making it harder to pinpoint the actual source of a performance issue.
By skipping the caret/tilde lines, the patched profiler now produces cleaner stack traces that focus on the real source line, especially in Dynamo-augmented profiling scenarios where FrameSummary column metadata is present. This is a small but impactful improvement for any ML engineer using PyTorch's profiling tools to optimize model training or inference—less noise means faster debugging and more accurate hot-spot identification.
- Fixes canonicalization to skip PEP 657 caret/tilde marker-only lines in profiler stack traces.
- Ensures Dynamo-augmented profiler event snapshots stay focused on the correct source line.
- Submitted by Jeff Daily (AMD) and approved via PR #184275 on the pytorch/pytorch repo.
Why It Matters
Cleaner profiler output saves ML engineers time when diagnosing performance bottlenecks in PyTorch models.