Repository navigation
Conversation
|
This pull request has merge conflicts that must be resolved before it can be |
…prefix pages Hybrid (KDA/Mamba) READ paired the complete decoder attention table with the prefill table by length and tail alignment, so a decoder prefix-cache hit still re-read every cached page. For each full-attention group, select the pages covering the final external token range [N-1-E, N-1) from both complete tables instead, and raise if the tables do not cover it. Window-clipped and state attention groups keep tail alignment. Co-Authored-By: Claude Code <noreply@anthropic.com> Signed-off-by: whx-sjtu <xiaowang990929@gmail.com>
4e62499 to
cdb4bbf
Compare
kliuae
left a comment
There was a problem hiding this comment.
Nice work, thanks for the optimization!
| # final allocation count, not a prior lookup or receive-page hashes. | ||
| remote_end = request.num_prompt_tokens - 1 | ||
| local_end = remote_end - num_external_tokens | ||
| first_block = local_end // block_size |
There was a problem hiding this comment.
Nit: the prefix blocks skipped are computed from the request wide num_external_tokens. For a EAGLE drafter that can have a different cache group from the main model, its prefix cache lookup drops the last matched page, and its cache hit is one page shorter than the main group. Since the scheduler counts the main group's hit, the dropped page is neither recomputed nor copied where previously the full read would fetch it from the prefill side, but it gets zeroed and may lead to lowered draft acceptance. Should we consider gating this case off this path? Not sure if this configuration is encountered often though.
Overview
MoRIIO hybrid (KDA/Mamba) READ re-reads attention pages the decoder already caches; this reads only external-token pages.
Not duplicates: #48471 (non-hybrid length mismatch), #62165 (SWA tail clipping). Rebased on #60867.
Claims
[N-1-E, N-1)(Nprompt length,Efinalnum_external_tokens). KDA/Mamba and state attention groups are unchanged.MoRIIOErrorinstead of being tail-aligned.Validation
test_moriio_hma_scheduler.py: main @ 5689c27 110 passed, PR 119 passed, new tests on main connector 13 failed. All MoRIIO unit tests: 438 passed, 33 skipped. ruff 0.14.0 clean.Commands, revert-red and GPU setup
Revert-red, new tests with the main connector: 6 x
test_scheduler_accepts_dspark_with_wrapped_full_attentionandtest_scheduler_accepts_glm5_next_groups_with_mtp(main has no_attn_read_block_sizes),test_glm5_next_mtp_read_pairs_every_group[476-1], 2 xtest_update_state_rejects_incomplete_attention_tables,test_update_state_selects_missing_attention_pages[128]and[192],test_update_state_uses_final_external_token_count[128].GPU build:
vllm/vllm-openai-rocm:nightly-81198e97plus this fix before the #60867 rebase, which only made the selection per attention group. MoRIIO READ, prefix caching on both sides, prefill-side MultiConnector (MoRIIO + SimpleCPUOffloadConnector), DSpark speculative decoding, FP8 KV. One attention page is 12288 tokens after DCP sharding. The decoder's local prefix hit was 89.7% of prompt tokens.Sampled transfers came after warmup, with
E > 0and at least one complete cached decoder page. A per-rank observer recorded READ submissions and completions; bytes are logical payload.Throughput 10557 tok/s/chip vs 10882 for the unpatched run, which used a different cluster, so not a controlled A/B. Decoder
request_prefill_timeavg 0.12 s unpatched vs 0.11 s patched; prefill-side queue avg 13.8 s vs 16.2 s.Details
Root cause on the decoder:
[0, L), soE = N - 1 - L.update_state_after_allocgets complete attention tables, cached pages included._align_read_blockspaired P and D tables by length and tail, so READ also covered[0, L).[(N-1-E) // B, ceil((N-1) / B)),B= its block size x DCP when sharded; window-clipped and state groups keep_align_read_blocks.KVCacheManagercase and the GPU run pass complete tables.Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.
🤖 Generated with Claude Code