torch.compile does not support true pre-compilation without running the Python program

7/10 High

Users on expensive clusters want to pre-compile models to avoid paying compilation costs at runtime, but torch.compile requires actually executing the Python program to discover compilable regions, making straightforward ahead-of-time compilation impossible. This is compounded by graph breaks and unknown input metadata.

Category
performance
Workaround
hack
Stage
build
Freshness
persistent
Scope
single_lib
Upstream
open
Recurring
Yes
Buyer Type
team
Maintainer
active

Sources

Collection History

Query: “What are the most common pain points with PyTorch for developers in 2025?4/4/2026

Whenever someone realizes that torch.compile compilation is taking a substantial amount of time on expensive cluster machines, the first thing they ask is, 'Why don't we just compile it in advance?' To support precompiling the torch.compile API exactly as is not so easy; unlike a traditional compiler which gets the source program directly as input, users of torch.compile must actually run their Python program to hit the regions of code that are intended to be compiled.

Created: 4/4/2026Updated: 4/4/2026