Archived
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:
1 parent
6fd7421f79
commit
33778b2b8c
10 files changed
+242
-11
No files matched your search
@@ -395,6 +395,27 @@ int64_t KVManager::paged_split(int64_t budget_bytes, std::vector<int64_t>* block
|
||||
return tokens;
|
||||
}
|
||||
|
||||
int64_t KVManager::pool_mib_for_tokens(int64_t tokens, int64_t max_mib) const {
|
||||
const int64_t MiB = (int64_t)1 << 20;
|
||||
if (max_mib <= 0) return -1;
|
||||
const auto reaches = [&](int64_t mib) {
|
||||
/* The fixed costs (recurrent state, its alignment) come first on every rank -- a rank
|
||||
* whose only paged group is zero still has to hold them. */
|
||||
if (mib * MiB < fixed_) return false;
|
||||
const int64_t t = paged_split(mib * MiB, nullptr);
|
||||
return t == kUnboundedTokens || t >= tokens;
|
||||
};
|
||||
if (!reaches(max_mib)) return -1;
|
||||
/* reaches(hi) holds throughout; lo is the largest size known to fall short (or 0). */
|
||||
int64_t lo = 0, hi = max_mib;
|
||||
if (reaches(lo)) return 0;
|
||||
while (hi - lo > 1) {
|
||||
const int64_t mid = lo + (hi - lo) / 2;
|
||||
if (reaches(mid)) hi = mid; else lo = mid;
|
||||
}
|
||||
return hi;
|
||||
}
|
||||
|
||||
int64_t KVManager::zero_blocks(const KVGroupPlan& p, int64_t tokens) const {
|
||||
if (tokens == kUnboundedTokens) return 0;
|
||||
const int64_t b = tokens / p.block_size;
|
||||
|
||||
Reference in new issue
Block a user