OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Infrastructure & Serving

Xla

Xla is the public site for PyTorch/XLA, a Python package that uses the XLA deep-learning compiler to connect PyTorch workloads to XLA devices, including Google TPUs.

Independent OpenViST project profile, based on linked sources.

Xla — OpenViST project profile in AI Infrastructure & Serving.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use PyTorch/XLA when a PyTorch workload needs to run on an XLA device such as a Google TPU and you need the integration package and workflow guidance to adapt it.

Who it is for

  • PyTorch developers adapting training or inference workloads to XLA-backed accelerators.
  • Teams working with TPU systems that need documented single-process or multi-process training patterns.

Documented uses

  • Adapt an existing PyTorch training loop to place models and data on an XLA device.
  • Configure a multi-process training example that launches workers and combines gradients across replicas.
  • Explore example workloads through the linked Kaggle notebooks for Stable Diffusion and distributed PyTorch/XLA.
Before you choose

Requirements & limits

The project is presented as a public GitHub repository. Its README describes stable TPU VM installation and offers a Kaggle route to try a single Cloud TPU VM.

  • The documented TPU installation pairs specific torch and torch_xla versions, so check the repository's current instructions before setup.
  • The README shows distinct single-process, multi-process, and SPMD modes; multi-processing is stated to be incompatible with SPMD.
  • Custom-kernel users are given separate optional Pallas dependency instructions.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Adapt a PyTorch training loop for a single XLA device

Make the documented changes to an existing training loop so its model and data use an XLA device.

Before you start

  • A TPU VM with PyTorch/XLA installed.
  • The README's stable-build instructions specify Python 3.8 to 3.11 and pair torch 2.8.0 with torch_xla[tpu] 2.8.0.

Steps

  1. Import torch_xla.

  2. Move the model parameters to the XLA device with model.to('xla').

  3. Inside the training loop, wrap the training work in torch_xla.step() and move inputs and labels to 'xla'.

  4. Call torch_xla.sync() after the loop.

Expected outcome

The documented example adapts the training loop to train the model on a TPU through the XLA device.

Guide limitations

  • This recipe covers the single-process example; the README describes that mode as one Python interpreter controlling a single TPU at a time.
  • The installation versions are specific to the documented stable-build instructions; check the repository for current instructions.
Source-based practical guide

Adapt an existing loop for multi-process TPU training

Follow the README's multi-process changes for launching workers and combining replica gradients.

Before you start

  • A TPU system with multiple devices available to the workers.
  • A PyTorch/XLA environment installed according to the repository's TPU instructions.

Steps

  1. Import torch_xla and torch_xla.core.xla_model as xm.

  2. Move the model parameters to the XLA device in the worker function.

  3. Wrap each training iteration in torch_xla.step() and move inputs and labels to 'xla'.

  4. Use xm.optimizer_step(optimizer) in place of optimizer.step(), then launch the worker function with torch_xla.launch.

Expected outcome

The example configures a multi-process PyTorch/XLA training workflow and uses the documented optimizer step to combine gradients across replicas.

Guide limitations

  • The README describes this mode as multiple Python interpreters corresponding to the TPUs found on the system.
  • Multi-processing is not compatible with SPMD; the repository links to a separate SPMD guide.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
16 October 2026
Original website title
pytorch/xla · Official homepage title · retained in its source language