Archived
sched: a preempted request publishes its prefix; the recompute adopts it
Scheduler::preempt_back dropped everything a request had computed: unlike close_request it published nothing, so a preempted 96.6k-token prompt was computed again from its first token. The publish block of close_request is now Scheduler::publish_prefix, called by both. Its blocks stay in the cache, so a preemption that published gives eviction its rounds back (the decode ensure loop and the overdue path) and the cache gives them back, the newest last, before another request is preempted. preempted_can_prefill counts the blocks the recompute adopts from the cache (pc_->lookup), so a preempted request is not held back for room its own cached prompt already covers. Shared KV with RADIANCE_KV_GUARANTEE=1 (nine Qwen requests preempted for TranslateGemma's start pool): Qwen 587 -> 458 s, TranslateGemma 139 -> 80 s; without the guarantee unchanged (340 / 58 vs 339 / 56). Test: a_preempted_request_publishes_its_prefix; sched 187, engine_e2e and the related suites pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e3d65f3a7c
commit
01c7a3334a
4 files changed
+57
-15
No files matched your search
@@ -1942,6 +1942,29 @@ TEST(a_preempted_prefill_ignores_a_kv_group_that_holds_no_blocks) {
|
||||
f.commit_plain();
|
||||
}
|
||||
|
||||
/* A preempted request publishes what it computed, as a finished one does: its prompt stays in the
|
||||
* cache, and the recompute adopts it instead of computing it again (a 96.6k-token prompt took about
|
||||
* 25 s of a pair of cards). The blocks stay reclaimable: the cache gives them back under pressure. */
|
||||
TEST(a_preempted_request_publishes_its_prefix) {
|
||||
Fixture f;
|
||||
f.build(/*blocks=*/26, /*states=*/64); /* 26 x 16 = 416 tokens */
|
||||
f.cfg.preempt_wait_ms = 60000;
|
||||
CHECK_OK(f.start());
|
||||
uint64_t a = f.submit(287, 64, /*priority=*/5);
|
||||
uint64_t b = f.submit(128, 64, /*priority=*/0);
|
||||
CHECK(f.sch.step() != nullptr);
|
||||
f.commit_plain();
|
||||
const size_t before = f.pc.published.size();
|
||||
CHECK(f.sch.step() != nullptr);
|
||||
REQUIRE_EQ((int)f.sch.find(b)->state, (int)ReqState::Preempted);
|
||||
bool found = false;
|
||||
for (size_t i = before; i < f.pc.published.size(); ++i)
|
||||
if (f.pc.published[i].seq == b && f.pc.published[i].n_tokens >= 128) found = true;
|
||||
CHECK(found);
|
||||
f.commit_plain();
|
||||
(void)a;
|
||||
}
|
||||
|
||||
/* The gate's wait is bounded: after --preempt-wait-ms an overdue preempted prefill gets room by
|
||||
|
||||
* preempting the lowest-priority running request before the step is planned, so it cannot queue
|
||||
|
||||
Reference in new issue
Block a user