Archived
radiance 1.12.0
New models: - Fish Audio drama-3: speech with speaker tags and inline direction, voices cloned from reference clips (the `references` field of /v1/audio/speech and the streaming session), two cards - Gemma 4 E2B/E4B (KV-shared layers, per-layer embeddings, clipped vision linears), with NVIDIA-Nemotron-3.5-Bolt-E4B in bf16 with DFlash and vision on one card, and E4B recipes Speed: - MXFP4 GEMMs for one to 64 rows and a tiled prefill GEMM at TN=4 from 1024 rows: the 27B MXFP4 with DFlash2 decodes about 1% faster at c1, 5% at c4 and 14% at c16 - The fp8 and int8 LM heads read their weight once for 65 to 128 rows - A prefill step of one sequence runs in two pieces on a second lane at two ranks (qwen35_fp8, gemma3): a 45K-token prompt on the 27B fp8 in 15.1 s instead of 16.2 s - Gemma 3's fused all-reduce junctions also under a lossy wire - --draft-short-from N: a block drafter runs its shorter block from N decoding sequences on (off by default; with 8 on the 27B MXFP4: c8 +12%, c16 +18%, c64 +32%, c1 unchanged) - --tp-attn-split rows: GLM-5.3-Flash's MLA attention split by rows over the ranks, 18 to 21% faster prefill; lossy, `heads` stays the default - --draft-coupling on: Qwen3.8-Flash-Next's MTP drafter samples its proposals from its reranked top-8 and the target's draw is coupled to it; pays at high temperatures (c1 at T 1.0: 155 -> 178 tok/s), costs at low ones; off by default Features: - Edited prompts on windowed models (Gemma 4) reuse their prefix: periodic window snapshots, and snapshot-backed prefix KV kept across recomputes (an edited tail on Gemma 4 31B: 96 s -> 2.6 s) - DELETE /sessions/<label> and DELETE /sessions?id=<id> forget one stored conversation - --state-cache-dtype f16: the delta-net state cache at half the memory (qwen35 plugins; lossy) Fixes: - A browser's CORS preflight allows DELETE Changes: Plugin ABI 27: out-of-tree plugins must be rebuilt. The environment switches the PRs added are flags now (--tp-attn-split, --draft-coupling, --state-cache-dtype).
This commit is contained in:
10 parents
4bca30369b
b1f4fccc52
d90e19dc15
3aded1bbf8
d912c694f3
824e238996
58142a6638
9322ea0b92
e9d03362f0
4d68a01a08
commit
5a9ce4912b
137 files changed
+12959
-1126
No files matched your search
@@ -202,6 +202,7 @@ int Scheduler::init(Program& prog, const Config& cfg, IKVManager* kv, IPrefixCac
|
||||
free_cards_[(size_t)c] = (int32_t)(cfg.max_seqs - 1 - c); /* 0 is taken first */
|
||||
reqs_.reserve((size_t)cfg.max_seqs);
|
||||
completed_.reserve((size_t)cfg.max_seqs);
|
||||
committed_.reserve((size_t)cfg.max_seqs);
|
||||
by_id_.reserve((size_t)cfg.max_seqs * 2);
|
||||
hit_blocks_.resize(prog.kv_groups.size());
|
||||
for (auto& v : hit_blocks_) v.reserve(64);
|
||||
@@ -325,6 +326,25 @@ Request* Scheduler::find(uint64_t id) {
|
||||
return it == by_id_.end() ? nullptr : reqs_[(size_t)it->second]->req.get();
|
||||
}
|
||||
|
||||
bool Scheduler::running(uint64_t id) const {
|
||||
std::lock_guard<std::mutex> lk(mu_);
|
||||
auto it = by_id_.find(id);
|
||||
if (it == by_id_.end()) return false;
|
||||
const SchedReq& s = *reqs_[(size_t)it->second];
|
||||
return s.req && s.req->state == ReqState::Running;
|
||||
}
|
||||
|
||||
bool Scheduler::committed_seq(uint64_t seq, uint64_t* n_out, bool* live) const {
|
||||
std::lock_guard<std::mutex> lk(mu_);
|
||||
for (const CommittedSeq& c : committed_)
|
||||
if (c.seq == seq) {
|
||||
if (n_out) *n_out = c.n_out;
|
||||
if (live) *live = c.live;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int Scheduler::set_draft(uint64_t id, const int32_t* tokens, int n) {
|
||||
std::lock_guard<std::mutex> lk(mu_);
|
||||
auto it = by_id_.find(id);
|
||||
@@ -403,6 +423,40 @@ int64_t Scheduler::reset_prefix_cache() {
|
||||
return dropped;
|
||||
}
|
||||
|
||||
int Scheduler::release_session(const std::string& label, uint64_t id, int64_t keep_tokens,
|
||||
SessionRelease* out) {
|
||||
std::lock_guard<std::mutex> lk(mu_);
|
||||
if (!pc_ || !cfg_.prefix_cache) return RAD_E_UNSUPPORTED;
|
||||
if (label.empty() && id == 0) return RAD_E_INVAL;
|
||||
for (const auto& p : reqs_) {
|
||||
if (!p || !p->req) continue;
|
||||
const Request& r = *p->req;
|
||||
if (r.state == ReqState::Finished || r.state == ReqState::Failed ||
|
||||
r.state == ReqState::Cancelled)
|
||||
continue;
|
||||
if ((id != 0 && r.id == id) || (!label.empty() && r.session_label == label))
|
||||
return RAD_E_STATE;
|
||||
}
|
||||
const int rc = pc_->release_session(label, id, keep_tokens, out);
|
||||
if (rc == RAD_OK && out) {
|
||||
if (label.empty())
|
||||
RAD_INFO("prefix cache: session %llu released: %lld entries (%lld tokens), %lld "
|
||||
"snapshots; kept %lld tokens as asked, %lld blocks shared, %lld live",
|
||||
(unsigned long long)id, (long long)out->entries, (long long)out->tokens,
|
||||
(long long)out->snapshots, (long long)out->kept_tokens,
|
||||
(long long)out->kept_shared, (long long)out->kept_live);
|
||||
else
|
||||
RAD_INFO("prefix cache: session '%s' released (%lld rows): %lld entries (%lld "
|
||||
"tokens), %lld snapshots; kept %lld tokens as asked, %lld blocks shared, "
|
||||
"%lld live",
|
||||
label.c_str(), (long long)out->sessions, (long long)out->entries,
|
||||
(long long)out->tokens, (long long)out->snapshots,
|
||||
(long long)out->kept_tokens, (long long)out->kept_shared,
|
||||
(long long)out->kept_live);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
void Scheduler::trim_prefix_cache() {
|
||||
if (!pc_ || !cfg_.prefix_cache) return;
|
||||
const std::vector<int32_t>& cg = pc_->cached_groups();
|
||||
@@ -751,7 +805,7 @@ int64_t Scheduler::plan_chunk(int64_t n_computed, int64_t n_target, int64_t budg
|
||||
if (geo_.checkpoints()) {
|
||||
const int64_t I = geo_.checkpoint_interval;
|
||||
int64_t next = ((n_computed / I) + 1) * I; /* strictly after n_computed */
|
||||
if (geo_.window_ckpt && cfg_.checkpoint_policy == "tip-only") {
|
||||
if (geo_.window_ckpt && !geo_.window_periodic) {
|
||||
/* An explicit tail-only policy should not pay for intermediate
|
||||
* window copies or chunk splits just to retire those snapshots. */
|
||||
next = INT64_MAX;
|
||||
@@ -1882,6 +1936,10 @@ int Scheduler::commit(const StepResult& res) {
|
||||
}
|
||||
step_open_ = false;
|
||||
|
||||
/* What the serial bind reads after commit, copied here while the Requests are still held:
|
||||
* reap() may release a finished one before finish_serial_drafter runs. */
|
||||
committed_.clear();
|
||||
|
||||
const int32_t W = conv_window();
|
||||
|
||||
/* A mixed step leaves decode rows the same replay factors as a decode step (recurrent path
|
||||
@@ -1904,6 +1962,7 @@ int Scheduler::commit(const StepResult& res) {
|
||||
s.pending_free = false;
|
||||
--n_deferred_;
|
||||
}
|
||||
committed_.push_back({e.seq, (uint64_t)r.output.size(), false});
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2060,6 +2119,7 @@ int Scheduler::commit(const StepResult& res) {
|
||||
} else if (eos) {
|
||||
close_request(s, ReqState::Finished, "stop", carried);
|
||||
}
|
||||
committed_.push_back({e.seq, (uint64_t)r.output.size(), r.state == ReqState::Running});
|
||||
}
|
||||
|
||||
m_.prefill_tokens += step_prefill_tok_;
|
||||
@@ -2386,8 +2446,12 @@ void Scheduler::serial_end(int rounds_done) {
|
||||
* also propose. Called while plan() still describes that step, because the context pass mirrors
|
||||
* it exactly, rejected suffix included: the drafter reads hidden states positionally from its
|
||||
* own buffer, so batch row i must be buffer row i. The rejected positions lie in [n_computed,
|
||||
* n_computed + block), which the query pass overwrites before anything reads them, and the
|
||||
* ensure() below covers them since n_computed + block reaches the trunk step's own end.
|
||||
* n_computed + the trunk step's block), which a query pass overwrites before anything reads them.
|
||||
* The ensure() below covers n_computed + `block`; with the block the trunk step verified that
|
||||
* reaches its end. A short block (rad_drafter_short_block) after a long one does not: rejected
|
||||
* rows past it fall on pages the commit's rollback freed, whose slot is -1, and every kv_store
|
||||
* drops a negative slot. That rule is what keeps such a step from writing into another
|
||||
* sequence's pages.
|
||||
*
|
||||
* On the card the step has not committed yet. The step began at n_computed (a row issued ahead
|
||||
* was staged at its furthest reach; it really continued from the committed end, as commit()
|
||||
@@ -2503,6 +2567,17 @@ int Scheduler::block_begin(int block, int depth, int window, int32_t mask, Block
|
||||
return n_draft_rows;
|
||||
}
|
||||
|
||||
int Scheduler::decoded_seqs() const {
|
||||
std::lock_guard<std::mutex> lk(mu_);
|
||||
int n = 0;
|
||||
for (const StepEntry& e : plan_.e) {
|
||||
if (!e.produces_token || e.slot < 0 || (size_t)e.slot >= reqs_.size()) continue;
|
||||
const SchedReq& s = *reqs_[(size_t)e.slot];
|
||||
if (s.req && s.req->state == ReqState::Running && s.running) ++n;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
const Request* Scheduler::block_req(const BlockSeq& d) const { return live_req(d.slot, d.seq); }
|
||||
const Request* Scheduler::serial_req(const SerialSeq& m) const { return live_req(m.slot, m.seq); }
|
||||
|
||||
@@ -2712,6 +2787,8 @@ SchedMetrics Scheduler::metrics_locked() const {
|
||||
m.prefix_ckpt_refused = cc.refused;
|
||||
m.prefix_expired = pc_->expired();
|
||||
m.prefix_ckpt_expired = pc_->ckpt_expired();
|
||||
m.prefix_released = pc_->released();
|
||||
m.prefix_ckpt_released = pc_->ckpt_released();
|
||||
m.prefix_held_tokens = pc_->held_tokens(); }
|
||||
m.attn_hit_rate = m.prompt_tokens
|
||||
? (float)((double)m.attn_cached_tokens / (double)m.prompt_tokens) : 0.0f;
|
||||
|
||||
Reference in new issue
Block a user