budget: an uneven world's cheaper rank pages the common tokens and keeps its experts

The resolver derives one split, the dearest rank's, for every card, and one
block table serves every rank. An attention-zero rank keeps no attention cache:
at TP3 on Flash-Next it pages the common 1.45M tokens in ~1.8 GiB of its
10.6 GiB KV pool, the rest is an address reservation nothing ever commits or
lends, and 1091 of its experts can never reach the card even with the cache
idle.

Such a rank now gets a KV pool that pages exactly the common token count (the
new KVManager::pool_mib_for_tokens, the inverse of paged_tokens, plus a 64 MiB
margin) and the difference in its weights pool, no further than every weight
resident. The per-rank split reaches BOTH readers of the resolved sizes --
Pools::configure and the planner -- so the grown pool is planned into. The
token count, the carve, the loan and the dearest ranks' pools are unchanged;
configure_kv names it if a re-sized pool ever binds.

Only a derived split under expert_tiered is re-split: a stated pool is the
operator's, and under auto a fully resident rank would choose all_vram while
its peers spill. Where every rank's cache costs the same -- every world the
heads divide -- no rank qualifies and every rank takes cfg_ as before.
This commit is contained in:
baKon authored and StillDeadcode committed 2026-10-07 11:09:36 +02:00
1 parent 6fd7421f79
commit 33778b2b8c
10 files changed
+242 -11

No files matched your search

+7
View File
@@ -93,6 +93,13 @@ private:
std::vector<std::thread> rank_threads_;
Config cfg_;
/* THE SPLIT EACH RANK ACTUALLY TAKES. Equal to cfg_ on every rank of an even world; under an
* uneven one (an attention-zero rank) a rank whose cache costs less per token gets a KV pool
* sized for the common token count and the difference in its weights pool. Engine::plan fills
* it, and every reader of the resolved pool sizes -- Pools::configure and the planner -- takes
* its rank's entry, never cfg_: a grown pool the planner never reads is an empty pool. */
std::vector<Config> rank_cfg_;
int64_t kv_planned_tokens_ = 0; /* the common token count plan() sized the re-split pools for */
/* The model's source, one of the two. A container stays mapped for the life of the engine:
* the mapped and file tiers read it where it lies (spec §4.2). A checkpoint served directly