Google has open-sourced TorchTPU, a native PyTorch backend for Cloud TPUs. It was co-developed with the PyTorch team at Meta and announced at PyTorch Conference 2026 on October 20, 2026. Existing PyTorch code targets a TPU through a standard torch.device("tpu"). TPUs now sit beside GPUs and CPUs as a native PyTorch device. Google team states that TorchTPU replaces PyTorch/XLA and recommends it for all new workloads.
torch.compile for production-level throughput.TorchTPU is an open-source PyTorch backend from Google and Meta that runs PyTorch models natively on TPUs. It plugs in through PyTorch’s PrivateUse1 interface. Tensors are ordinary PyTorch tensors, with no subclasses or wrappers. It runs one process per device and preserves tensor views and in-place mutations.
The predecessor, PyTorch/XLA, recorded lazy-tensor graphs. Developers often added code to mark compilable regions. PyTorch/XLA also only supported pure SPMD code. TorchTPU also handles divergent MPMD execution.
TorchTPU ships 3 eager modes:
For peak speed, torch.compile(backend="tpu") captures the graph with TorchDynamo. It lowers through StableHLO to OpenXLA, which emits TPU machine code. Compiled executables are cached across processes, hosts and job restarts.
Custom Pallas kernels are callable as standard PyTorch functions. Prebuilt Tokamax kernels and Helion tile kernels also work.
Distribution uses the tpu_dist process group. It supports DDP, FSDP2 and DTensor, along with a topology-aware mesh for TPU interconnects.
All figures below are self-reported by Google and partners.
torch.compile gave 3.80x.device_map="tpu". Diffusers supports eager, torch.compile and tensor parallelism.tpuxlaneuronNot PyTorchBackend mechanismPrivateUse1Lazy-tensor graph recordingPrivateUse1Not applicableDefault executionEager (Strict, Debug, DeferAndFuse)Lazy tensorsEager plus torch.compileNot disclosedCompile pathTorchDynamo to StableHLO to XLAXLANeuron CompilerXLADistributed APIsDDP, FSDP2, DTensor, SPMD and MPMDPure SPMD onlyFSDP, DTensor, DDP, TPNot disclosedCustom kernelsPallas, Tokamax, HelionNot disclosedNKIPallasvLLM / SGLang servingvLLM-TorchTPU, SGLang-TorchTPUNot disclosedvLLM NeuronvLLM-JAX, SGLang-JAXStatusOpen source, v0.2.0Being replaced by TorchTPUPublic beta (Neuron 2.33)MaintainedLicenseApache 2.0Not disclosedNot disclosedNot disclosedInstall the package on a TPU VM, then pick the tpu device:
# pip install torch_tpu
import torch
device = torch.device("tpu")
x = torch.randn((4, 4), device=device) The repo’s README pins torch_tpu==0.2.0 with the CPU PyTorch wheel index. Without it, pip pulls the CUDA build of torch. Full guides live at torchtpu.readthedocs.io.
torch.compile(backend="tpu") lowers through StableHLO and XLA.Check out the GitHub repo, paper, docs and Google Cloud announcement. All credit goes to the researcher of this project. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.