Repository navigation
[Feat] model: Add basic Kimi-K3.1 support (NV, AMD) - #48415
Merged
Merged
Conversation
sglang-bot
requested review from
Fridge003,
HaiShaw,
JustinTong0323,
mickqian,
yctseng0211,
yhyang201 and
yuan-luo
as code owners
November 4, 2026 15:42
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
sglang-bot
requested review from
1am9trash,
CatherineSue,
Qiaolin-Yu,
YAMY1234,
Ying1123,
alphabetc1,
ch-wan,
fzyzcjy,
hanming-lu,
hebiao064,
hnyls2002,
huangtingwei9988,
hubertlu-tw,
hzh0425,
ispobock,
kkHuang-amd,
merrymercy,
rainj-me,
slin1237,
xiezhq-hermann and
yizhang2077
as code owners
November 4, 2026 15:42
41 of 42 tasks
mattteochen
added a commit
to mattteochen/sglang
that referenced
this pull request
Nov 4, 2026
Take sgl-project#48415's packed top-k wiring (kernel built on every backend, wrapper exported unconditionally, packed_extend_topk flag) in place of this branch's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mattteochen
added a commit
to mattteochen/sglang
that referenced
this pull request
Nov 4, 2026
sgl-project#48415 builds the exact packed PAGED extend top-k on CUDA but selects it only for Kimi-K3.1, so GLM-5.x and DeepSeek-V3.2 prefill on CUDA still run the legacy fused transform. Nothing in the packed path is model specific (ROCm already runs it for every DSA model) and the dispatch keeps its own shape checks and legacy fallback, so enable it for every DSA model except on XPU, which has no packed op. Add test_topk_v2_packed_exact (exact top-k contract over every length band, ties and unaligned starts, chunked rows) and test_topk_v2_packed_dsa_dispatch (the DSA PAGED extend dispatch reaches the packed kernel and agrees with the legacy kernel). Co-Authored-By: Claude Opus 5.5 <[email protected]>
3 tasks done
3 of 5 tasks
4 of 5 tasks
akhilg-nv
added a commit
to akhilg-nv/sglang
that referenced
this pull request
Nov 6, 2026
Resolve the conflicts with main's Kimi-K3.1 support (sgl-project#48415), which already builds the topk_v2 packed kernel on every platform and dispatches the PAGED extend to it only when packed_extend_topk is set (ROCm, Kimi-K3.1): - topk_v2.cuh and dsv4/topk.py take main's version; this branch's guard removal there is now main's. - The PAGED extend dispatch takes the packed kernel for every DSA model; a prefill-CP shard takes it only with packed_extend_topk, so ROCm and Kimi-K3.1 keep main's routing and other models keep CP on legacy. - test_prefill_cp_shard_topk_route (renamed) sets dsa_packed_extend_topk per case instead of patching _is_hip, and covers all four (flag, sharded) pairs. - ForwardMode is imported from forward_mode (main's indirect-import check). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 6, 2026
This was referenced Nov 11, 2026
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.
Adds Kimi-K3.1 (
KimiK31ForConditionalGeneration): Kimi-K3 with DeepSeek-style sparse attention (DSA) in its full-attention layers, an fp8_ds_mla KV cache whose tile scales are rounded up to powers of two as the reference writer does, andflashmla_kvon CUDA or the Triton sparse MLA backend on ROCm.No behavior change for other models; the exact packed top-k kernel now also builds on CUDA, where only this model selects it.
Performance and further features (DCP, PD, speculative decoding) follow in #48414.
Model: https://huggingface.co/moonshotai/Kimi-K3.1-Pro
CI States
Latest PR Test (Base): 🚫 Run #41863403425
Latest PR Test (Extra): 🚫 Run #41863403243
Latest PR Test (AMD ROCm 10): 🚫 Run #41863403198
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: