Repository navigation
[BugFix][KVPool] Order Memcache bulk KV loads after block zeroing - #23195
Conversation
There was a problem hiding this comment.
Code Review
This pull request overrides the update_requests method in NPUModelRunner to synchronize the current NPU stream when new block IDs need to be zeroed and synchronous KV loads are present, and adds a corresponding unit test. The feedback suggests using getattr defensively when accessing these attributes on scheduler_output to avoid potential AttributeError exceptions in environments where they might not be defined.
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. 🤖 How to trigger CI
Note Until the CI gate has run on a commit, the required Tip 💡 Consider Linking a Related Issue or RFCYour PR title contains the [BugFix] tag, indicating a bug fix or new feature. Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:
🙏 Thanks for helping us keep the project well-organized! |
Coverage
More info see: Summary |
zhenwenqi2024
left a comment
There was a problem hiding this comment.
Could we coordinate this with #22488 before both changes land? An MRV2 step with newly allocated blocks and a synchronous Mooncake prefix hit on kv_producer/kv_both can now synchronize in update_requests() and again immediately before GET. The current unit test stops at update_requests(), so it cannot catch the second wait. Could we reuse the synchronous GET fixture from #22488 in one runner-to-connector case that asserts zero → one wait → GET, and retain the connector-side coverage for MRV1, which does not use this override?
|
Last updated: 2026-11-26 17:46 UTC+8 for commit
|
Extend the existing synchronous bulk GET barrier to Memcache. Keep asynchronous and consumer exclusions, and cover both backends in the ordinary and TP-mismatch ordering tests. Signed-off-by: tyy0829 <1455207791@qq.com>
fbef22f to
2b9ef26
Compare
|
/run |
What this PR does / why we need it?
Fixes #22798 for synchronous Memcache bulk KV loads. PR #22488 orders native GET after block zeroing, but its Mooncake-only condition leaves Memcache exposed to the same race: a queued compute-stream zero can overwrite KV restored by the native transfer.
Remove the backend condition from the existing bulk worker helper. Preserve the
not load_asyncandkv_producer/kv_bothguards and both existing call sites (ordinary GET and TP-mismatch GET). No model-runner change is needed.Extend the existing ordering tests to cover Mooncake and Memcache, including the asynchronous and consumer exclusions in the TP-mismatch path.
LayerwiseKVPoolWorkeris a sibling of the bulk worker and does not call this helper; this PR changes no layerwise code.Does this PR introduce any user-facing change?
Yes. Synchronous Memcache bulk prefix hits no longer race with block zeroing. No new configuration is required. No release note fragment is included, as requested.
How was this patch tested?
Unit-tested source (Ascend base
bb91cd3f3633dec28d1f44f4d58bd805c3f848ae; vLLM sourcec410543d9ffff03f5f6c4a8c0ae1d3ad082c4a15):TORCH_DEVICE_BACKEND_AUTOLOAD=0 pytest -q tests/ut/distributed/ascend_store/test_pool_worker.py: 184 passed. Run in an isolated checkout in the r136 container, selecting the above vLLM source throughPYTHONPATH; the serving checkout was not modified.git diff --checkpassed.bash format.sh cicould not fetch hooks because of the environment's certificate setup. Subsequently, CI run 45777731632 passed pre-commit and mypy. Its CPU test and test-selection jobs stopped before tests at a release-note modify/delete conflict while flattening the old merge history. The branch is now a single linear commit, rebased successfully ontoe953b96e1; both changed files are byte-identical to the tested revision. Fresh CI on this rewritten head is still pending.Hardware reproduction: equivalent backport, not an end-to-end run of current main. Both #22488 barriers with the backend condition removed were backported onto r136 Ascend
7a7ed073c481d5e3a2fc2194c5b879efb2d373c0, vLLM4ba787ec9959e566d3b587a796dff07673324da5.kv_both, Memcache Hybrid 1.3.0, local prefix caching disabled, async scheduling enabled. Speculation: DSpark, 5 draft tokens, draft eager mode. Target decode graph mode FULL_DECODE_ONLY; layerwise selects its supported mode. Max model length 36536, max sequences 32, max batched tokens 4096, memory utilization 0.93.Bulk recorded 200 successful native batch GETs. Layerwise used GVA batch_copy and recorded no native bulk GETs; its 50 warm outputs also matched the earlier layerwise run without the bulk barrier. Local prefix hits were zero in both runs.
The layerwise comparison retained two separate experimental changes for lazy initialization and persistent DSpark draft KV lifecycle, identically in both layerwise runs. Neither is included in this PR, and this comparison does not establish that unmodified r136 layerwise works. The prior runner-level implementation of this PR was absent from these hardware runs.
Evidence retained locally:
pr22488-memcache-comparison-20261126.tar.gz, SHA256d239c06300f7c9516bfc9258c8332a556da16c078011dfe8ca45b7e47014fc8a; report/logs inissue22798-pr22488-memcache-20261126. These are local artifacts, not public download links.No throughput/latency improvement is claimed. The added synchronization may reduce overlap for synchronous Memcache prefill; dedicated performance measurements, other hardware, and asynchronous bulk loading were not hardware-tested. Profiling was configured for manual collection but no capture was started.
Checklist
Boundary / edge-case coverage: both supported backends and sync/async/role conditions.
Regression test: the two GET-ordering tests fail without this change.
Meaningful & reliable tests: assert synchronization occurs before the native GET.
Performance impact: correctness reproduction completed; dedicated throughput/latency benchmark pending.
vLLM main: vllm-project/vllm@c410543