TPU Pallas kernel learning lab. Three exercises, increasing difficulty.
kernels/
01_matmul/ — GridSpec, BlockSpec, tiling basics
02_softmax/ — Scratchpad memory, online algorithm
03_flash_attention/ — Fused attention, IO/compute overlap
utils/
benchmark.py — Timing + roofline analysis
notes/ — Personal observations per exercise
conda activate nebula
source ~/tpu_env.shkernels/01_matmul/naive.py— get a kernel running, understand the APIkernels/01_matmul/tiled.py— sweep block sizes, see MXU utilizationkernels/02_softmax/online.py— scratchpad, online softmax algorithmkernels/03_flash_attention/forward.py— fused attention, the real deal
cd kernels/01_matmul
python naive.py