sched: a bound on the preempted-prefill gate's wait

This commit is contained in:
baKon authored and StillDeadcode committed 2026-10-30 10:21:57 +01:00
1 parent 0792d86375
commit 33108e488b
16 files changed
+1522 -150

No files matched your search

+3
View File
@@ -122,6 +122,8 @@ inline SchedMetrics bridge_metrics(const rad::SchedMetrics& m) {
o.prefill_tokens = m.prefill_tokens; o.decode_tokens = m.decode_tokens;
o.draft_tokens = m.draft_tokens; o.draft_accepted = m.draft_accepted;
o.draft_refills = m.draft_refills; o.draft_refill_tokens = m.draft_refill_tokens;
o.lookup_proposals = m.lookup_proposals; o.lookup_held = m.lookup_held;
o.lookup_held_drafts = m.lookup_held_drafts; o.lookup_held_hits = m.lookup_held_hits;
o.linear_hit_rate = m.linear_hit_rate;
o.attn_cached_tokens = m.attn_cached_tokens;
o.linear_cached_tokens = m.linear_cached_tokens;
@@ -139,6 +141,7 @@ inline SchedMetrics bridge_metrics(const rad::SchedMetrics& m) {
d < std::size(m.draft_verify_depth) && d < std::size(o.draft_verify_depth); ++d)
o.draft_verify_depth[d] = m.draft_verify_depth[d];
o.preemptions = m.preemptions;
o.preempt_forced = m.preempt_forced;
o.total_requests = m.admitted;
o.steps = m.steps;
o.steps_prefill = m.steps_prefill; o.steps_mixed = m.steps_mixed;
+7
View File
@@ -104,6 +104,12 @@ struct SchedMetrics {
/* Prefix hits ended early for a windowed block drafter, and the tokens they gave back. */
int64_t draft_refills = 0;
int64_t draft_refill_tokens = 0;
/* Prompt lookup's verify gate, lookup the only drafter (sched/lookup.h): proposals made,
* held back and their drafts, and of the held ones scored, the drafts that came true. */
int64_t lookup_proposals = 0;
int64_t lookup_held = 0;
int64_t lookup_held_drafts = 0;
int64_t lookup_held_hits = 0;
/* Per-position draft acceptance. The pooled `draft_acceptance` cannot tell a drafter that
* decays with depth from one whose later rounds are broken. Per position j: verifies that
* reached j (every earlier position accepted) and how many of those took j. */
@@ -117,6 +123,7 @@ struct SchedMetrics {
double draft_depth_adaptive = 0.0;
int64_t draft_verify_depth[MAX_DRAFT_POS + 1] = {};
int64_t preemptions = 0;
int64_t preempt_forced = 0; /* --preempt-wait-ms fallback victims */
int64_t total_requests = 0;
/* Engine steps: one forward pass plus any draft rounds after it. With speculation a step
* emits more than one token, so step time cannot be derived from tokens per second. */
+20
View File
@@ -166,6 +166,7 @@ void Metrics::sample(const SchedMetrics& m) {
draft_adapt_on_.store(true, std::memory_order_release);
}
c_preemptions_.advance_to(m.preemptions);
c_preempt_forced_.advance_to(m.preempt_forced);
c_steps_.advance_to(m.steps);
c_steps_prefill_.advance_to(m.steps_prefill);
c_steps_mixed_.advance_to(m.steps_mixed);
@@ -182,6 +183,10 @@ void Metrics::sample(const SchedMetrics& m) {
c_draft_accepted_.advance_to(m.draft_accepted);
c_draft_refills_.advance_to(m.draft_refills);
c_draft_refill_tokens_.advance_to(m.draft_refill_tokens);
c_lookup_proposals_.advance_to(m.lookup_proposals);
c_lookup_held_.advance_to(m.lookup_held);
c_lookup_held_drafts_.advance_to(m.lookup_held_drafts);
c_lookup_held_hits_.advance_to(m.lookup_held_hits);
c_attn_cached_.advance_to(m.attn_cached_tokens);
c_linear_cached_.advance_to(m.linear_cached_tokens);
c_checkpoints_.advance_to(m.checkpoints_written);
@@ -308,6 +313,9 @@ std::string Metrics::render() const {
"Number of generation tokens processed.", L, c_generation_tokens_.get());
w.counter("vllm:num_preemptions_total",
"Cumulative number of preemptions from the engine.", L, c_preemptions_.get());
w.counter("radiance:preempt_forced_total",
"Preempted prefill waits that ended by reclaiming cache blocks and forcing a "
"lowest-priority running victim (--preempt-wait-ms).", L, c_preempt_forced_.get());
w.help("vllm:request_success_total",
"Count of successfully processed requests.", "counter");
@@ -416,6 +424,18 @@ std::string Metrics::render() const {
w.counter("radiance:draft_refill_tokens_total",
"Cached prompt tokens those hits gave back to be recomputed.",
L, c_draft_refill_tokens_.get());
w.counter("radiance:lookup_proposals_total",
"Prompt-lookup proposals made, with prompt lookup the only drafter.",
L, c_lookup_proposals_.get());
w.counter("radiance:lookup_held_total",
"Prompt-lookup proposals held back unverified: not expected to pay for their "
"verify rows at the measured step cost.", L, c_lookup_held_.get());
w.counter("radiance:lookup_held_drafts_total",
"Drafts in the held-back proposals.", L, c_lookup_held_drafts_.get());
w.counter("radiance:lookup_held_hits_total",
"Of the held-back proposals scored against the text that followed, the drafts "
"that came true: what verifying them would have accepted.",
L, c_lookup_held_hits_.get());
/* Decoupled prefix caching (spec §7.3). vllm:gpu_prefix_cache_hit_rate is the attention hit
* rate, as in vLLM. The linear side hits at a different granularity (whole checkpoints, not
+2 -1
View File
@@ -136,7 +136,7 @@ private:
* difference). Concurrent scrapes would both add the same difference, so they are serialised. */
std::mutex sample_mu_;
Counter c_prompt_tokens_, c_generation_tokens_, c_preemptions_;
Counter c_prompt_tokens_, c_generation_tokens_, c_preemptions_, c_preempt_forced_;
/* Engine steps. With speculation a step emits 1 + the accepted drafts, so tokens/s does not
* give step time; two scrapes of this counter and a clock do. */
Counter c_steps_;
@@ -150,6 +150,7 @@ private:
/* Exact totals behind the rate gauges; see render(). */
Counter c_prefill_tokens_, c_decode_tokens_, c_draft_tokens_, c_draft_accepted_;
Counter c_draft_refills_, c_draft_refill_tokens_;
Counter c_lookup_proposals_, c_lookup_held_, c_lookup_held_drafts_, c_lookup_held_hits_;
Counter c_attn_cached_, c_linear_cached_, c_checkpoints_;
Counter c_prefix_evict_, c_prefix_ckpt_evict_;
Counter c_prefix_expired_, c_prefix_ckpt_expired_;