Spec v2 tree drafting (topk>1) with page_size>1#26972
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/tag-and-rerun-ci extra |
|
/rerun-test registered/spec/eagle/test_spec_eagle_page.py |
|
Results for 🚀 |
|
/rerun-test registered/spec/eagle/test_spec_eagle_topk.py registered/spec/eagle/test_spec_eagle_page.py |
|
Results for 🚀 |
ec61bb9 to
538142b
Compare
|
/rerun-test registered/chunked_prefill/test_scripted_core_4gpu.py |
|
Results for 🚀 |
Stacked on #26866.
Extends spec v2 (overlap) EAGLE tree drafting (
topk > 1) topage_size > 1, and sizes + guards thereq_to_tokenpool for the per-branch holey draft layout.Summary
duplicate_prefix_tail_to_draft_branches).get_alloc_len_per_decodeforpage_size > 1 + topk > 1(wasNotImplementedError): worst-case footprintnum_new_pages_per_topk * page_size * topk.req_to_tokenrow to hold that footprint, plus an always-on invariant that fails fast if a draft over-allocation would outgrow the row.topk > 1 + page_size > 1to spec v2 and gate it to backends that implement the two-pass cascade draft-decode.Bug
At
page_size > 1 + topk > 1the draft reserves a page-aligned per-branch footprint of2 * get_alloc_len_per_decode(=topk * num_new_pages * page_size), far exceeding the default4 + num_draft_tokensspec headroom thereq_to_tokenrow was sized for. One over-allocation then fails two ways:release_kv_cachereadsreq_to_token[req][start:end]; the slice silently clamps to the row width, so over-allocated KV slots are never freed ->pool memory leak detectedwhen the idle mem check runs.Fix
_init_pools: widenextra_max_context_lentomax(4 + num_draft_tokens, 2 * get_alloc_len_per_decode)forpage_size > 1 + topk > 1.prepare_for_decode: an always-on, CPU-side invariant asserting the per-request draft over-allocation fits thereq_to_tokenrow -- a clear host error instead of a silent leak or device assert.Repro / A-B
Both gists start a real spec server (EAGLE3 Llama-3.1-8B, fa3).
SGLANG_DEBUG_REVERT_PR=26972reverse-applies the row-widen (registered inpr_fix_toggle.py; the revert hook is moved to run beforeinit_model_workerso init-time fixes can be reverted), demonstrating the bug against the same build:With the fix both pass; with
SGLANG_DEBUG_REVERT_PR=26972both deterministically trip the invariant.Test
test/registered/spec/eagle/test_spec_eagle_topk_page.py: EAGLE3 topk8 + page64 (spec v2) and Llama-2 topk8 + page4 (spec v1).Related
Sibling
page_size > 1 + topk > 1fixes in other backends: #27338 (flashinfer cuda-graphkv_indices), #27360 (fa3 expandpage_table).CI States
Latest PR Test (Base): ✅ Run #27060252695
Latest PR Test (Extra): ✅ Run #27060252626