Torch.compile support for Python 3.14 completed

Signalboosting that torch.compile is now compatible with Python 3.14! You can try it out today with the nightly PyTorch binaries. 3.14 support will be included in the next PyTorch release, 2.10.

The no-GIL builds, 3.13t and 3.14t have basic support - torch.compile can run in those builds but multi-threading with torch.compile is still not supported.

There were not too many significant Dynamo changes needed to support Python 3.14. But a number of Python 3.14 changes affected PyTorch as a whole:

  • Changes to __annotations__: Significantly, this broke TorchScript. As a result, we are now skipping torch.jit unit tests and are issuing warnings in 3.14+ on TS usage.

  • Default multiprocessing start method: Changed from fork to forkserver, which affected DataLoader tests. The fix was to manually set the start method back to fork.

  • Pickling changes: The Python pickler now returns different exceptions for some pickling failures. A number of sites in the codebase that caught such errors needed to be updated.

  • Integer conversion changes: __int__ no longer calls __trunc__, which affected integer conversion of symbolic floats.

  • Introduction of PyStackRefs in CPython implementation: Required moderate changes to the C/C++ parts of Dynamo.

Previous posts on torch.compile support for new Python versions:

3 Likes