kvstream: the ring is never carved below the shipped floor of 32 768 tokens

The raise enforced only the validation union -- the largest block union one
decode launch selects, max_seqs x (1 + n_spec) x sel_pitch -- which on the
reference model is 1026 blocks = 4104 tokens. That is the depth below which a
step cannot be served at all, not the depth below which streaming pays: the
measured curve puts the cost point at 24 576 and the shipped value at 32 768
(docs/KV-STREAMING.md 3.9). --kv-resident 1 therefore carved a 4 104-token
ring, and one 7 800-token request took 7 213 misses over 8 decoded tokens.

kStreamFloorTokens (32 768) is now a floor the carve enforces:

  * kvstream_ring_shape raises any ring under it, then kvstream_ring raises
    that to the union when the union is larger; both are clamped to the
    group's context, so a context under 32 768 tokens streams nothing (the
    ring covers it and the group keeps the base engine's path);
  * RadBuildCtx::kv_resident_blocks carries the raised number into the
    declare, because kv_resolve sizes its residency table from it -- a carve
    deeper than the declared table is refused by the kernel;
  * the startup warning says which bound applied, and KVStreamRing::floor_blocks
    keeps the two distinct.

The flag is still the operator's: --kv-resident 65536 stays 65536, and a
context that fits is untouched apart from the 32 768 floor.
This commit is contained in:
C_Tamas committed 2026-10-25 09:29:17 +07:00
1 parent 2bf1096131
commit 613bbaacfd
5 files changed
+63 -23

No files matched your search

+5 -4
View File
@@ -90,10 +90,11 @@ static const Flag g_flags[] = {
" the card. At or above the group's context (sequences x\n"
" --max-model-len) nothing streams either: the group stays a\n"
" plain resident pool and the engine takes its ordinary path,\n"
" with no mirror, no stage and no resolve. Below it, the rest\n"
" of each block lives in pinned host memory and the ring must\n"
" hold one decode step's whole selection; a smaller ring is\n"
" raised to that many blocks at startup, with a warning" },
" with no mirror, no stage and no resolve. Under 32768 the\n"
" ring is raised to it (and to one decode step's selection\n"
" when that is larger); below it a decode pays more in misses\n"
" than the ring saves. A context under 32768 tokens streams\n"
" nothing at all" },
{ "--host-pool-mib", "N", "pinned host tier" },
{ "--host-headroom-mib", "N", "host RAM to leave free for the system when radiance\n"
" pins its host memory at startup (default 4096)" },