cuda: keep paged ragged KV resident across decode steps#372
Conversation
|
Two things before this can land, both mechanical now that #365 is in:
Once it's rebased and someone posts the token-identity result from a GPU, it merges β the pattern's working well (author writes it, a second GPU owner verifies it, I check CPU-safety and land it). Ping when both are done. |
cdbe1a4 to
6d3a616
Compare
|
Rebased onto current Revalidated post-rebase on a real RTX 5090 (sm_120): The updated test is multi-step: it first warms each keyed resident sequence at length 1, then reuses the same device slots with ragged lengths 1/2/3 and compares against the non-resident per-row batch path. RMS is exactly zero, covering the stale-slot/aliasing failure mode called out in review. Local CPU test compilation also passes. |
|
Merged. You closed both gates exactly as asked: clean rebase (only the resident-KV delta left after Git skipped the upstream #365 commits), and the multi-step revalidation on sm_120 with |
|
On-silicon gate for the resident-KV path β RTX 5080 / sm_120 (the #306 box), CUDA 12.8, built from the rebased head (6d3a616). 1.
|
| path | output (16 tokens) |
|---|---|
GPU resident (COLI_CUDA=1 COLI_GPU=0 CUDA_DENSE=1 CUDA_EXPERT_GB=4) |
2, 3, 5, 7, 11, 13 |
CPU reference (--gpu none) |
2, 3, 5, 7, 11, 13 |
Token-identical across 16 decode steps. The KV being reused across steps is exactly where a stale-slot/aliasing bug would show up as drift after a few tokens β it stays coherent and matches the non-resident path end to end. (0.73 tok/s GPU / 0.67 tok/s CPU, expert hit 79% / 71%.)
So: green test + token-identical multi-step decode on real sm_120. Tested by @mohamedmastouri2000-boop. Happy to run a longer decode or a different prompt if you want more coverage before it lands.
Summary
SERVE_BATCHslots while preserving the existing 16-slot limit for regular serve modeThis is stacked on #365; only commit
cdbe1a4is new here. Rebase ontodevafter #365 merges.Validation
make -C c glmmake -C c glm CC=x86_64-w64-mingw32-gcc CUDA_DLL=1ragged_relative_rms=0S=128, 176.59 GB resident expert tier: steady ragged Attention remained about 2.17-2.26 s at 64-token contextThe short-context benchmark is intentionally reported as neutral: this change removes repeated full-prefix KV transfers and their
O(S*T)host packing, but at 64 tokens the attention kernel itself dominates. The expected benefit is transfer scaling at longer contexts, not a claimed short-context token/s gain.