Skip to main content
Back

Cyber Monday Deal: Get 20% off all AlphaSignal Pro subscriptions. Ends soon.

Tenstorrent's Libtt Lets JAX and PyTorch Run on RISC-V AI Chips

A new PJRT plugin plugs Tenstorrent chips into JAX and PyTorch, letting TPU code run on the hardware with only kernel swaps.

Pro

  • Libtt implements PJRT for Tenstorrent chips, letting JAX and PyTorch TPU code run almost unchanged.
  • Entire stack (compiler, runtime, kernels) ships as a single libtt.so shared library plus a pip wheel.
  • Built on upstream tt-xla, tt-mlir and tt-metal, with fixes and new compiler optimizations layered on top.
  • Runs SGLang-JAX, TorchTitan and Miles, covering serving, fine-tuning and reinforcement learning.
  • JAX test baseline: 22,837 passed, 2,800 failed, 6,531 skipped; several test directories still excluded.
  • Qwen3-8B on a P150 card reaches roughly 30 tokens per second after warmup.

Tenstorrent has shipped RISC-V-based AI accelerators alongside an open-source software stack, but running complete JAX and PyTorch workloads has required developers to assemble several projects and work around compatibility gaps. A new preprint by Philipp Moritz and Sarah Dong, the Libtt paper, packages that stack behind PJRT, the device interface used by XLA-based frameworks.

Libtt lets JAX target Tenstorrent devices directly and connects PyTorch through the existing TorchTPU backend. TPU-oriented applications can retain their framework code, model definitions, and execution flow. Hardware-specific kernels still require Tenstorrent implementations.

PJRT becomes the compatibility hinge

PJRT, short for Portable JIT Runtime, defines how an XLA client discovers devices, transfers buffers, compiles programs, and launches execution. JAX uses it to communicate with TPU backends, and TorchTPU exposes a similar path for PyTorch workloads.

Libtt implements that interface for Tenstorrent hardware. The compatibility layer presents the software contract expected by TPU-oriented frameworks, then compiles each program for Tenstorrent’s architecture. This approach reduces framework integration work because JAX and TorchTPU already know how to call PJRT.

One library wraps three upstream layers

Libtt builds on Tenstorrent’s existing open-source projects rather than introducing a separate compiler and runtime:

Layer Project Role
Framework interface tt-xla Provides the PJRT plugin used by XLA clients.
Compiler tt-mlir Lowers StableHLO programs into forms suitable for Tenstorrent devices.
Runtime and kernels tt-metal Manages devices, firmware, execution, and base kernels, including TTNN operations.

The distribution consists of a pip-installable wheel and a self-contained libtt.so shared library containing the compiler, runtime, firmware, and kernel sources. PyTorch users enable TPU compatibility with LIBTT_TPU_COMPAT=1, allowing TorchTPU to discover Tenstorrent devices and submit work through PJRT. JAX users select the backend with JAX_PLATFORMS=tt.

The source repository contains a thin packaging layer. At startup, libtt materializes an embedded tt-metal runtime archive. Its build links the upstream tt-xla PJRT plugin into the shared object and hides internal symbols, exposing only the PJRT entry points. Bazel overlays pull in the upstream Tenstorrent components.

StableHLO goes in, tt-metal work comes out

The compiler receives StableHLO, the portable operation format emitted by XLA-based frameworks, and lowers it through tt-mlir. The resulting program runs through tt-metal, which handles device execution and dispatches the required kernels.

Numeric types remain intact across the interface, compiler, and runtime. The paper specifically reports end-to-end support for the FP8 formats float8_e4m3fn and float8_e5m2, preserving them in PJRT buffers and compiler tensor types instead of converting them to wider formats.

TPU-specific custom kernels remain the main portability boundary. Pallas, Mosaic, and other XLA kernels encode assumptions about TPU hardware primitives, so libtt replaces them with upstream Tenstorrent kernels, project-specific implementations, or equivalent framework operations.

Coverage extends beyond test programs

The paper reports that libtt runs three workloads covering common stages of model development and deployment:

  • SGLang-JAX serves models, including a Qwen3-8B endpoint with prefill and decode graph capture.
  • TorchTitan handles model fine-tuning through the PyTorch compatibility path.
  • Miles runs reinforcement-learning workloads.

The published JAX test results provide a more precise view of backend coverage:

Result Tests
Passed 22,837
Failed 2,800
Skipped 6,531

Among tests that ran, 89.1% passed. The reported suite excludes several directories, including Pallas, Mosaic, multiprocess, profiler, and sparse tests, so the numbers do not represent complete JAX compatibility.

Qwen3-8B demonstrates the serving path

The repository documents Qwen3-8B serving on a Tenstorrent P150 card with SGLang-JAX. The server selects the Tenstorrent backend, sets the attention backend to tt, pads prefill inputs to a 32-token tile when configured, and records fixed-shape execution graphs.

After compilation and graph-capture warmups, the reported throughput is about 30 tokens per second for 128-token generations. The authors identify host CPU power settings and core placement as performance variables, and the paper does not present broader comparisons across models, cards, batch sizes, or competing accelerators.

Fixed-shape graph capture reduces host overhead by recording prefill and decode execution for later replay. Without capture, the host must dispatch the model’s prefill operations individually. The design aligns with JAX’s shape-specialized compilation model and PJRT’s compiled-executable interface.

PJRT lowers the cost of adding an accelerator

Accelerator vendors need framework integrations that cover device discovery, compilation, memory transfer, execution, and error handling. Implementing PJRT gives Tenstorrent an existing integration point for JAX and TPU-oriented PyTorch software instead of requiring each framework or application to target TTNN directly.

For developers, the practical gain is reuse. Model code and framework-level operations can follow the same path used on TPUs, with libtt translating the compiled program into Tenstorrent’s stack. Porting effort concentrates on unsupported operations and custom kernels, where hardware-specific behavior cannot be abstracted by PJRT.

Version one still has sharp boundaries

The v1 preprint documents incomplete support for multiprocess execution, profiling, sparse operations, Pallas, and Mosaic. Its performance evidence covers one serving model on one card at modest batch sizes, leaving scaling behavior and comparative efficiency unmeasured.

Compilation latency also affects initial requests. Disabling precompilation or server warmup shifts compilation and graph-capture costs into the request path, producing substantially slower startup requests.

Developers with supported Tenstorrent hardware can install the wheel, set JAX_PLATFORMS=tt, and run compatible JAX workloads through PJRT. PyTorch applications can use TorchTPU after enabling LIBTT_TPU_COMPAT=1. That path replaces direct TTNN integration for supported framework operations, with custom kernels and excluded features still requiring targeted porting work.