Tracking issue for KV cache quantization. Related: #79, #280, #354, #853. ## KV quant format A KV quant format is defined once and has one name (the `--kv-cache-dtype` value). The name decides three things: 1. **Storage**: how a K / V row is laid out in the KV pool (element dtype, scale dtype, channels per scale), and so the pool's size per token. 2. **Quant + store kernel**: quantizes new K / V rows and writes them to the pool in that layout. 3. **Attention kernels**: read the format back. Each attention backend declares the formats it can read. ## Plan - [x] Define the format (`KVFormat`) and add `fp8_per_token_head` / `int8_per_token_head` (8-bit codes, one fp32 scale per token and KV head) for `triton`, `qsa_sparse`, `m3_sparse` and `dsa`: #894 - [x] Packed fp8 KV reads on gfx1201 for single-row decode (bf16 query, head_dim 128, GQA 4 / 8, batch 1): #897 - [ ] fp8 KV decode and prefill on RDNA3 (gfx11): #899 ## Open problems - [x] Perf: speculative decoding with an 8-bit cache. On `triton` the verify step (`k + 1` query tokens per request) ran the prefill kernel, which does not split the KV: Qwen3.6-35B-A3B bs1 with `mtp` and fp8 decoded at 66.0 / 19.9 tok/s at 32K / 128K, against 146.5 / 137.1 without speculative decoding. Fixed in #900, where the triton decode kernel takes up to 8 query rows per request (ROCm shared-memory fix in #906): the same setup decodes at 253.5 / 252.6 tok/s. - [ ] Perf: DSA decode with an 8-bit cache takes about 2x the bf16 time.
Activity
[-][WIP] KV cache quantization (tracking)[/-][+][WIP, RoadMap] KV cache quantization (tracking)[/+][-][WIP, RoadMap] KV cache quantization (tracking)[/-][+][WIP, Roadmap] KV cache quantization (tracking)[/+]