Repository navigation
Add Kimi-K2 Thinking entry to per-model kernel benchmark sweep - #3431
Merged
Merged
Conversation
Add Kimi K2.6 (Kimi-K2 Thinking) to model_shapes.json so the per-model kernel sweep in op_tests/op_benchmarks/triton/model_benchmarking_tool exercises every aiter Triton kernel Kimi K2 hits in production serving (MLA projections, dense FFN, shared-expert FFN, 384-expert MoE GEMM, RMSNorm, RoPE, MHA prefill, MLA decode). Without this entry the sweep silently drops Kimi K2.6 and per-kernel regressions on Kimi go unnoticed even though the model is part of the active perf workload. Shape numbers were derived directly from the moonshotai/Kimi-K2-Thinking config.json: hidden=7168, dense intermediate=18432, moe_intermediate=2048, 64 heads, 384 routed experts, top_k=8, MLA q_lora=1536, kv_lora=512, qk_nope=128, qk_rope=64, v_head=128. Coverage is 13 kernels x 33 shapes. Add two regression tests in test_kernel_benchmarks.py: - test_kimi_k2_model_shapes_entry: no-GPU structural guard that fails immediately if the Kimi entry is removed or any hot-path shape changes silently. Asserts MLA (64,1,576,512), MHA (64,64,192,128), MoE (E=384, TopK=8, Dim1=7168, Dim2=4096) and the q_b/kv_b/o_proj GEMM shapes, plus that every declared kernel is in KERNEL_DICT and the --model kimi regex matches exactly one model. - test_bench_models_kimi_k2_rmsnorm_runs: end-to-end smoke that drives bench_models.run_benchmarks() through Kimi rmsnorm and asserts every row has positive throughput, validating the full path: JSON load -> model regex -> handler dispatch -> Triton kernel run. Verified passing on MI355X (ROCm 7.2, PyTorch 2.10, Triton 3.6): test_kimi_k2_model_shapes_entry PASSED test_bench_models_kimi_k2_rmsnorm_runs PASSED 2 passed, 3 deselected in 13.67s Full Kimi sweep at B=1, S=1024, TP=1 runs in ~17s on MI355X; a typical B in [1, 32, 128] x S in [1024, 8192] grid is ~1m40s. Co-authored-by: Claude (Cursor) <[email protected]> Co-authored-by: Cursor <[email protected]>
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
Collapse one-line list comprehension onto a single line so `psf/black@stable` (the CI pre-check) leaves the file unchanged. Co-authored-by: Claude (Cursor) <[email protected]> Co-authored-by: Cursor <[email protected]>
amd-ruitang3
approved these changes
Jun 15, 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.
Motivation
Add Kimi-K2 Thinking to model_shapes.json so the per-model kernel sweep in op_tests/op_benchmarks/triton/model_benchmarking_tool exercises every aiter Triton kernel Kimi K2 hits in production serving (MLA projections, dense FFN, shared-expert FFN, 384-expert MoE GEMM, RMSNorm, RoPE, MHA prefill, MLA decode). Without this entry the sweep silently drops Kimi K2 and per-kernel regressions on Kimi go unnoticed even though the model is part of the active perf workload.
Technical Details
Shape numbers were derived directly from the moonshotai/Kimi-K2-Thinking config.json: hidden=7168, dense intermediate=18432, moe_intermediate=2048, 64 heads, 384 routed experts, top_k=8, MLA q_lora=1536, kv_lora=512, qk_nope=128, qk_rope=64, v_head=128. Coverage is 13 kernels x 33 shapes.
Test Plan
Add two regression tests in test_kernel_benchmarks.py:
row has positive throughput, validating the full path: JSON load ->
model regex -> handler dispatch -> Triton kernel run.
Test Result
Verified passing on MI355X (ROCm 7.2, PyTorch 2.10, Triton 3.6):
test_kimi_k2_model_shapes_entry PASSED
test_bench_models_kimi_k2_rmsnorm_runs PASSED
2 passed, 3 deselected in 13.67s
Full Kimi sweep at B=1, S=1024, TP=1 runs in ~17s on MI355X; a typical B in [1, 32, 128] x S in [1024, 8192] grid is ~1m40s.
3 rows produced, all positive throughput (test passes):
{"Model": "Kimi-K2 Thinking", "Kernel": "rmsnorm", "batch_size": null, "seq_len": null, "M": 1024, "N": 7168, "throughput": 2.632281}
{"Model": "Kimi-K2 Thinking", "Kernel": "rmsnorm", "batch_size": null, "seq_len": null, "M": 1024, "N": 1536, "throughput": 0.845229}
{"Model": "Kimi-K2 Thinking", "Kernel": "rmsnorm", "batch_size": null, "seq_len": null, "M": 1024, "N": 512, "throughput": 0.312582}