Skip to content
DAH

A Triton BF16 GEMM within 3% of cuBLAS across an LLM shape sweep on H100

OpenTo verify: GPU benchmarkPosed by Triton matrix-multiplication tutorial; Hopper support in Triton 3.x
AI-reviewed
On this page15 sections
Difficulty
27/100Engineering
How far from a resolution. P vs NP = 100
Application value
45/100Significant
Realistic practical impact if resolved. P vs NP = 100
Leverage
30/100Local
How much other knowledge hinges on it. P vs NP = 100

Difficulty 27: compiler heuristics and scheduling on a well-understood operation; slightly above the FP8 parity task (24) because the kernel author cannot hand-place warps and the tuning budget is capped. Application value 45: matters wherever fused epilogues are written in Python. Leverage 30: decides how close torch.compile output gets to vendor GEMMs.

The problem

Can a Python-level Triton matrix multiply match the closed vendor library within 3% on 40 real sizes?

  1. 1cuBLAS is closed and heavily tuned
  2. 2Real shapes are thin, wide and awkward
  3. 3Triton needs Hopper features and tuning
  4. 4At most 20 settings per shape
  5. 5Python-level code at vendor speed

What is asked. Triton lets a programmer write a GPU kernel in Python for whole tiles of a matrix, and a compiler handles the details of threads and memory (see the Triton entry). PyTorch's compiler generates Triton code automatically. The problem asks whether a Triton matrix multiply in BF16 (16-bit floats, with sums kept in 32-bit) can run at 97% or more of NVIDIA's cuBLAS library on one H100. It must do this on every one of 40 shapes taken from real language models. Autotuning may try at most 20 configurations per shape.

Why the hard shapes matter. Multiplying an M×KM \times K matrix by a K×NK \times N one costs 2MNK2MNK operations. When M=N=K=8192M = N = K = 8192, that is about 1.1×10121.1 \times 10^{12} operations, a few milliseconds of tensor-core work, and many tile layouts reach near-peak speed. The 40 shapes also include MM from 1 to 64, where a model is generating text and the kernel mostly waits on memory. They include sizes that are not multiples of the tile, which leave part of the chip idle in the last round of tiles. And they include cases where the best kernel stays resident on the chip and loops over tiles, rather than launching one thread block per tile. cuBLAS handles these with heuristics and many precompiled variants, picked per shape. A Triton kernel has one source and a handful of parameters (tile sizes, pipeline depth, number of warps). The compiler must turn them into the asynchronous, warp-specialised code that Hopper needs. The analogy is a tailor-made suit versus an adjustable off-the-rack one. It breaks because the "adjustments", autotuning, can be searched by machine, but the search budget here is capped at 20 tries.

State of the art. Triton's tutorial matrix multiply and tuned variants reach a large fraction of cuBLAS on large square shapes in public benchmarks. Recent releases add Hopper's asynchronous copies and warp specialisation. Kernel authors report gaps on skinny, odd-sized and persistent-scheduling shapes, but no source gives a number across a full sweep. The 3% bar with a 20-configuration budget is a deliberate stretch.

What a solution looks like. A public Triton kernel at a pinned release, timed against cuBLAS on one H100 on all 40 published shapes, at 97% or more each time, with error no worse than 1.1 times cuBLAS's. A second party must rerun it.

Go deeper

The full technical text.

Using only upstream Triton language features (a pinned public release), write a BF16 GEMM with FP32 accumulation whose median throughput on one H100 SXM is at least 97% of cuBLAS on every shape in a sweep of 40 LLM projection shapes (M from 1 to 16384, N and K from the Llama-3 8B/70B and Mixtral families), including skinny and non-tile-multiple shapes, using autotuning limited to 20 configurations per shape.

Words on this page (10)
Words on this page
Triton
A Python-embedded language in which a GPU kernel is written for whole tiles; its compiler handles the low-level details.
GEMM
General matrix multiply, C = A·B: the operation that takes most of the arithmetic in neural networks.
cuBLAS
NVIDIA's closed-source library of tuned linear-algebra routines, the usual speed baseline for matrix multiply.
compiler
A program that translates code from one language into machine instructions.
autotuning
Trying several settings of a kernel (tile sizes, pipeline depth) by timing them, and keeping the fastest.
tensor core
A unit inside each GPU core that multiplies small matrix tiles in one instruction, much faster than ordinary arithmetic.
Hopper (H100)
NVIDIA's 2022 data-centre GPU generation; the H100 is its main chip.
warp specialisation
Giving different groups of GPU threads different jobs, for example some load data while others compute, so the two overlap.
PyTorch
The open-source Python library in which most neural networks are written; its built-in operators are the baseline here.
kernel (GPU)
A function that runs on the GPU, executed by thousands of threads in parallel.
New to this? Read first (3)
New to this? Read first
AI-reviewedAn AI drafted this explanation. Check it against the technical text.

Built from

earlier problems → this one

The earlier problems this one is built from. “Builds on” means it needs their progress or tools. “Generalizes” means they are special cases that come first. “Implies” means they are weaker results on the way. On the right is what builds on this problem.

  1. Start with
    • A Triton BF16 GEMM within 3% of cuBLAS across an LLM shape sweep on H100This problem
  2. Then

Path to understanding

foundations → problem

The research entries this problem rests on, in the order to read them. Each links to its explainer.

  1. Start with
  2. Step 2
  3. Step 3
  4. Then
    • A Triton BF16 GEMM within 3% of cuBLAS across an LLM shape sweep on H100The problem

State of the art

Triton's tutorial GEMM and tuned variants reach a large fraction of cuBLAS on large square shapes in public benchmarks, and recent Triton releases support TMA and warp-specialised pipelines on Hopper. The gap on skinny, odd-sized and persistent-scheduling cases is reported by kernel authors but the curator found no primary source that fixes a single number across a full sweep. The 3% bar with a bounded tuning budget is a deliberate stretch; it should be confirmed as open against current Triton benchmarks.

Realistic applications

If a compiler-language GEMM reaches vendor parity, fused GEMM epilogues and custom quantisation schemes can be written without leaving Python.

What counts as solved

A public kernel and sweep at pinned versions that meets the bar on all 40 shapes, rerun by a second party.

How it gets verified

To verify: GPU benchmark

A kernel run and timed on stated hardware against a baseline.

Hardware: one H100 SXM 80 GB. Dtypes: BF16 inputs and output, FP32 accumulation. Shapes: 40 listed (M, N, K) triples published in the harness repo, covering decode (M 1 to 64), prefill (M 2048 to 16384) and non-multiples of 128. Baseline: cuBLAS (cublasLt) from CUDA 12.8 or later, exact version recorded, via torch.matmul with the version of PyTorch recorded. Metric: median TFLOP/s over at least 100 iterations after warmup, CUDA events, tuning time excluded but reported with a limit of 20 configurations per shape. Correctness: max relative error versus FP32 reference no more than 1.1x that of cuBLAS. Harness: public script at a pinned commit and Triton release.

Claims

No claimed results on this problem.

Where the work is

Theory
8%
New mathematical or conceptual ideas
Engineering
70%
Building instruments, chips, systems, software, formal proofs
Compute
12%
Raw computation, search, simulation
Empirical
10%
Observation, experiment, data collection

Compiler engineering and per-shape tuning, measured on H100.

Connected problems