LLM Serving

TorchTPU 0.2.0 puts PyTorch ATen kernels and torch.compile on Google TPUs

Google open-sourced TorchTPU, an Apache 2.0 PyTorch back end for TPUs. Here is what it covers, what it still routes through XLA, and what changes when you port a workload.

Published
October 20, 2026
Read
5 min
Published by
Samir Sengupta
TorchTPU 0.2.0 running PyTorch ATen kernels and torch.compile on Google TPUs through an XLA backend
Note 097 / 098Daily note · Written from 1 source

How this was madeDrafted with Claude, Anthropic’s model, from 1 cited source, then checked against it in a second editing pass. Editorial policy

the short version

  • TorchTPU still executes through XLA, via its own ATen kernels and a compilation cache for XLA computations.
  • The README documents torch.compile() for graph mode and data and tensor parallelism, and does not mention eager mode, FSDP, pipeline parallelism or user-defined custom ops.
  • Installing 0.2.0 without the PyTorch CPU index pulls the CUDA build of torch, so environment pinning is the first migration step.
  • The README lists inference examples but gives no throughput, latency or PyTorch/XLA comparison figures.

Google has open-sourced TorchTPU, a PyTorch back end for Tensor Processing Units, under the Apache 2.0 license, with version 0.2.0 on PyPI. Its README lists PyTorch ATen kernels implemented for TPU, a compilation cache for XLA computations, integration with torch.compile() for graph mode, and support for data and tensor parallelism. It does not document eager mode, FSDP, pipeline parallelism or how to register custom ops, and it does not compare itself with PyTorch/XLA. For an existing workload, the documented first step is installing torch_tpu 0.2.0 on Python 3.11 or later against the PyTorch CPU wheel index.

The repository has 4,465 commits and ships examples for Llama, Qwen, ResNet, DLRM, minGPT and UNet. Its user guide at torchtpu.readthedocs.io is a static version of Marimo notebooks, which must run on a TPU VM. The README describes a v6e GCE instance as the easiest option. It publishes no benchmarks and lists its key Python dependencies as TBD, so teams deciding whether to move a workload are working from a feature list rather than a migration guide.

TorchTPU still compiles through XLA

One Hacker News commenter argued sarcastically that the release could not have been a same-day reaction to other news, and described it in passing as a Torch to XLA translation layer. The underlying description is consistent with the README, which lists a compilation cache for optimized execution of XLA computations. Its build notes also describe a shared XLA/MLIR backend that is factored into a single libxla_base.so. On top of that sits a set of custom ATen kernels for various PyTorch operations, which the README calls a PyTorch ATen kernel implementation for TPU.

The sources do not compare this design with PyTorch/XLA. They do not say whether existing PyTorch/XLA code runs unchanged, whether its device and step-marking APIs are retained, or how the two projects will coexist. Engineers with PyTorch/XLA training loops should not assume their device-handling code carries over until the user guide says so. One commenter recalled having to fight XLA to make PyTorch run on TPUs and called this first-party support, but the README states no compatibility guarantee with the older project.

torch.compile() is the documented graph mode

The feature list names integration with torch.compile() for graph mode execution. For a team already using torch.compile on GPUs, this is the documented route: the same entry point, now targeting TPU. The README does not use the phrase eager mode. It also does not say whether operations run op by op outside torch.compile(), how such execution would perform, or whether it is intended for production rather than debugging.

One commenter argued that XLA may be a better compiler infrastructure than Inductor, which would mean better performance across hardware. The sources contain no numbers that support or refute this. There is also no torch.compile benchmark on TPU against any baseline, so teams will need to run that comparison themselves.

README lists only data and tensor parallelism

The README claims support for distributed training with Data Parallelism and Tensor Parallelism, plus examples for distributed training and model inference. It does not mention FSDP, pipeline parallelism, expert parallelism, or which torch.distributed backends and collectives are implemented. A training job that combines sharded parameters with tensor parallelism should not assume the sharding half carries over. The six example models are the best available guide to what has been exercised: two LLM families (Llama, Qwen), a recommender (DLRM), and three vision and language models (ResNet, minGPT, UNet).

Custom ops and Pallas kernels are undocumented

The project's custom ATen kernels are its own TPU implementations of PyTorch operations. The README does not say how a user registers a new custom op, whether torch.library extensions dispatch to TPU, or how hand-written kernels plug in. One commenter suggested that because hardware specifics live mostly in the kernel layer, Pallas on TPU or CUDA on GPU, choosing between JAX and PyTorch becomes a matter of style. The README does not mention Pallas, so a workload that depends on custom CUDA kernels has no documented TPU equivalent yet. That is a major unknown for anyone porting optimized serving code.

Installing 0.2.0 means pinning the CPU torch wheel

The package is published as torch_tpu, and its Python support policy follows PyTorch's Release Compatibility Matrix. The install command uses the PyTorch CPU index. The README warns that installing without that index pulls the CUDA version of torch.

bash
python -m venv .venv
source .venv/bin/activate
pip install torch_tpu==0.2.0 --extra-index-url https://download.pytorch.org/whl/cpu

Building from source uses Bazel, installed through Bazelisk, and the --config=wheel_common flag is mandatory. Without it, every per-version build ships its own copy of the backend, and the wheel aborts on import torch with duplicate static registrations. That config also enables Remote Build Execution, so contributors without RBE credentials must append --config=no_rbe after it, because the later config wins. The README also notes that the first run generating clangd's compile database may take more than 30 minutes.

Serving on TPUs has examples but no performance numbers

The README lists examples for model inference, and two of the six example models are LLM families. It gives no tokens-per-second figures, latency figures or batch sizes, and names no TPU generation beyond the v6e recommendation for notebooks. One commenter asked whether this was Google's answer to DeepSeek's open-source inference engine, and another replied that the two sit in different parts of the stack. The second commenter read TorchTPU as a way to get more people familiar with TPUs that Google wants to sell outside the company.

Commenters also pointed to AWS's torch-neuronx, which plays a similar role for Trainium. One said they are building an open-source libtpu implementation for Tenstorrent accelerators, called libtt, that can already run most of TorchTPU. Another said they drive PJRT from Lean. These claims are unverified, but they suggest the layer beneath TorchTPU may be reachable from other hardware.

For now, the practical checklist for a port is short. Pin the CPU torch wheel and start from the closest of the six examples. Route graph execution through torch.compile(), and confirm your parallelism strategy is data or tensor parallel. Then benchmark against your current stack yourself.

Questions this raises

Does TorchTPU replace XLA for running PyTorch on TPUs?

No. The README lists a compilation cache for XLA computations, and the build notes describe a shared XLA/MLIR backend in libxla_base.so. Custom ATen kernels sit on top of that layer. The sources do not compare TorchTPU with PyTorch/XLA or promise that PyTorch/XLA code will run unchanged.

Which parallelism strategies does TorchTPU 0.2.0 support?

The README claims support for data parallelism and tensor parallelism only. It does not mention FSDP, pipeline parallelism, expert parallelism, or which torch.distributed backends are implemented.

Are there performance benchmarks for TorchTPU?

No. The project publishes no benchmarks, including no tokens-per-second or latency figures for its inference examples. Teams will need to compare torch.compile on TPU against their current stack themselves.

Spotted an error? Email samir.s.sengupta@gmail.com and I will correct it and date the change at the top of the note. How these notes are researched, drafted and checked is in the editorial policy.

More notes

Building something on this?

I ship production LLM, RAG and agentic systems for a living - the infrastructure behind the things these notes are about. Open to roles, contract work and research collaboration.