Skip to content

[Triton/Gluon] [Config] k3 gfx950 tuning bf16 tp8 shapes - #6019

Merged
nsusanto merged 2 commits into
mainfrom
k3-latent-moe-tail-bf16-gemm-configs
Oct 6, 2026
Merged

nsusanto merged 2 commits into
mainfrom
k3-latent-moe-tail-bf16-gemm-configs

Conversation

@nsusanto

@nsusanto nsusanto commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Perf tuning for Kimi K3 bf16 gemm kernels on gfx950 TP8 shapes. Includes multiple concurrencies configs and retunes several existing rows

Technical Details

Layer (TP8) Shape M Baseline us (kernel) Tuned us (kernel) Speedup
routed up_proj shard N=896 K=3584 8 7.58 (torch) 5.46 (flydsl) 1.39x
routed up_proj shard N=896 K=3584 16 7.44 (torch) 5.61 (flydsl) 1.33x
routed up_proj shard N=896 K=3584 32 8.79 (torch) 6.04 (flydsl) 1.45x
routed up_proj shard N=896 K=3584 48 8.58 (torch) 6.64 (flydsl) 1.29x
routed up_proj shard N=896 K=3584 64 8.75 (torch) 7.05 (flydsl) 1.24x
routed up_proj shard N=896 K=3584 80 10.04 (torch) 7.57 (flydsl) 1.33x
routed up_proj shard N=896 K=3584 96 10.08 (torch) 7.80 (flydsl) 1.29x
routed up_proj shard N=896 K=3584 128 10.12 (torch) 8.67 (flydsl) 1.17x
routed up_proj shard N=896 K=3584 256 12.04 (torch) 10.65 (flydsl) 1.13x
routed up_proj shard N=896 K=3584 512 15.52 (torch) 14.13 (flydsl) 1.10x
KDA f_b_proj N=1536 K=128 8 3.94 (torch) 2.68 (flydsl) 1.47x
KDA f_b_proj N=1536 K=128 16 3.92 (torch) 2.54 (triton) 1.54x
KDA f_b_proj N=1536 K=128 32 4.52 (torch) 2.73 (flydsl) 1.66x
KDA f_b_proj N=1536 K=128 48 4.73 (torch) 2.76 (flydsl) 1.72x
KDA f_b_proj N=1536 K=128 64 4.76 (torch) 2.63 (triton) 1.81x
KDA f_b_proj N=1536 K=128 80 4.23 (torch) 2.88 (flydsl) 1.47x
KDA f_b_proj N=1536 K=128 96 4.32 (torch) 2.87 (flydsl) 1.51x
KDA f_b_proj N=1536 K=128 128 4.32 (torch) 2.94 (flydsl) 1.47x
KDA f_b_proj N=1536 K=128 256 5.29 (torch) 3.11 (flydsl) 1.70x
KDA f_b_proj N=1536 K=128 512 5.38 (torch) 3.40 (flydsl) 1.58x
KDA f_b_proj N=1536 K=128 1024 5.52 (torch) 4.28 (flydsl) 1.29x
KDA f_b_proj N=1536 K=128 2048 6.53 (torch) 5.37 (flydsl) 1.21x
MLA fused_qkv_a_proj N=2112 K=7168 96 18.91 (torch) 15.05 (flydsl) 1.26x
KDA in_proj_qkvgfab N=6288 K=7168 8 22.43 (torch) 17.34 (flydsl) 1.29x
KDA in_proj_qkvgfab N=6288 K=7168 16 20.55 (torch) 18.43 (flydsl) 1.11x
KDA in_proj_qkvgfab N=6288 K=7168 32 22.04 (torch) 20.36 (flydsl) 1.08x
KDA in_proj_qkvgfab N=6288 K=7168 48 25.07 (torch) 22.60 (flydsl) 1.11x
KDA in_proj_qkvgfab N=6288 K=7168 2048 169.97 (torch) 157.52 (flydsl) 1.08x
KDA in_proj_qkvgfab N=6288 K=7168 4096 322.41 (torch) 286.47 (flydsl) 1.13x
shared-expert down N=7168 K=768 10240 274.93 (opus) 114.94 (flydsl) 2.39x
dense layer-0 down N=7168 K=4224 4096 196.76 (torch) 186.54 (flydsl) 1.05x
dense layer-0 down N=7168 K=4224 10240 666.42 (opus) 443.22 (flydsl) 1.50x

@nsusanto
nsusanto requested a review from a team September 30, 2026 18:13
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
multigpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 6019 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [HIP], [ASM], [CK], [OPUS] or [FlyDSL]. If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to stop the title rewrites; labels stay in sync either way.

@github-actions github-actions Bot changed the title [Triton] k3 gfx950 tuning bf16 tp8 shapes [Triton/Gluon] [Config] k3 gfx950 tuning bf16 tp8 shapes Sep 30, 2026
@Boss2002n
Boss2002n requested a balanced review from Copilot September 30, 2026 22:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

All six M_LEQ_2 profiles are unreachable, and one updated dispatch row records a substantial slowdown.

Review effort: Balanced
Findings: 7 Medium severity

Open (7)
What changed in this PR

Adds gfx950 BF16 Kimi K3 TP8 tuning data for A16W16 GEMM dispatch.

Changes:

  • Adds six shape-specific Triton configurations.
  • Expands the Kimi K3 tuning-shape manifest.
  • Refreshes model-level backend selections and measurements.
File Description
.../​GEMM-A16W16-N=7168-K=768.json Adds per-M Triton tuning.
.../​GEMM-A16W16-N=7168-K=4224.json Adds per-M Triton tuning.
.../​GEMM-A16W16-N=7168-K=1536.json Adds per-M Triton tuning.
.../​GEMM-A16W16-N=3072-K=512.json Adds per-M Triton tuning.
.../​GEMM-A16W16-N=2304-K=1536.json Adds per-M Triton tuning.
.../​GEMM-A16W16-N=1536-K=128.json Adds per-M Triton tuning.
kimik3_bf16_untuned_gemm.csv Adds Kimi K3 benchmark shapes.
kimik3_bf16_tuned_gemm.csv Updates and adds selected implementations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@zufayu
zufayu requested review from a team and vgokhale October 1, 2026 00:33
@nsusanto
nsusanto force-pushed the k3-latent-moe-tail-bf16-gemm-configs branch 2 times, most recently from 9b95109 to bfa55fa Compare October 1, 2026 16:16
@nsusanto
nsusanto force-pushed the k3-latent-moe-tail-bf16-gemm-configs branch from bfa55fa to 55b95b4 Compare October 1, 2026 17:16
@nsusanto
nsusanto merged commit 5b2fd3b into main Oct 6, 2026
@nsusanto
nsusanto deleted the k3-latent-moe-tail-bf16-gemm-configs branch October 6, 2026 18:17
yifehuan pushed a commit that referenced this pull request Dec 2, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants