Skip to content

fix: NIXL KV transfer patches for Kimi PD disaggregated serving#1

Open
wz1qqx wants to merge 4 commits into
v0.16.0-basefrom
support-kimi-pd
Open

fix: NIXL KV transfer patches for Kimi PD disaggregated serving#1
wz1qqx wants to merge 4 commits into
v0.16.0-basefrom
support-kimi-pd

Conversation

@wz1qqx

@wz1qqx wz1qqx commented Mar 26, 2026

Copy link
Copy Markdown
Owner

Summary

Patches on top of vLLM v0.16.0 for Dynamo PD disaggregated serving with NIXL KV transfer, addressing KV cache leak and stability issues discovered during Kimi-K2.5 deployment.

Changes

  1. MLA notification request ID fix (nixl_connector.py line ~2228)

    • MLA pre-transfer send_notif was using decode-side req_id instead of meta.remote.request_id
    • In Dynamo KVBM mode, these share the same UUID base but have different hash suffixes
    • Caused "unrecognized request" errors and KV cache leak on prefill side
  2. Scheduler KV send tracking (scheduler.py)

    • Added _pending_kv_send_count to track requests waiting for decode to fetch KV blocks
    • has_finished_requests() now returns True when pending KV sends exist, preventing engine idle blocking
  3. Engine GIL yield fix (core.py)

    • Changed has_unfinished_requests() to has_requests() in GIL-yield condition
    • Prevents background thread starvation during tight polling
  4. Handshake defensive handling (nixl_connector.py)

    • Frame count validation in ZMQ handshake listener
    • Handshake completion timing log
  5. KV transfer diagnostic logs (nixl_connector.py)

    • [KV] request_finished(P) / send_done(P) / recv_done(D) / RDMA READ posted
    • Unrecognized request error now includes reqs_to_send sample
  6. Attention assert fix (utils.py)

Files changed (4)

File Lines Description
nixl_connector.py +59 -17 MLA ID fix, handshake hardening, diagnostic logs
scheduler.py +7 -1 _pending_kv_send_count tracking
core.py +1 -1 GIL yield condition fix
utils.py -1 Remove incorrect assert

Test plan

  • Deployed on paigpu-a cluster with Kimi-K2.5 (8xH200, 2P+1D)
  • KV cache leak resolved — gpu_cache_usage_perc correctly decreases
  • MLA notification ID mismatch confirmed fixed
  • Multi-turn benchmark (mtb) stable TTFT

wz1qqx added 4 commits March 20, 2026 22:59
Cherry-picked from vllm-kimi2.5-pd (v0.17.1 based):
- fix: keep engine active for pending KV transfers
- fix: add post-transfer explicit notification for NIXL KV connector
- fix: correct MLA pre-transfer notification request ID
- perf: revert GIL-yield sleep to 0.001s
…agnostics

1. Handshake listener: handle non-3-frame ZMQ messages gracefully
   instead of crashing the thread (fixes ValueError on recv_multipart)
2. Add [DIAG] logs throughout KV transfer pipeline:
   - build_connector_meta: queue depths (recv/send/save/batch)
   - request_finished(P): block delay-free tracking
   - start_load_kv: batch summary + pending state
   - _nixl_handshake: connection timing
   - _read_blocks: RDMA READ posting with full context
   - get_finished: transfer pipeline state per step
Replace verbose [DIAG] diagnostic logs with minimal [KV]-prefixed logs
on the NIXL transfer critical path. Each log carries req_id for easy
request-level tracing via: grep '\[KV\]' | grep 'req=<id>'

Kept (4 critical path events):
  [KV] request_finished(P): req=..., blocks=...  (P: prefill done)
  [KV] handshake completed: engine=..., Xs       (D: first connect)
  [KV] RDMA READ posted: req=..., blocks=...     (D: transfer submitted)
  [KV] send_done(P) / recv_done(D): req=...      (transfer complete)

Removed (investigation-only, not critical path):
  - build_connector_meta queue depths
  - _nixl_handshake connecting (kept completed)
  - start_load_kv batch summary
  - start_load_kv per-request (reverted to debug)
  - MLA send_notif debug tracking
  - get_finished pending pipeline state
Cherry-pick upstream fix vllm/vllm#36553 (006aea1).
The assert fails when DP dummy batch has padding requests with
query_lens=0, triggered more frequently in KVBM PD mode.
@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant