Files
Xiaoze Fan 27740fec66 feat(kvcache): add fp8 and int8 per-token-head KV cache formats (#894)
* feat(kvcache): add fp8 and int8 per-token-head KV cache formats

* fix(kernel): keep the bf16 m3 sparse k/v loads inline

* fix(attention): refuse a backend that cannot read the kv format

- filter the m3 page-size fallback by kv format
- release the scale buffer when a qsa or bsa rebuild fails
- keep the bf16 qsa and m3 attend code identical to main
- drop docstrings that claimed no register spills
- drop guard tests

* fix(kernel): widen dsa latent row offsets past int32

* feat(spec): store the mtp draft kv in the target's format
2026-11-11 15:47:50 -08:00
..
2026-08-11 22:53:25 +00:00

benchmarks

Run from the repo root with PYTHONPATH=python:., pinned to one GPU (CUDA_VISIBLE_DEVICES=0). Each script's --help / docstring has the details.

bench_decode_moe.py — bs=1 decode tok/s of a served MoE model. Spawns ft serve per backend and times token arrivals over streamed /v1/chat/completions, so numbers include the full serving path. AIME-25 prompt, checkpoint-recommended sampling.

python benchmarks/bench_decode_moe.py --model /path/to/model --backend offload,cpu,hybrid

bench_load_weight_generic.py — expert-bank load time: serial vs parallel O_DIRECT vs pre-repacked FTW, each mode in its own subprocess. Linux-only; stages the FTW under /var/tmp (--ftw-dir overrides; roughly checkpoint-sized).

python benchmarks/bench_load_weight_generic.py --model /path/to/model

bench_offload_cache_copy.py — synthetic (no checkpoint): per-layer decode expert copy cost (ensure_experts + copy_missing), swept over bank layout x cache slots x batch size x miss rate.

python benchmarks/bench_offload_cache_copy.py

For host RAM vs PCIe bandwidth and the offload/hybrid backend pick, use ft bench bw instead — it writes the JSON profile the engine reads.