Skip to content

Examples

Each page shows one kernel from the repository as it is, and explains what it computes and how. They are ordered so that each adds a little to the one before.

Kernel What it adds
saxpy One dimension, one slice per CTA, elementwise math, masking.
gemm, f32 Two dimensions, a loop over k, tiles in shared memory, dot, autotuning.
Q8_0 matvec Quantized weights, a conversion, per-block scales, broadcasting.
gemm on tensor cores The same gemm with @tensorcore: f16 operands, f32 accumulation.
Flash attention, f32 Several tiles carried across a loop, row reductions, an online softmax.

All five compile with phobos-compile, and all but the matvec are among the kernels phobos-kbench times; see Compile and benchmark.