google-pytorch/torch_tpu

Machine Learning

Lets PyTorch users run and train their models on Google TPUs through a native ATen backend.

794
72
C++
NOASSERTION
7 months old

TorchTPU is a PyTorch backend for Google TPUs. Instead of moving a model to an XLA-specific frontend, it provides custom ATen kernels so PyTorch operations and models can execute on TPU devices, with a compilation cache for optimized XLA execution and integration with torch.compile() for graph-mode execution. The guide and examples are aimed at model and performance engineers rather than casual users.

What you get

The project ships implementations of PyTorch ATen kernels for TPU, support for Data Parallelism and Tensor Parallelism, and examples covering Llama, Qwen, ResNet, DLRM, minGPT and UNet. It also includes utilities for debugging and benchmarking. The intended flow is still ordinary PyTorch code: define and run your model, then let the backend and compile path place work on TPU devices. Public APIs are documented separately from the tutorials.

Running it

The interactive Marimo notebooks (a Jupyter-like format) must run on a TPU VM; a v6e GCE instance is described as the easiest option. The static versions are published in the user guide, so you can read the tutorials without a TPU, but you cannot execute the notebook code there.

Python and installation. The pip path installs release 0.2.0 from PyPI and supports Python 3.11+, following PyTorch's release compatibility matrix. The install command points at the CPU PyTorch wheel index; installing without it pulls the CUDA build of torch.

Building from source. Source builds use Bazel via Bazelisk. Wheels require --config=wheel_common; without it, the build fails, and a wheel built the wrong way aborts on import torch with duplicate static registrations. wheel_common enables Remote Build Execution, so developers without RBE credentials must add --config=no_rbe after it, since later configs win. Optimized builds are the default; unoptimized wheels are only for C++ debugging and can degrade performance. C++ navigation uses clangd and a generated compilation database; the first full build may take over 30 minutes.

Limits and scope

A TPU device or TPU VM is required for actual execution; the documentation describes no other accelerator path. The README's dependency list is marked TBD, so the complete Python dependency set is not enumerated there. Performance claims should be read together with the benchmarking utilities and the conditions used, not as general speedups. Contributions require a Contributor License Agreement. The repository's README states Apache 2.0 licensing, while the repository metadata reports no recognized license identifier — check the LICENSE file before relying on either.

HotRepo's take

A 2026-10-20 Hacker News thread drew 380 points and 93 comments, and a single weekly C++ board observation on 2026-10-29 showed +189. That is dated attention, not evidence of sustained growth.

Project source and documentation

Written by AI from the project's README, updated October 29, 2026. The project's own docs are the source of truth.

Hacker News

Google open-sources TorchTPU, a native PyTorch back end for TPUs
▲ 380 · 93 comments · October 20, 2026