Files
pytorch/docs/source/accelerator
KarhouTam 044e60e8c1 [OpenReg][Docs] Add profiler integration documentation (#170276)
## Summary
This PR adds a new accelerator documentation chapter, `docs/source/accelerator/profiler.md`, and wires it into the accelerator guide index. The doc explains PyTorch’s profiler integration paths at a high level (legacy autograd vs Kineto) and then focuses on how `PrivateUse1` accelerators can integrate via the legacy autograd path. It uses OpenReg as the illustrative example in the Implementation section, without coupling Design/Background to any specific backend.

## Motivation
Third‑party accelerators integrating via `PrivateUse1` need a concise, device‑agnostic reference for profiler integration. Today, details are scattered across C++ stubs, Python control code, and tests. This documentation centralizes:
- Where an accelerator plugs into the profiler surface
- What hooks are required (record/elapsed/synchronize/onEachDevice/annotations)
- How to validate behavior with multi‑stream/device, shapes, and chrome trace export

## What’s changed
- Added `docs/source/accelerator/profiler.md`
  - Background: links to `torch/csrc/profiler/README.md` and outlines the two profiler paths
  - Design: backend‑agnostic control plane (Python, ProfilerStubs, backend runtime)
  - Implementation: introduces OpenReg as the example for `PrivateUse1` legacy path
  - Usage patterns: snippets for multi‑stream, training loops, and trace export
  - Validation and limitations: summarizes tested scenarios and current constraints
- Updated `docs/source/accelerator/index.md` to include `profiler` in the toctree
Pull Request resolved: https://github.com/pytorch/pytorch/pull/170276
Approved by: https://github.com/fffrog
2025-12-26 06:31:08 +00:00
..