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.
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.
torch.compile stackI will study graph breaks, guards, cache behavior, recompilation, symbolic and dynamic shapes, compilation modes, and the boundaries between compiled and eager execution.
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.
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.
torch.compile.Notes, profiler traces, generated code, benchmarks, and conclusions will be added here as I complete each experiment.
torch.compile.torch.compiler overview and compiler-stack components.torch.compile core concepts and programming model.torch.compile troubleshooting and compiler logs.torch.compile performance.