Archived
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:
1 parent
2bf1096131
commit
613bbaacfd
5 files changed
+63
-23
No files matched your search
+11
-1
@@ -156,6 +156,16 @@ KVStreamRing kvstream_ring_shape(const Config& cfg, int64_t ctx, int64_t block_s
|
||||
const int64_t bs = block_size > 0 ? block_size : 1;
|
||||
out.ctx_blocks = kv_context_blocks(bs, ctx, cfg.max_seqs);
|
||||
out.ring_blocks = cfg.kv_resident > 0 ? (cfg.kv_resident + bs - 1) / bs : 0;
|
||||
/* The shipped floor, unless the context is smaller than it (a model that cannot hold 32 768
|
||||
* tokens of this group streams nothing at all, which is the pre-existing behaviour). */
|
||||
if (out.ring_blocks > 0) {
|
||||
out.floor_blocks = (kStreamFloorTokens + bs - 1) / bs;
|
||||
if (out.floor_blocks > out.ctx_blocks) out.floor_blocks = out.ctx_blocks;
|
||||
if (out.ring_blocks < out.floor_blocks) {
|
||||
out.ring_blocks = out.floor_blocks;
|
||||
out.raised_blocks = out.floor_blocks;
|
||||
}
|
||||
}
|
||||
if (out.ring_blocks > out.ctx_blocks) out.ring_blocks = out.ctx_blocks;
|
||||
return out;
|
||||
}
|
||||
@@ -178,7 +188,7 @@ void kvstream_ring(const Config& cfg, int64_t ctx, int64_t block_size, int64_t s
|
||||
const int64_t ceiling = kvstream_ceiling_blocks(cfg, sel_pitch);
|
||||
if (out->ring_blocks < ceiling) {
|
||||
out->ring_blocks = ceiling < out->ctx_blocks ? ceiling : out->ctx_blocks;
|
||||
out->raised_blocks = ceiling;
|
||||
out->raised_blocks = out->ring_blocks;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user