PyTorch and torch.compile

From eager Python to optimized GPU kernels

Series
All about GPUs
Roadmap
PyTorch compiler track — ongoing alongside PMPP Parts II–IV
Updated
August 15, 2026
Navigation
Back to the roadmap


Learning goals

This page will document how PyTorch represents and executes machine-learning programs, and how torch.compile transforms those programs into optimized code. My goal is to connect the high-level model code I write in Python to the graphs, compiler passes, and GPU kernels that execute it.


Study plan

1. PyTorch execution fundamentals

I will begin with the eager execution model and follow an operation through tensors, autograd, modules, the operator library, and device dispatch. This provides the baseline for understanding what changes when compilation is enabled.

2. The torch.compile stack

3. The compiler programming model

I will study graph breaks, guards, cache behavior, recompilation, symbolic and dynamic shapes, compilation modes, and the boundaries between compiled and eager execution.

4. Debugging and performance analysis

I will use compiler logs and the PyTorch profiler to inspect captured regions, generated code, kernel launches, graph breaks, and CPU or GPU gaps. Benchmarks will separate initial compilation cost from warm steady-state execution.

5. Extending the stack

The final stage will connect the compiler track to my CUDA work by registering and testing a custom operator, integrating it into a compiled model, and comparing it against an eager baseline and Inductor-generated kernels.


Experiments


Notes and results

Notes, profiler traces, generated code, benchmarks, and conclusions will be added here as I complete each experiment.


Resources


 

GPU roadmap ·  All about GPUs ·  Home