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:
baKon committed 2026-10-30 21:32:03 -05:00
1 parent 9ed3ef7a7b
commit 9560780bfa
7 files changed
+316 -42

No files matched your search

+3
View File
@@ -454,6 +454,9 @@ public:
/* Whether `seq` can grow to `n_tokens` without taking blocks from another sequence. */
bool can_grow(uint64_t seq, int64_t n_tokens) const;
/* Drop every sequence's state slot and put back any slot neither free nor held. The
* scheduler calls this only when nothing is running (IKVManager::release_idle_states). */
int release_idle_states();
/* Blocks a paged group can still hand out, including the lendable part. */
int64_t available_blocks(int32_t group) const;