Google and Meta are collaborating on TorchTPU, an open-source backend intended to run PyTorch models natively on Google TPUs. The project aims to make migrating GPU workloads easier while giving greater priority to PyTorch features such as eager execution.
For many existing models, the project says only small code changes are needed: users can move a model to “tpu” instead of “cuda.” TorchTPU supports both eager and compiled execution, with compilation integrated through torch.compile. It also aims to support common PyTorch distributed-computing features. Unlike earlier approaches, TorchTPU is designed not to depend on JAX at runtime.
The project remains in active development. At the time of the post, the team reported support for around 450 ATen operations and said it had validated execution on the 5,000 most-downloaded Hugging Face models. Integrations with vLLM, SGLang, TorchTitan and Ray, as well as multi-host workloads, were also validated. The post says TorchTPU is already used for inference and training by some large Google Cloud customers.
A simple migration does not guarantee peak performance: model shapes, sharding and operations may be optimized for GPUs. The original post also explains the architecture, precision modes and initial results. Source: PyTorch Blog