Profiler Integration
Background
PyTorch ships a device-agnostic profiler that instruments CPU-side operator dispatch, coordinates with accelerator collectors, captures Python stacks, and exports aggregated statistics or Chrome/Perfetto traces. For core architecture, see torch/csrc/profiler/README.md.
There are two primary integration paths for accelerators:
Legacy autograd profiler:
Can attach backend-specific hooks via
ProfilerStubsto record device events and compute elapsed times.Works without Kineto; suitable for PrivateUse1 backends that want a minimal, self-contained path.
Kineto
plugin: