Archived
sched: a preempted prefill reclaims cache and leaked state slots before it waits
The whole-recompute gate refused a preempted request forever when the pool held only cache entries, and an empty running set left a leaked state slot unreclaimed. Reclaim the cache over several rounds, release idle state slots when nothing is running, and admit the overdue waiter if it can ever fit. A prefill is never a victim while a decoder is running; tests cover the deadlock, the leaked slot, and the lost KV sequence.
This commit is contained in:
1 parent
9ed3ef7a7b
commit
9560780bfa
7 files changed
+316
-42
No files matched your search
@@ -797,11 +797,12 @@ private:
|
||||
/* Both snapshots resolve the same way; the two wrappers exist because the row types differ. */
|
||||
const Request* live_req(int32_t slot, uint64_t id) const;
|
||||
void preempt_back();
|
||||
/* A preempted request waits until the pool can hold its WHOLE remaining recompute plus one
|
||||
* block of headroom for every running sequence; otherwise admitting it now just gets it
|
||||
* preempted again next step and the prefill loops. `preempt_wait_overdue` bounds that wait
|
||||
* for every overdue preempted request: after --preempt-wait-ms the scheduler reclaims cache
|
||||
* blocks and preempts lowest-priority running requests until one of them can prefill. */
|
||||
/* A preempted request waits until the pool can hold its WHOLE remaining recompute, the rest
|
||||
* of every running prefill, and one block of headroom per runner. Admitting it against only
|
||||
* the next token steals the blocks a running prefill still needs and preempt_back() resets
|
||||
* that prefill to zero — the loop. `preempt_wait_overdue` bounds the wait for every overdue
|
||||
* preempted request: after --preempt-wait-ms the scheduler reclaims cache blocks and preempts
|
||||
* a decoding runner until one of them can prefill. A runner still prefilling is not a victim. */
|
||||
bool preempted_can_prefill(const SchedReq& s) const;
|
||||
bool preempt_wait_overdue(const SchedReq& s) const;
|
||||
/* Give blocks back from the prefix cache until the pool has headroom again. */
|
||||
|
||||
Reference in new issue
Block a user