Repository navigation
[Bugfix][KV Offload] Reset a resumed streaming session's block table in OffloadingConnector and SimpleCPUOffloadConnector - #60810
Conversation
Signed-off-by: Alberto Perdomo <aperdomo@redhat.com>
Signed-off-by: Alberto Perdomo <aperdomo@redhat.com>
Signed-off-by: Alberto Perdomo <aperdomo@redhat.com>
|
/ci run |
|
❌ @albertoperdomo2, A reviewer with write access must run |
orozery
left a comment
There was a problem hiding this comment.
LGTM!
Thanks for the fix @albertoperdomo2 !
@ivanium PTAL for the simple cpu changes.
|
✅ @albertoperdomo2, CI is now available for this PR.
|
ivanium
left a comment
There was a problem hiding this comment.
Overall good; left a small question.
| if new_block_id_groups[g] is not None: | ||
| if is_full_table: | ||
| state.block_ids = tuple([] for _ in range(num_groups)) | ||
| state.num_stored_blocks = [0] * num_groups |
There was a problem hiding this comment.
Small Q: Should we preserve num_stored_blocks here and only replace block_ids? Or maybe I missed sth
There was a problem hiding this comment.
nice catch, yes, you are right: streaming continuation preserves the prefix, so num_stored_blocks remains valid (new requests initialize it to zero and preemption resets it above). I’ll remove this reset and only replace block_ids 👍🏽
cc: @orozery
Signed-off-by: Alberto Perdomo <aperdomo@redhat.com>
|
/ci run |
|
✅ Triggered Buildkite CI #97104 for commit ℹ️ This PR is 128 commits behind upstream |
…in OffloadingConnector and SimpleCPUOffloadConnector (vllm-project#60810) Signed-off-by: Alberto Perdomo <aperdomo@redhat.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: vllm-agent <claw@inferact.ai> Signed-off-by: Christopher Mackenzie <christopher.mackenzie.software@gmail.com>
…in OffloadingConnector and SimpleCPUOffloadConnector (vllm-project#60810) Signed-off-by: Alberto Perdomo <aperdomo@redhat.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: vllm-agent <claw@inferact.ai> Signed-off-by: Christopher Mackenzie <christopher.mackenzie.software@gmail.com>
…in OffloadingConnector and SimpleCPUOffloadConnector (vllm-project#60810) Signed-off-by: Alberto Perdomo <aperdomo@redhat.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: vllm-agent <claw@inferact.ai>
…e flag Chunked local attention blocks hold token positions, like full and sliding-window attention, so select them by position too: the block that straddles a chunk boundary was not copied again. A UniformTypeKVCacheSpecs group already takes this path, because generate_scheduler_kv_cache_config gives the scheduler one of its layer specs. Since vllm-project#60810, yield_req_data reports a new request, and so a preempted request that comes back as new, with is_full_table=True. The extra reset on preempted_req_ids is redundant: drop it and name the flag after what it means. Skip the last-chunk SSM copy for "align" SSM groups, whose block table is not append-only; they keep main's per-step copy. Reword two stale comments. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Sohom Chakraborty <16609933+sohom-cs@users.noreply.github.com>
Overview
OffloadingConnectorandSimpleCPUOffloadConnectorcorrupts the CPU KV cache for streaming-input sessions. A session resumed for its next input chunk arrives asNewRequestDatawith its full block table, butyield_req_dataflagged it as a delta, so the connector appended it to the table it already held.Claims
yield_req_datareportsis_full_table(Truefor new requests) instead ofpreempted; the connector resets on it. NIXL and SimpleCPUOffload ignore the flag, so their behavior is unchanged.Validation
test_streaming_session_stores_new_chunks(sync and async): the session's second chunk stores blocks(0, 1, 2)on main (earlier chunks' blocks) and(2, 3, 4)with this PR.pytest tests/v1/kv_connector/unit/offloading_connector/ tests/v1/simple_kv_offload/: all pass.5, 276, 183, 9).Details
_build_store_jobspairs chunk j's key withblock_ids[j], so the duplicated table ([1, 2, 3, 1, 2, 3, 4, 5, 6]vs[1, 2, 3, 4, 5, 6]) stored earlier chunks' KV under later chunks' keys. For every other request the table is already empty when the reset runs, so it is a no-op for them.SimpleCPUOffloadConnectorduplicates the table the same way. It doesn't corrupt KV (it keys by block hash), but it skips offloading the session's new blocks. That will be a follow-up.AI assistance (codex) was used; I reviewed every changed line and ran the validation above.
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 (tests).
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.