[Kimi-K3] DCP support - #50484
[Kimi-K3] DCP support#50484
Conversation
|
This pull request has merge conflicts that must be resolved before it can be |
| query_lens = query_start_loc[1:] - query_start_loc[:-1] | ||
| empty_rows = torch.repeat_interleave( | ||
| seq_lens == 0, | ||
| query_lens, | ||
| output_size=lse.shape[0], | ||
| ) | ||
| lse.masked_fill_(empty_rows[:, None], float("-inf")) |
There was a problem hiding this comment.
I assume this will never be called if we use custom cuda kernel?
| ), | ||
| # Direct DCP ops default on when applicable; set to 1 to enforce or 0 to disable. | ||
| "VLLM_USE_DIRECT_DCP_A2A": lambda: maybe_convert_bool( | ||
| os.getenv("VLLM_USE_DIRECT_DCP_A2A") |
There was a problem hiding this comment.
Can we set default value? Or I think we can make it an engine args.
There was a problem hiding this comment.
we already have --dcp-comm-backend cuda-a2a (or a better name?)
There was a problem hiding this comment.
Yeah I considered these, but the kernel version has some limitation. The intent here is
- None = auto (default on when multicast is available)
- 1 = force use
- 0 = disable.
Which I feel it's actually cleaner this way... but happy to change.
|
@GirasoleY do you plan to get this PR merged if it's working fine? |
a526d4b to
5dfad64
Compare
|
✅ @GirasoleY, CI is now available for this PR. Comment |
|
/ci run |
|
✅ Triggered Buildkite CI #82945 for commit |
|
/ci run |
|
✅ Triggered Buildkite CI #83171 for commit |
Resolves the recurring vllm/envs.py structural conflict per docs/superpowers/specs/2026-05-14-envs-merge-conflict-resolution-design.md: main's legacy `if TYPE_CHECKING:` block and `environment_variables` dict are dropped wholesale (superseded by the pydantic BaseSettings tree on this branch), then main's semantic delta is ported field-by-field. 6 main-side commits touched vllm/envs.py since base e644c8c (+55 -0). All 10 new vars have already-merged callers, so every port is mandatory: - vllm-project#51447 VLLM_MAX_STOP_STRINGS (int=4), VLLM_MAX_NUM_BAD_WORDS (int=128), VLLM_MAX_BAD_WORDS_TOTAL_TOKENS (int=1024) -> ServerSettings - vllm-project#49948 VLLM_MAX_AUDIO_DECODE_BYTES (int=268_435_456) -> MediaSettings, carrying compile_factor=False to mirror main's ignore-set addition - vllm-project#50484 VLLM_USE_DIRECT_DCP_A2A / _Q_GATHER / _KV_GATHER (bool|None=None) -> QuantSettings, with one shared `_parse_direct_dcp` before-validator reproducing main's maybe_convert_bool exactly - vllm-project#52079 VLLM_KIMI_K3_GEMM_RS (bool=False) -> QuantSettings - vllm-project#49458 VLLM_USE_HW_AGNOSTIC (bool=False) -> UsageSettings - vllm-project#47808 VLLM_ADAPTIVE_VERIFICATION_PROFILE_CONTEXT_LEN (int=8192) -> QuantSettings No deletions, modifications, or renames this window. Nothing was dropped silently: all 6 commits' envs.py deltas are covered above. Env var set parity after resolution: 292 branch fields vs 293 main runtime entries, sole difference VLLM_TRITON_ATTN_USE_TD -- the known deprecation shim divergence, re-confirmed untouched by this merge window. Verified: 54 tests pass across tests/test_envs.py, tests/test_envs_pydantic.py and tests/docs/test_env_vars_gen.py; `pre-commit run --files vllm/envs.py` clean; tests/test_request_input_bounds.py passes (22 tests). The audio, DCP and end-to-end hw-agnostic consumer suites need a CUDA box plus soundfile / multiprocess and were not run here. AI assistance was used to enumerate the port list and apply the resolution; see Appendix G of the playbook for the full audit trail. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Vinay Damodaran <vrdn@hey.com>
… refactor (vllm-project#52377) GLM-5.2 + DCP4 + MTP spec decode produced garbled output (repetition, acceptance collapsing to ~100%) after the vllm-project#50484 DCP Manager refactor, which only handled dense MLA. Per vllm-project#46514, per-token seq_lens must be localized AFTER the MTP expansion; the old path under-counted local KV on (W-1)/W ranks, the indexer picked a wrong sparse top-k, and decode degenerated into repetition. Squashed from the production bugfix chain: - 9a63d1e6: restore main MLADCPManager in mla_attention.decode (sparse-MLA DCP startup crash) - d5f5ca13: guard mask_dcp_empty_shards_ against empty local decode shard (num_decodes=0 -> index out of bounds) - 1e008a8a: expose FP8 sparse decode metadata via FlashMLASparseMetadata.decode - 3492ca7a: skip LSE empty-shard mask on sparse DCP decode (superseded by the official vllm-project#52377 fix below) - a05834a6 (vllm-project#52377 upstream): getattr(attn_metadata, "decode", None) guard, _direct_workspace_query_gather fallback for forced-MQA, use_forced_mqa flag (full seq_lens/query_start_loc for sparse) - c912d820: drop VLLM_DEBUG_DCP instrumentation Verified in production: 8+2 -> 10, 3+4 x3 identical, counting 1-174 consecutive, acceptance 0.90/0.78/0.63/0.56/0.47 (healthy reject curve). Co-authored-by: Sisyphus <sisyphus@openci.dev>
… memory Port the direct-final PCP KV idea from vllm-project#49517 onto the merged vllm-project#50484 symmetric-memory substrate. Producers write final Main-KV and Indexer-K rows into every replica through peer pointers and skip the vllm-project#52046 AllGather + insert path. Signed-off-by: 云挚 <ningyunxiao.nyx@antgroup.com>
… memory Port the direct-final PCP KV idea from vllm-project#49517 onto the merged vllm-project#50484 symmetric-memory substrate. Producers write final Main-KV and Indexer-K rows into every replica through peer pointers and skip the vllm-project#52046 AllGather + insert path. Signed-off-by: 云挚 <ningyunxiao.nyx@antgroup.com>
… memory Port the direct-final PCP KV idea from vllm-project#49517 onto the merged vllm-project#50484 symmetric-memory substrate. Producers write final Main-KV and Indexer-K rows into every replica through peer pointers and skip the vllm-project#52046 AllGather + insert path. Signed-off-by: 云挚 <ningyunxiao.nyx@antgroup.com>
…hrough PyTorch symmetric memory Port the direct-final PCP KV idea from vllm-project#49517 onto the merged vllm-project#50484 symmetric-memory substrate. Producers write final Main-KV and Indexer-K rows into every replica through peer pointers and skip the vllm-project#52046 AllGather + insert path. Signed-off-by: 云挚 <ningyunxiao.nyx@antgroup.com> (cherry picked from commit 748d7d4)
Co-authored-by: @foraxe
Summary
Follow-up to #50000 adding decode context parallelism for Kimi-K3:
This replaces #50055.
Query-buffer lifetime
The direct query gather returns a view of its persistent symmetric buffer. Reuse is ordered by the mandatory post-attention DCP combine:
DBO microbatches use independent workspace slots.
Accuracy
.buildkite/kimi-k3/rack5/gsm8k.yaml:Performance
120k regression workload: 114k shared prefix + 6k suffix, 400 output tokens, Mooncake disabled.
HBM KV capacity per GPU:
On 4x GB200 at matched Kimi-K3 geometry, the direct-to-final query path improved query-exchange latency by 10.4%-29.9%. Correctness and changing-input CUDA-graph replay passed.
Scope and overlap
This PR subsumes the direct symmetric-memory MLA A2A work in #48897 and extends it with Kimi-K3 fused MLA DCP, direct query gather, chunked-context KV gather, and the direct-to-final query optimization.
CUDA-graph padding follow-up
Commit
76b2e9d45emakes empty-shard LSE masking tolerate CUDA-graph padding rows.Validation:
tests/distributed/test_dcp_a2a.py::TestLSEWeightedCombine::test_ag_rs_masks_empty_shard_and_padded_lse: 1 passed on GB300.AI assistance was used to diagnose, implement, and validate this follow-up fix.