Working withfullgraph=False#
Created On: Jul 28, 2025 | Last Updated On: Sep 03, 2025
Whilefullgraph=False is the defaulttorch.compile setting, the semantics of resuming compilation upon encountering a graph break are more complicated.You can find details on thefullgraph=False semantics in the subsections.
The strategy for usingtorch.compile(fullgraph=False) is as follows:
Determine the ideal location to place
torch.compile. Normally, it is the highest-level function that doesn’t result in excessive graph breaks.Functions that do a lot of preprocessing or I/O operations are examples of functions that result in many graph breaks and do not significantly benefit fromtorch.compile.a. You can isolate issues by first compiling individual functions/modules before compiling entire models.Apply
torch.compiler.disableto functions in the compiled region that result in a lot of graph breaksand do not benefit from compilation. In this case, one graph break is better than potentially tens or hundreds.Use
TORCH_LOGS="graph_breaks"or tlparse to investigate remaining graph breaks.Work around these graph breaks using the same approaches as working around graph breaks underthefullgraph=Trueprogramming model. Not all graph breaks need to be removed - some mayimpact performance more than others. The general rule is to focus on graph breaks that are happening during model computation.a. We recommend usingtorch.compile(backend='eager')when debugging graph breaks, for faster debugging iteration times