feat: add prefix-cache-affinity dp rank routing.#1860
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces prefix-cache-aware data-parallel (DP) routing to optimize KV cache reuse across DP ranks. It adds configuration options (enable_prefix_cache_aware_dp_routing, prefix_cache_aware_dp_match_threshold, and prefix_cache_aware_dp_imbalance_threshold) and implements a read-only prefix_cache_match_length probe to determine prefix-cache hit lengths without mutating state. The routing logic in BlockManagerPool uses these metrics to route sequences to the rank with the longest prefix match, while guarding against cold-start herding and popular-prefix overloading. Feedback suggests adding a defensive null check for the sequence pointer in get_cache_aware_dp_rank to prevent potential segmentation faults.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
and then remove docs in this pr
ee341f4 to
86363f9
Compare
86363f9 to
93376c7
Compare
Description
Related Issues
Change Type
Pull Request Checklist
Thank you for contributing to xLLM. Before requesting review, please make sure the following items are complete.
PR Title and Commit Messages
<type>: <subject>.Pre-commit Checks
pre-commitby runningpip install pre-commitor an equivalent command.pre-commit install.pre-commit run --all-filesand fixed any reported issues.Self Review
.agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.mainbranch.Build and Test Coverage
python setup.py build testhas passed on a CUDA machine.python setup.py build testhas passed on an NPU machine.python setup.py build testhas passed on an MLU machine.Reviewer Notes