CUDA Primitives Warm-up
Implement basic elementwise and reduction kernels that form the building blocks for matrix and attention operations.
Build a tiled, IO-aware Flash Attention kernel with online softmax and causal masking.
Every source step is its own lesson with intuition, concepts, correctly rendered MathJax mathematics, implementation, tests, mistakes, and a checkpoint.
Implement basic elementwise and reduction kernels that form the building blocks for matrix and attention operations.
Build the matmul, transpose, and dot-product utilities needed for attention scoring.
Compose QK^T scoring, row-wise softmax, and PV multiplication into a straightforward attention pipeline.
Implement the running-max and running-sum updates that allow softmax to be computed incrementally across tiles.
Write the per-tile shared-memory routines for loading, scoring, reducing, exponentiating, and accumulating PV.
Assemble the tiled blocks into the full Flash Attention kernel and its host launcher.
Extend the kernel with a causal mask for autoregressive attention.