Repository navigation
[Config] small-M shapes for Kimi-K3 BF16 GEMMs for gfx950 - #5903
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
7aaa14a to
1d368cd
Compare
da45a90 to
853fdaf
Compare
The new tuned config row for this shape selects opus kernel 9 instead of the legacy 21177, which the exhaustive selection-diff test didn't yet account for. Co-Authored-By: Claude Sonnet 5 <[email protected]>
853fdaf to
603eeb1
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Some untuned shapes are inadvertently excluded from future tuning, and one claimed shape lacks a tuned entry.
3 open findings
What changed in this PR
Adds gfx950 BF16 GEMM tuning data for Kimi-K3, primarily targeting small-M decode workloads.
Changes:
- Adds new FlyDSL, ASM, and torch tuning selections.
- Expands the Kimi-K3 untuned shape inventory.
- Updates or removes existing tuning records.
| File | Description |
|---|---|
kimik3_bf16_untuned_gemm.csv |
Updates candidate shapes for future tuning. |
kimik3_bf16_tuned_gemm.csv |
Adds and replaces gfx950 tuned configurations. |
kimi_bf16_tuned_gemm.csv |
Removes one existing Kimi tuning record. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
yifehuan
left a comment
There was a problem hiding this comment.
LGTM, It's ok, Sorry for the late reply! Reverting the parity-test change was the right call, It doesn't matter
…ws on gfx950 (#8915) The rows of 6016 x 7168 and of 6288 x 7168 at 1, 2, 4, 8, 16 and 32 rows name the same tile with _bnt. They are older than the option (#5145, #6019 and #5903; the option is #7546), so the tuner never raced it for them. A decode step reads the weights of every layer once, and the tuner measures that: run_perftest gives every timed launch its own copy of the tensors. MI355X, one GPU, FlyDSL 0.5.3, the tuner's method (10 warm-up and 101 timed eager launches), 3 runs per kernel, the two kernels alternate, median, microseconds, row today -> _bnt: 1 x 6016 x 7168 16.31 -> 15.40 2 x 6016 x 7168 16.39 -> 15.53 4 x 6016 x 7168 16.46 -> 15.70 8 x 6016 x 7168 16.62 -> 16.02 16 x 6016 x 7168 17.93 -> 17.20 32 x 6016 x 7168 18.30 -> 16.93 1 x 6288 x 7168 16.78 -> 15.63 2 x 6288 x 7168 16.96 -> 15.57 4 x 6288 x 7168 17.00 -> 15.68 8 x 6288 x 7168 17.33 -> 16.27 16 x 6288 x 7168 18.34 -> 17.46 32 x 6288 x 7168 20.41 -> 19.68 That is 3.6 % to 8.2 % less time per launch. The six rows of 6016 x 7168 and the row of 32 x 6288 x 7168 were measured on main b4d0133. The other five rows were measured in a second session, on main 8b6b4b4 with those seven rows changed. solidx is the index of the new name in the tuner catalog; us, err_ratio, tflops and bw are the _bnt measurements. tgemm.mm selects these rows for 1 to 32 rows of both shapes. A caller that launches one weight tensor back to back while it fits the last-level cache can get slower. Measured with one weight tensor: +7.7 % for 32 x 6288 x 7168, +11.5 % and +12.8 % for 16 x 6016 x 7168, -3.9 % and -2.8 % for 32 x 6016 x 7168. The other nine rows were not measured in that state. Signed-off-by: Jin Pan <[email protected]>

Motivation
Tunes 51 additional bf16 GEMM shapes for Kimi K3 (
aiter/configs/model_configs/kimik3_bf16_tuned_gemm.csv), focused on small-M decode/low-concurrency shapes (M=1-256). Small M corresponds to decode (one new token per request per forward pass, or a few with speculative decoding), which is called on every generation step for the lifetime of every request - so this is where tuning has real impact for decode-latency-sensitive serving (interactive chat, agentic/tool-calling loops), unlike a single large-M prefill shape which is only hit once per request.Technical Details
kimik3_bf16_untuned_gemm.csv, so a future retune run correctly skips them instead of re-searching from scratch.Benchmark methodology - the canonical tuner script's
--run_configbenchmark mode (csrc/gemm_a16w16/README.md, "Common Options"):Test Plan
python3 -m unittest op_tests.tuning_tests.test_config_shape_collision -v- run against this exact diff.python3 -m pytest op_tests/test_opus_a16w16_policy_parity.py -q- run against this exact diff, rebased ontomain.checkAllclose(atol/rtol=0.05) against the torch reference during the--run_configbenchmark passes, both default and tuned.Test Result
test_config_shape_collision: 22 passed, clean for thebf16_tuned_gemmfamily.test_opus_a16w16_policy_parity: 19 passed, clean.status=OK)test_config_shape_collision)Submission Checklist