Skip to content

[Config] [Perf] MiniMax-M3.1 TP4 lm_head BF16 (N50016 K6144) gfx950: exact-M rows for verify row counts and M 192-512 - #8598

Merged
yifehuan merged 1 commit into
ROCm:mainfrom
ganyi1996ppo:ganyi/minimax-m3-lmhead-bf16-rows
Nov 25, 2026
Merged

yifehuan merged 1 commit into
ROCm:mainfrom
ganyi1996ppo:ganyi/minimax-m3-lmhead-bf16-rows

Conversation

@ganyi1996ppo

@ganyi1996ppo ganyi1996ppo commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

MiniMax-M3.1 TP4 lm_head BF16 GEMM (N=50016, K=6144, gfx950, CU=256), exact-M rows in minimax_m3_eagle_bf16_tuned_gemm.csv (which already carries the other N=50016 rows). The DSpark verify step runs the lm_head at 8 x (accepted-draft batch) rows, i.e. M = 40, 48, 56, 96, 112 have no row today and fall back to a slow path; M = 64, 128, 256, 512 have rows that are much slower than what the same shape reaches with the picks below. M = 192 and 384 also had no row.

Config only: 11 rows (7 added, 4 replaced), no hipBLASLt rows (see #8490), no code.

Before / after (same lease, ABAB, 2 reps each, cold weights, CUDA-graph, median of 20 replays, MI355X gfx950)

"before" = aiter main (65f6f67b5) tuned tables; "after" = same tree plus these rows (AITER_CONFIG_GEMM_BF16 pointing at the merged public table with / without the rows, so only the row differs). tgemm.mm(x, w) public entry, w bf16 [50016, 6144], one GPU.

M before us after us change bits vs before rel err vs fp32 ref (before -> after) pick
40 174.9 105.6 -39.6% (-69.3 us) differs (split-K order) 0.0017 -> 0.0017 flydsl (no row before)
48 177.7 103.8 -41.6% (-73.8 us) differs 0.0017 -> 0.0017 flydsl (no row before)
56 179.0 104.5 -41.6% (-74.5 us) differs 0.0017 -> 0.0017 flydsl (no row before)
64 180.1 104.5 -42.0% (-75.6 us) differs 0.0017 -> 0.0017 flydsl (replaces flydsl 65)
96 184.8 120.3 -34.9% (-64.5 us) differs 0.0024 -> 0.0017 flydsl (no row before)
112 191.6 123.6 -35.5% (-68.0 us) differs 0.0025 -> 0.0025 flydsl (no row before)
128 195.0 130.8 -33.0% (-64.3 us) differs 0.0024 -> 0.0017 flydsl (replaces flydsl 62)
192 303.1 158.9 -47.6% (-144.1 us) identical 0.0017 -> 0.0017 torch native (no row before)
256 315.7 175.0 -44.6% (-140.7 us) identical 0.0017 -> 0.0017 torch native (replaces flydsl 30)
384 386.0 240.2 -37.8% (-145.7 us) identical 0.0017 -> 0.0017 torch native (no row before)
512 513.3 298.4 -41.9% (-214.9 us) identical 0.0017 -> 0.0017 torch native (replaces flydsl 8)

Rows for M = 1..32 (and 16/32 hipBLASLt candidates, 24) were evaluated and NOT added: the existing public rows are equal or faster (torch native at M = 16/24/32 measured +4..+8% slower than main). Rel err is vs an fp32 reference matmul; the 0.17-0.25% is the bf16 output rounding, same before and after. "differs" = a different split-K / tile order, identical error class.

Notes:

  • rel err and times use random N(0, 0.02) weights and N(0, 1) activations; kernels are public FlyDSL hgemm (kernelName is parsed by get_flydsl_hgemm_kernel_params, solidx is informational) and torch rows.
  • The ring GEMM of [FlyDSL] [CI] Add gfx950 small-M BF16 ring GEMM for lm_head-shaped GEMMs (M<=128) #8554 (ATOM_LM_HEAD_RING) covers M <= 128 when enabled; these rows serve the default path and M >= 129 (256/384/512 are prefill-side or large verify batches).
  • Rows come from the MiniMax-M3.1 TP4 tuning; every number above was re-measured in this lease. Raw log: /shared_nfs/ygan/p1/070b/ab.log, abt.log.

Expected effect

lm_head runs once per decode/verify step; verify steps at 5-14 requests (M = 40-112) save 65-75 us per step on the lm_head alone (about 0.6-0.9% of an 8-12 ms decode step, per ticket-069 step histograms). It is not a prefill-GEMM change.

Why these rows needed re-tuning

The existing gfx950 rows for N=50016, K=6144 come from #5145 (2026-09-03: M = 16 ... 32768 on a power-of-two-like grid plus 196 and 320) and #6079 (2026-10-02: M = 1 ... 8, triton). Two things follow:

  • The DSpark verify step runs the lm_head at 8 x (accepted-draft batch) rows, M = 40, 48, 56, 96, 112, which are not on that grid, so there is no row and the lookup falls back to the slow path (the "before" column above).
  • The rows that do exist at M = 64, 128, 256, 512 were tuned with September's kernel set and measurement setup. The table above shows a current pick is 33-48% faster at those M. Why the old picks are slower was not analysed here; the numbers above use cold weights and CUDA-graph replay.

The gfx1250 rows in the same file are for a different architecture and are not touched.

Review

Run by hand against .claude/skills/review-pr rules for a CSV-only diff: D3 (no hipblaslt rows added, 0 hits), no duplicate keys, all keys have gfx950,256, header unchanged, each added/replaced row exercised in the table above; no code, no test needed. No open findings.

🤖 Generated with Claude Code

…rows for verify/draft row counts and M 192-512

Add the exact-M rows for the lm_head shapes the DSpark verify step hits
(M = 40, 48, 56, 96, 112) and replace the weak M = 64, 128, 256, 512 rows,
plus M = 192 and 384 (previously no row, fallback path).

Co-Authored-By: Claude <[email protected]>
@ganyi1996ppo
ganyi1996ppo requested review from a team and a balanced review from Copilot November 24, 2026 15:32
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

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

Extended tests (opt-in via labels):

Label Tests
ci:mi300x Run Aiter standard tests on MI300X in PRs; main branch always runs them
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
ci:windows Windows JIT op smoke test on the Radeon R9700 ROCm runner
ci:multi-gpu 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: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
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 8598 --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.

Reviews:
A reviewer is usually assigned within one working day after the PR is ready for review (see Code Review Process). If nobody has responded for about a week, mention the area contact listed in CONTACTS.md. Want to help review? See REVIEWERS.md.

@aiter-bot

Copy link
Copy Markdown

WAITING ON AUTHOR

PR Self-Review

Revision 9b3864e9759b · mode shadow

Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision.

Questions to answer in the PR description

  1. What behavior does this PR change, and why is the existing behavior insufficient?
  2. What did you validate, and what remains unverified? Include commands, hardware/configuration and results.
  3. Which exact workload keys consume these configuration changes, and what evidence shows that unrelated shapes keep their previous selection?
  4. For every changed op_tests/ file, what behavior does it cover and why is it not redundant? Write None if no op test changed.

Edit the PR Self-Review section in the PR description. Include the current revision SHA; this comment refreshes automatically.

Missing or invalid answers

  • FAIL — missing ### Reviewed revision in the PR description
  • FAIL — missing ### Behavior and intent in the PR description
  • FAIL — missing ### Validation and unverified scope in the PR description
  • FAIL — missing ### PR-specific question in the PR description
  • FAIL — missing ### Changed op tests in the PR description
  • FAIL — Reviewed revision must contain at least the first 7 characters of the current head SHA
  • FAIL — Behavior and intent has no substantive answer
  • FAIL — Validation and unverified scope has no substantive answer
  • FAIL — PR-specific question has no substantive answer

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

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.

🟡 Changes recommended

The new tuned GEMM rows lack matching shapes in the companion untuned configuration, preventing their reproduction through model retuning from checked-in inputs.

1 open issue
What changed in this PR

Updates MiniMax-M3.1 TP4 BF16 lm_head tuning for N=50016, K=6144 on gfx950/256-CU GPUs, selecting existing backends to reduce latency without changing runtime code or APIs.

Changes:

  • Adds seven M-specific rows and replaces four existing selections.
  • Uses FlyDSL configurations for M=40–128 and Torch native selections at M=192, 256, 384, and 512.
  • Adds no saved hipBLASLt solution indexes, consistent with #8490.
File Description
aiter/​configs/​model_configs/​minimax_m3_eagle_bf16_tuned_gemm.csv Adds or updates 11 lm_head tuning rows for verify batches and larger row counts.

Review effort: Balanced

@yifehuan yifehuan 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.

LGTM

@yifehuan
yifehuan merged commit 8ca5a41 into ROCm:main Nov 25, 2026
70 of 77 checks passed
AndreasKaratzas added a commit to AndreasKaratzas/aiter that referenced this pull request Nov 26, 2026
Conflicts:
- gemm_a16w16_gfx950.py: take main's AOT-cache launch (ROCm#8565, ROCm#8600):
  bind_aot, _PARAM_ITEMS and _run_compiled with the sorted param items
  and the device as the specialization key. Keep this branch's fp32
  workspace argument, its one-counter get_split_k_buffers(stream,
  device) and its get_cu_num/buf_base_i64 imports. The param items now
  include this branch's split_k_resident and m_tail, so the AOT key
  covers the per-launch reduction choice.
- llama70B, minimax_m3_eagle tables: key-based 3-way merge. Take main's
  change where this branch did not touch a row. For minimax_m3_eagle
  128x50016x6144, which both sides changed, keep main's row (ROCm#8598,
  FlyDSL t128x256x64x3 ks1 w4x4x1, 119.9 us vs this branch's torch row
  at 135.0 us). It has no split-K and no slice-K, so this PR's
  reduction does not apply and it is exact. This follows the earlier
  merges, which kept main's row where main's non-split-K pick is faster.

Signed-off-by: Andreas Karatzas <[email protected]>
Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants