sched: an overdue preempted prefill keeps its place ahead of the queue

A preempted request waiting for its whole-recompute gate (kAdmitWait) let the admission walk ask the
next request in the queue. For an overdue one that undoes the overdue path: the room it made in this
step went to a request queued behind it. With preempted prompts published, the victim forced off for
it needs almost nothing to come back, so it was re-admitted at once and forced off again on the next
step. Under KV pressure the same victim was forced off and re-admitted 26 times in 16 s while the
overdue request waited. An overdue preempted request that is still refused now stops the walk, as a
refused fresh request already does.

2x R9700, Qwen3.8-Flash-Next TP2, production flags with the KV cache cut to 6.45 GiB a card
(--gpu-headroom-mib 3072), 16 concurrent 58.6k-token prompts with 4000-token answers:
- without publishing preempted prompts:  wall 390.6 s, mean 338.5 s, 9 preemptions, 1 forced
- publishing them:                       wall 346.4 / 344.1 s, mean 306.6 / 299.8 s, 36 / 32 preemptions, 28 / 26 forced
- publishing them, with this change:     wall 331.0 / 324.4 s, mean 289.4 / 284.0 s, 8 / 9 preemptions, 1 / 1 forced

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mici81andClaude Opus 5.5 authored and StillDeadcode committed 2026-11-05 14:59:28 +01:00
1 parent 12b7b7889b
commit b632c72f5d
2 files changed
+54 -1

No files matched your search

+11 -1
View File
@@ -2076,7 +2076,17 @@ const RadBatch* Scheduler::step() {
admit_full_ = 0;
admit_next_step_ = false;
const int as = admit_one(s, budget, areserve);
if (as == kAdmitWait) { ++at; continue; }
/* A preempted request waiting for its whole-recompute gate lets the next one be asked;
* an overdue one does not. The room the overdue path made this step is for it, and a
* request queued behind it would take that room back: a victim just forced off for it,
* its prompt published, needs almost nothing to come back, and under KV pressure the
* same victim was forced off and re-admitted 26 times in 16 s while the overdue request
* waited. */
if (as == kAdmitWait) {
if (s.req->state == ReqState::Preempted && preempt_wait_overdue(s)) break;
++at;
continue;
}
/* An overdue preempted prefill on an idle engine that still cannot be admitted will
* not become admissible by waiting: nothing is running to finish and free the pool.
* Fail it (spec §17) and ask the next request, instead of parking the step loop. Not