ML Systems & Infrastructure

Triton GPU programming

Triton lets you write a GPU kernel in a Python-like language while thinking in terms of tiles — blocks of a tensor — rather than individual threads. You describe what one program instance does to one tile, and the compiler handles the thread-level mapping, memory coalescing, and shared-memory allocation that a CUDA programmer would otherwise manage by hand.

A Triton program is single-program-multiple-data at the block level: you index into tensors with pointer arithmetic over ranges, load tiles into registers, compute, and store, using masks for ragged boundaries. The compiler lowers this to LLVM and PTX, automatically vectorizing, software-pipelining asynchronous loads, and staging data through shared memory, while exposing a few tuning knobs — block sizes, number of warps, pipeline stages — that an autotuner sweeps. It deliberately trades a little peak performance and low-level control for a large gain in productivity.

Triton became the default way to write custom fused kernels in the PyTorch ecosystem: TorchInductor, the backend of torch.compile, emits Triton for its fused pointwise and reduction kernels, and many flash-attention variants ship as Triton. It hits a sweet spot — close to hand-tuned CUDA for memory-bound and moderately compute-bound kernels, at a fraction of the engineering cost.

Also called
TritonOpenAI Triton