Pallas, From the Inside

Pallas is the kernel language you reach for when XLA fusion is not enough: a Python function over blocks of a grid, lowered to Mosaic on a TPU and to Triton or Mosaic GPU on a GPU. The track starts with a kernel you run in interpret mode on a laptop, reads the language and both lowerings, derives attention, and ends in a production library that autotunes it.

Phase 1 — Run it first

Interpret mode runs a Pallas kernel on any machine; the first article is how to write one that also runs on a chip.

Phase 2 — The language

pallas_call, BlockSpec, the grid, and the memory spaces: the four ideas every kernel is made of.

Phase 3 — The TPU lowering

What a kernel becomes on a TPU: a pipelined schedule of DMAs into VMEM and a Mosaic module for the core.

Phase 4 — The GPU lowerings

Two lowerings for one language: Triton, and Mosaic GPU with its sm90 and sm100 paths.

Phase 5 — Attention, derived

The kernel everyone writes, as it is actually written: flash attention on a TPU and the splash kernel that makes masks cheap.

Phase 6 — A kernel library

tokamax: the same kernels wrapped in an Op with a dispatch key, an autotuner, and a benchmark loop.

Browse the full library