Repository navigation
[Fix] gemm: Keep Kimi-K3's tiny GEMM shapes on SIMT at every batch size - #48732
Merged
Merged
Conversation
Since #47683 the tiny GEMM switches from the SIMT to the MMA kernel at a batch size picked per shape, and a row's result depends on the batch through that switch. Kimi-K3 runs its KDA gate and router projections through it (kimi_k3_tiny_gemm: 144x7168 and 1536x128 for the [f_a | b] and f_b gates, 896x7168), so a bs=1 decode row (SIMT) and the same token's row in an 8-token speculative verify (MMA) no longer round alike. test_kimi_k3_b300_low_latency.py::test_bs_1_speed has failed on every PR run against main since #47683 with the same accept length, 3.459 against the 4.0 threshold. Pin the three Kimi-K3 shapes to SIMT, as 128x512 already is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
/rerun-test registered/e2e/models/test_kimi_k3_b300_low_latency.py::TestKimiK3B300LowLatency.test_bs_1_speed registered/kernels/ops/gemm/test_tiny_gemm.py |
Contributor
|
🚀 🚀 |
Fridge003
marked this pull request as ready for review
November 6, 2026 00:03
Fridge003
requested review from
BBuf,
DarkSharpness,
HaiShaw,
HydraQYH,
celve and
yuan-luo
as code owners
November 6, 2026 00:03
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.
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.
Motivation
test/registered/e2e/models/test_kimi_k3_b300_low_latency.py::TestKimiK3B300LowLatency::test_bs_1_speed(NV Extra,extra-b-test-8-gpu-b300) fails deterministically on PRs tested against current main: the accept length is 3.4594594594594597 against the 4.0 threshold, on both retries and on every PR.PR runs of this test, by the main commit CI merged each PR onto:
b147f4aa101305b1830a89b26413813fa242f27cc03b6b3df506c60f412aThe only PR that still passes on these bases is #48468 (FlashInfer 0.7.3), which changes the MXFP4 MoE runner Kimi-K3 uses and so changes its numerics anyway.
Of the main commits in
b147f4aa10..1305b1830a, only #47683 reaches Kimi-K3's TP8 + DSpark decode path:--linear-attn-decode-backend cutedsl; this test uses triton.#47683 makes the tiny GEMM switch from the SIMT to the MMA kernel at a batch size picked per shape. Each kernel alone is batch invariant, but a row's result depends on the batch through that switch. Kimi-K3 runs its KDA gate and router projections through
kimi_k3_tiny_gemm:So the same token's gates round differently in decode and in speculative verify.
Modifications
Pin the three Kimi-K3 shapes to SIMT at every m in
_TUNED_MMA_MIN_M, as128x512already is. Other tiny GEMM callers (DeepSeek routers, DeepSeek-V4.1, beam, dots3) use other shapes and are unchanged.Validation
Draft until confirmed: I had no free B300 to bisect on, so the root cause above comes from elimination plus the dispatch rule.
/rerun-testof the failing test on this PR decides it.🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #42121183518
Latest PR Test (Extra): ❌ Run #42121183956
Latest PR Test (AMD ROCm 10): ❌ Run #42121183357
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: