torch.compile
A core compilation feature introduced in PyTorch 2.0. Based on TorchDynamo bytecode capture and the TorchInductor code generation backend, it enables just-in-time capture of model computation graphs and hardware-optimized code generation via a decorator, balancing the flexibility of dynamic graphs with the execution efficiency of static graphs.
Core Facts
TorchDynamo is the entry layer of the PyTorch 2.0 compilation stack, converting dynamic graph code into optimizable intermediate representations through Python bytecode interception.
Mixed-precision training can typically increase training speed by 1.5–2 times and reduce VRAM usage by nearly half.
TorchInductor is PyTorch's default backend compiler, capable of lowering computation graphs into Triton GPU kernels or C++/OpenMP CPU code.
Timeline (last 90 days)
In the underlying technology stack of torch.compile, AOTAutograd handles the separation of forward and backward graphs.
The PyTorch framework and its accompanying libraries (such as torchvision, torchaudio, TorchServe and torch.compile-related tools) iterate frequently, and there are API deprecations and behavior changes between versions.
torch.compile is a compilation frontend introduced in PyTorch 2.x, which captures the computation graph via TorchDynamo and generates optimized kernels via a backend (such as Inductor), without changing the model's mathematical definition.
torch.compile is a compilation frontend introduced in PyTorch 2.0 that improves training and inference speed through optimizations such as operator fusion and kernel generation.
In CPU benchmarks, after compiling GAP20 with torch.compile, training throughput improved by about 19.9% compared with the uncompiled version.
The PyTorch ecosystem already has SIGs for compilation (torch.compile), distributed training and others, whose outputs include RFC documents, quarterly roadmaps and cross-repository compatibility tests.
torch.compile optimizes a model's forward and backward passes through graph capture and kernel fusion.
On GPUs that support Tensor Cores, combining torch.compile and SDPA typically delivers a 1.5–2x speedup without changing mathematical equivalence.
PyTorch 2.x introduced torch.compile, which completes graph capture and operator fusion with almost no changes to user code.
TorchTPU completes graph compilation optimization through torch.compile and XLA, allowing developers to switch to compiled mode when performance is needed.
33 more timeline events
All Facts (20)
TorchDynamo is the entry layer of the PyTorch 2.0 compilation stack, converting dynamic graph code into optimizable intermediate representations through Python bytecode interception.
80%VerifiedMixed-precision training can typically increase training speed by 1.5–2 times and reduce VRAM usage by nearly half.
80%VerifiedTorchInductor is PyTorch's default backend compiler, capable of lowering computation graphs into Triton GPU kernels or C++/OpenMP CPU code.
75%Verifiedtorch.compile is a core compilation feature introduced in PyTorch 2.0, built on TorchDynamo (bytecode capture) and TorchInductor (code generation backend).
65%VerifiedThe torch.compile feature introduced in PyTorch 2.0 improves inference and training speed through graph capture and compilation optimization while maintaining the ease of use of dynamic graphs.
65%Verifiedtorch.compile delivers an average training speedup of 30% to 2x on mainstream models and can be enabled with just a single decorator call.
65%UnverifiedIn CPU benchmarks, after compiling GAP20 with torch.compile, training throughput improved by about 19.9% compared with the uncompiled version.
70%Unverifiedtorch.compile is an automated compilation optimization tool provided by PyTorch that can automatically perform partial operator fusion and graph optimization, but hand-written CUDA/Triton kernels can achieve more fine-grained control.
60%UnverifiedIn the underlying technology stack of torch.compile, AOTAutograd handles the separation of forward and backward graphs.
50%UnverifiedThe PyTorch framework and its accompanying libraries (such as torchvision, torchaudio, TorchServe and torch.compile-related tools) iterate frequently, and there are API deprecations and behavior changes between versions.
50%Unverifiedtorch.compile is a compilation frontend introduced in PyTorch 2.x, which captures the computation graph via TorchDynamo and generates optimized kernels via a backend (such as Inductor), without changing the model's mathematical definition.
50%Unverifiedtorch.compile is a compilation frontend introduced in PyTorch 2.0 that improves training and inference speed through optimizations such as operator fusion and kernel generation.
50%UnverifiedThe PyTorch ecosystem already has SIGs for compilation (torch.compile), distributed training and others, whose outputs include RFC documents, quarterly roadmaps and cross-repository compatibility tests.
50%Unverifiedtorch.compile optimizes a model's forward and backward passes through graph capture and kernel fusion.
50%UnverifiedOn GPUs that support Tensor Cores, combining torch.compile and SDPA typically delivers a 1.5–2x speedup without changing mathematical equivalence.
50%UnverifiedPyTorch 2.x introduced torch.compile, which completes graph capture and operator fusion with almost no changes to user code.
50%UnverifiedTorchTPU completes graph compilation optimization through torch.compile and XLA, allowing developers to switch to compiled mode when performance is needed.
50%UnverifiedInductor is the default compilation backend of torch.compile in PyTorch 2.x, responsible for splitting FX graphs into kernels, generating Triton or C++ code, and providing a pluggable backend interface for different accelerators.
50%UnverifiedTorchNeuron, as a native backend, is registered as an optional backend for torch.compile, enabling the same model code to be lowered to Trainium for execution without modification.
50%UnverifiedThe Windows installer uses a scheduled task to re-point to the new Visual Studio compiler version at startup, at login, after VS updates and daily, so that the paths in PATH remain valid and features that depend on compilation, such as torch.compile, keep working.
50%