Documentation
¶
Overview ¶
Dattnbench writes the CUDA sources and launch plans for the lane 71 decode attention table: the generated cudalower.DecodeAttention kernel, its parity mutant and timing control, and the hand-written ServeAttention kernels of examples/llama-infer/serve.cu, each behind extern "C" entry points a benchmark loads from a shared library.
Usage:
dattnbench -serve examples/llama-infer/serve.cu -out dir
It writes gen.cu, gen_mut.cu, gen_spin.cu, gen_tail.cu, hw.cu and plans.json to dir. Build each source with nvcc -shared -Xcompiler -fPIC.
The shape is Llama-3.2-1B attention: 32 query heads over 8 KV heads of 64, BF16, 16-token pages. gen_mut.cu scales head 0's output by 1.01 on both output paths, so a parity gate must reject it at every cell. gen_spin.cu makes every block with keys wait -spin-ns on %globaltimer before its first load; in a bandwidth-bound kernel the other resident blocks hide part of that wait. gen_tail.cu leaves the kernel body as it is and has the last block to finish wait -spin-ns, so the kernel must take spin-ns longer at every cell.