feat: add layerwise split kv cache sharding. - #2260
Open
shifengmin wants to merge 5 commits into
Open
Conversation
Shard persistent KV by static layer owner and keep one shared scratch layer so PD cache ids stay aligned. Prefill, decode, and spec-verify gather queries to the owner, run attention on the owner's paged cache, and broadcast the output. Reject incompatible layerwise_split_size configs at startup. Disable layerwise split only for draft workers. Co-authored-by: Cursor <cursoragent@cursor.com>
shifengmin
requested review from
DongheJin,
DragonFive,
JimHsiung,
Kang-Meng,
liujinguang0125,
liutongxuan,
ustcfy,
xiao-yu-chen,
yingxudeng,
yinjiawei01 and
zhang-minchao
as code owners
August 18, 2026 07:08
Pin the submodule to xLLM-AI/xllm-atb-layers#14 on main (523a71d), including the default-path graph gate. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--layerwise_split_sizeto shard persistent KV by a static layer owner inside each attention TP group, while non-owners share one scratch layer so PD-Disaggregation stay compatible.Dependency
Depends on xLLM-AI/xllm-atb-layers#14
Related Issues
Change Type
Pull Request Checklist
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.Changed-file validation passed:
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 --device npucompleted successfully on an Ascend development machine.python setup.py build testhas passed on an MLU machine.Reviewer Notes
This intentionally falls back to eager execution instead of caching one graph per DP distribution. The latter can create an unbounded graph cache for normal scheduling variance.