Archived
radiance 2.1.0
New models. Recursive Flint (39.8B, about 2.5B active) by everplays (#422): `arch/flint`, as an IQ8R container with rotated int8 experts or a four-bit one, with a sink-aware WMMA prefill attention and the fused attention prologue at `rotary_dim` 0. Meta Muse Glimmer 30B by launch80_assets (#423): bf16, an int4 trunk or IQ8R, its windowed vision tower, its DFlash drafter, the ATEM tool dialect and context extension. Ling-3.0-tiny by RikshaDriver (#441): served from its GGUF releases or as IQ8R on `bailing_hybrid`, with six more libr3d kernels. Block FP8, MXFP4 and NVFP4 conversions of the three are not served. IQ8R containers of all three (round to nearest, no calibration) are on Hugging Face under StillDeadcode: flint-iq8r, muse-glimmer-30b-iq8r-dflash and ling-3.0-tiny-iq8r. They were checked for sane answers on two R9700; nothing was benchmarked, and Muse Glimmer's pictures, video and tool calls were not tried. Speech. Breeze-TTS-2 clones a voice from a reference recording and its transcript, with an optional delivery direction, by farcryjohn (#436). The published Breeze container needs converting again with the updated recipe before it can. Tools. A model entry with `diagnose: DIR` runs a fixed workload on the engine instead of serving and writes a report: step times, tokens a step, draft acceptance, TTFT and prefill rates by category, concurrency and prompt length, and with `diagnose-baseline` a token-for-token comparison against an earlier report (docs/DIAGNOSE.md), by Code000 (#418). Scheduler. `mixed-step-target-ms` holds a mixed prefill and decode step to a service time, off by default, by tnhnyzc (#413). `scheduler.stuck-exit` (60s by default, 0 never) ends the process when the device has advanced nothing for that long, so a restart policy brings a hung server back (#409, #415, #428). Fixed. Draft trees with the int8 KV cache, which stopped Gemma 4 31B with DFlash2 on its first request (#454, diagnosed by aelfwyne). The expert loan held at zero by a few leftover cache blocks after long sessions (#455, diagnosed by thekk1). The mapped tier's pages kept in the page cache across a load and a restore, by C_Tamas (#421). Replayed tool calls with blank arguments, and arguments that are not JSON refused naming the call, by dschmitz (#444). The dashboard's card temperature reads the junction sensor, by dschmitz (#453). The VRAM shortfall report says what the KL mode needs, by baKon (#448). The out-of-tree plugin test builds its plugins in parallel and takes its toolchain from the tree. Plugin ABI 40: out-of-tree plugins need to be rebuilt. Thanks to @everplays, @launch80_assets, @RikshaDriver, @farcryjohn, @Code000, @tnhnyzc, @C_Tamas, @dschmitz, @baKon, @aelfwyne and @thekk1.
This commit is contained in:
1 parent
ddcb9c69bb
commit
2a2b756371
166 files changed
+20749
-327
No files matched your search
@@ -822,6 +822,22 @@ int64_t KVManager::total_blocks(int32_t g) const {
|
||||
int64_t KVManager::live_blocks(int32_t g) const {
|
||||
return (g >= 0 && g < (int32_t)live_.size()) ? live_[(size_t)g] : 0;
|
||||
}
|
||||
int64_t KVManager::live_blocks_at(int32_t g, int64_t tokens) const {
|
||||
if (g < 0 || g >= (int32_t)plans_.size()) return 0;
|
||||
return plans_[(size_t)g].n_blocks - lent_blocks((size_t)g, tokens);
|
||||
}
|
||||
int64_t KVManager::straggler_mark(int32_t g) const {
|
||||
if (g < 0 || g >= (int32_t)plans_.size()) return 0;
|
||||
const int64_t top = held_top((size_t)g), per = bucket_blocks_[(size_t)g];
|
||||
const auto& h = held_hist_[(size_t)g];
|
||||
int64_t mark = top, best = 0, held = 0;
|
||||
for (int64_t b = (top + per - 1) / per; b-- > 0;) {
|
||||
held += h[(size_t)b];
|
||||
const int64_t gain = top - b * per - kStragglerCost * held;
|
||||
if (gain > best) { best = gain; mark = b * per; }
|
||||
}
|
||||
return mark;
|
||||
}
|
||||
int64_t KVManager::held_top_blocks(int32_t g) const {
|
||||
return (g >= 0 && g < (int32_t)plans_.size()) ? held_top((size_t)g) : 0;
|
||||
}
|
||||
|
||||
@@ -508,6 +508,18 @@ public:
|
||||
|
||||
/* Blocks of a group the cache may hand out: the carve less the loan. */
|
||||
int64_t live_blocks(int32_t group) const;
|
||||
/* The same under a loan of `tokens`: the first block of the group that loan would take. A
|
||||
* group that does not lend answers its whole carve. */
|
||||
int64_t live_blocks_at(int32_t group, int64_t tokens) const;
|
||||
/* Where a group's stragglers start. A loan reaches down only to the highest held block, so a
|
||||
* few held blocks high in the pool keep everything between them and the dense part of the
|
||||
* cache from the expert slab. Giving up the held blocks at or above a mark m extends what
|
||||
* can be lent by (held top - m) blocks at the cost of the blocks held there; the mark is the
|
||||
* m that gains the most over kStragglerCost times that cost, to a bucket of held_hist_. The
|
||||
* held top itself when no m gains anything: a pool held densely up to its top has no
|
||||
* stragglers, and the edge of a dense part is never one. Rank 0 only. */
|
||||
int64_t straggler_mark(int32_t group) const;
|
||||
static constexpr int64_t kStragglerCost = 16;
|
||||
|
||||
/* ---------------- flex (docs/MULTIMODEL.md §6) ----------------
|
||||
*
|
||||
|
||||
+13
-2
@@ -356,8 +356,10 @@ void IdleTiers::plan_writeback(int64_t max_entries, std::vector<TierJob>* out) {
|
||||
RAD_WARN("kv tiers: %lld entries (%lld tokens of context) got no host copy: the host "
|
||||
"tier (--prefix-cache-mib, %s, %lld tokens) is full of context used more "
|
||||
"recently or nearer the start of its conversation. They stay in VRAM only and "
|
||||
"are prefilled again once VRAM gives them up; a larger --prefix-cache-mib holds "
|
||||
"more. Counted in /sessions moved.held_back",
|
||||
"are prefilled again once VRAM gives them up, which it does for a request that "
|
||||
"needs the room, or where a few of them keep the expert loan from most of the "
|
||||
"pool; a larger --prefix-cache-mib holds more. "
|
||||
"Counted in /sessions moved.held_back",
|
||||
(long long)held, (long long)(held * cfg_.block_tokens),
|
||||
humanb(arena_.cap_bytes()).c_str(),
|
||||
(long long)(arena_.capacity() * cfg_.block_tokens));
|
||||
@@ -375,6 +377,15 @@ void IdleTiers::take_clean(std::vector<BlockHash>* out) {
|
||||
clean_q_.clear();
|
||||
}
|
||||
|
||||
bool IdleTiers::no_copy_coming(const BlockHash& key) const {
|
||||
std::lock_guard lk(mu_);
|
||||
auto it = recs_.find(key);
|
||||
if (it == recs_.end()) return false;
|
||||
const Rec& r = it->second;
|
||||
if (r.pending || r.doomed || r.tier != KVTier::Device || r.host_slot >= 0) return false;
|
||||
return !r.queued || (wb_stuck_ && arena_.full());
|
||||
}
|
||||
|
||||
bool IdleTiers::droppable(const BlockHash& key) const {
|
||||
std::lock_guard lk(mu_);
|
||||
auto it = recs_.find(key);
|
||||
|
||||
@@ -156,6 +156,10 @@ public:
|
||||
void take_clean(std::vector<BlockHash>* out);
|
||||
/* Host copy landed and no job out: the blocks can leave VRAM at no cost. */
|
||||
bool droppable(const BlockHash& key) const;
|
||||
/* In VRAM only with no host copy coming: none made or on its way, and either none asked for
|
||||
* (a full arena refused it, Stats::held_back) or the queue it waits in has stopped because
|
||||
* the arena is full of entries worth more. */
|
||||
bool no_copy_coming(const BlockHash& key) const;
|
||||
/* The cache released the blocks; the record becomes a host record on the host list. Its
|
||||
* snapshot stays in its store slot. */
|
||||
void drop_commit(const BlockHash& key);
|
||||
|
||||
+50
-2
@@ -796,12 +796,13 @@ int64_t PrefixCache::trim_sparing(int64_t n_entries,
|
||||
return done;
|
||||
}
|
||||
|
||||
int64_t PrefixCache::drop_clean() {
|
||||
int64_t PrefixCache::drop_clean(int64_t loan_goal) {
|
||||
if (!tiers_ || !kv_) return 0;
|
||||
drop_scratch_.clear();
|
||||
tiers_->take_clean(&drop_scratch_);
|
||||
const uint64_t frees = kv_->seq_frees();
|
||||
if (frees != frees_seen_ || released_) {
|
||||
const bool recheck = frees != frees_seen_ || released_;
|
||||
if (recheck) {
|
||||
frees_seen_ = frees;
|
||||
released_ = false;
|
||||
for (const BlockHash& h : drop_wait_) {
|
||||
@@ -830,6 +831,53 @@ int64_t PrefixCache::drop_clean() {
|
||||
tiers_->drop_commit(h);
|
||||
++n;
|
||||
}
|
||||
return n + drop_stragglers(loan_goal, recheck);
|
||||
}
|
||||
|
||||
/* drop_clean's second half: resident entries with no host copy coming that are stragglers inside
|
||||
* a loan of `loan_goal` tokens. One walk of the resident list, taken only while something is held
|
||||
* above a group's mark, and then when a sequence has freed blocks (`recheck`) or the marks have
|
||||
* moved since the last walk, a second or more ago. */
|
||||
int64_t PrefixCache::drop_stragglers(int64_t loan_goal, bool recheck) {
|
||||
if (loan_goal <= 0 || !tiers_->host_on()) return 0;
|
||||
const size_t ng = entry_groups_.size();
|
||||
strag_mark_.assign(2 * ng, 0);
|
||||
bool any = false;
|
||||
for (size_t k = 0; k < ng; ++k) {
|
||||
const int32_t g = entry_groups_[k];
|
||||
const int64_t top = kv_->held_top_blocks(g);
|
||||
const int64_t mark = !kv_->lendable(g) ? INT64_MAX
|
||||
: std::max(kv_->straggler_mark(g), kv_->live_blocks_at(g, loan_goal));
|
||||
strag_mark_[k] = mark;
|
||||
strag_mark_[ng + k] = top;
|
||||
any = any || top > mark;
|
||||
}
|
||||
if (!any) return 0;
|
||||
const uint64_t now = rad_mono_ns();
|
||||
if (!recheck && (strag_mark_ == strag_seen_ || now - strag_ns_ < 1000000000ull)) return 0;
|
||||
strag_seen_ = strag_mark_;
|
||||
strag_ns_ = now;
|
||||
|
||||
int64_t n = 0;
|
||||
for (auto it = lru_.begin(); it != lru_.end();) {
|
||||
const BlockHash h = *it;
|
||||
auto m = map_.find(h);
|
||||
if (m == map_.end()) { ++it; continue; }
|
||||
Entry& e = m->second;
|
||||
bool above = false;
|
||||
for (size_t k = 0; k < ng && k < e.blocks.size(); ++k)
|
||||
above = above || e.blocks[k] >= strag_mark_[k];
|
||||
if (!above || held_.count(h) > 0 || shared_with_live(e) || !tiers_->no_copy_coming(h)) {
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
release_blocks(e);
|
||||
it = lru_.erase(it);
|
||||
tiers_->forget(h);
|
||||
map_.erase(m);
|
||||
++stats_.evictions;
|
||||
++n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
+16
-2
@@ -306,8 +306,17 @@ public:
|
||||
int64_t trim(int64_t n_entries);
|
||||
/* Give up every VRAM copy that costs nothing to drop: host copy landed and no running sequence
|
||||
* reading it. Used when the memory has a better use (the expert slab's loan). Entries still
|
||||
* shared are retried after a sequence frees blocks. Returns how many entries left VRAM. */
|
||||
int64_t drop_clean();
|
||||
* shared are retried after a sequence frees blocks. Returns how many entries left VRAM.
|
||||
*
|
||||
* `loan_goal` is the loan the slab is short of, in tokens (0: none). An entry with no host
|
||||
* copy coming (the host tier is full of context worth more) never becomes clean, and the
|
||||
* loan reaches down only to the highest held block: a few such entries high in the pool keep
|
||||
* the slab from everything below them for as long as the server runs. Where they are
|
||||
* stragglers (KVManager::straggler_mark: giving them up lends at least sixteen blocks for
|
||||
* each one lost) and stand inside `loan_goal`, they are forgotten, and their tokens are
|
||||
* prefilled again if their conversation returns. Context that fills its part of the pool
|
||||
* stays: there the cache is worth more than the loan it holds back. */
|
||||
int64_t drop_clean(int64_t loan_goal = 0);
|
||||
int64_t size() const { return (int64_t)map_.size(); }
|
||||
/* Entries holding blocks in the pool, as opposed to only a copy off the card. */
|
||||
int64_t resident() const { return (int64_t)lru_.size(); }
|
||||
@@ -544,6 +553,11 @@ private:
|
||||
* sequence-free count then. They are rechecked only once that count moves. */
|
||||
std::vector<BlockHash> drop_wait_;
|
||||
std::vector<BlockHash> drop_scratch_;
|
||||
/* drop_stragglers: the marks and held tops it last walked the list for, and when. It walks
|
||||
* again when a sequence frees blocks, or once they have moved and a second has passed. */
|
||||
std::vector<int64_t> strag_mark_, strag_seen_;
|
||||
uint64_t strag_ns_ = 0;
|
||||
int64_t drop_stragglers(int64_t loan_goal, bool recheck);
|
||||
uint64_t frees_seen_ = 0;
|
||||
/* hold(): keys per waiting request, and holders per key. A release also triggers a recheck
|
||||
* of drop_wait_. */
|
||||
|
||||
@@ -152,6 +152,14 @@ static int resolve(Config& cfg, const std::vector<VramFacts>& per_rank, VramBudg
|
||||
"or free the card.\n"
|
||||
: "Lower --gpu-headroom-mib, lower --max-num-batched-tokens (the arena scales with it), "
|
||||
"or free the card.\n";
|
||||
/* KL mode holds a whole-vocabulary row for every scored token and lends no pool back, so
|
||||
* its fixed cost sits far above a serve's at the same flags. Without naming the split, the
|
||||
* operator has no way to know which knob to turn. */
|
||||
const char* kld_hint = cfg.kld()
|
||||
? "KL mode holds a full-vocabulary logits row for every scored token and lends no pool "
|
||||
"back: pass --gpu-headroom-mib and --host-pool-mib explicitly, and lower "
|
||||
"--max-num-batched-tokens (the logits rows scale with it).\n"
|
||||
: "";
|
||||
b.report = fmt(
|
||||
"VRAM does not cover the fixed costs before a single pool is sized:\n"
|
||||
" card total %10s\n"
|
||||
@@ -169,6 +177,7 @@ static int resolve(Config& cfg, const std::vector<VramFacts>& per_rank, VramBudg
|
||||
humanb(b.headroom).c_str(), humanb(b.arena).c_str(), humanb(b.staging).c_str(),
|
||||
humanb(b.queues).c_str(), b.n_queues, humanb(b.queue_bytes).c_str(),
|
||||
humanb(b.prefetch).c_str(), humanb(-b.claimable).c_str(), how);
|
||||
if (*kld_hint) b.report += kld_hint;
|
||||
if (log) RAD_ERR("%s", b.report.c_str());
|
||||
if (out) *out = b;
|
||||
return RAD_E_NOMEM;
|
||||
|
||||
Reference in new issue
Block a user