A beginner-friendly guide to using torch.profiler to analyze PyTorch operations, starting with a simple matrix multiplication and bias addition. Covers how to set up profiling, read profiler tables and Chrome traces in Perfetto, understand the CPU-to-GPU dispatch chain, interpret overhead-bound vs compute-bound behavior, and observe what torch.compile actually does at the kernel level. Includes a practical cheatsheet for common trace patterns and their meanings.
Table of contents
The matrix multiplication and addition operation64x64 traces4096x4096 tracesLet's see some torch compile at workTrace reading cheatsheetConclusion508 Impressions