Skip to content

[FlyDSL] gfx950 MXFP8 bmm: accept 1x32 (OCP MX) weight scales - #6439

Closed
andrei-kochin wants to merge 1 commit into
ROCm:mainfrom
andrei-kochin:split/mxfp8-1x32-wscale
Closed

andrei-kochin wants to merge 1 commit into
ROCm:mainfrom
andrei-kochin:split/mxfp8-1x32-wscale

Conversation

@andrei-kochin

@andrei-kochin andrei-kochin commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Part 1 of 3 split out of #6060 (author: @sshlyapn), so each PR covers one concern.

#5896 added the gfx950 FlyDSL MXFP8 e8m0 GEMM/bmm, but only for square weight-scale blocks (32x32, 128x128, DeepSeek-V4/V4.1). OCP MX checkpoints such as MiniMax-M3 carry 1x32 weight scales (one e8m0 per weight row per 32 K), so they could not use it. This PR extends the same kernel, with no new kernel and no change to the 32x32 / 128x128 paths.

Resolves: #5916

Changes

  • 1x32 weight scales: w_scale [B, N, K/32] is accepted (W_SCALE_ROWS = (1, 32, 128)).
    The kernel reads the B-scale panel one row per B row, the same way it reads A's.
    This is wired through dispatch (_RUNNERS, gemm_a8w8_blockscale_bpreshuffle) and AOT.
    • The layout is row-major, the same as x_scale: no repack, independent of config.
    • A 1-row w_scale is accepted only with 32-wide K blocks; 1x128 is still rejected.
  • Tests:
    • test_flydsl_batched_gemm.py adds a 1x32 case (weight magnitudes change every row); each a8w8 candidate now gets its own weight and reference, so the square cases keep their block-wise coverage.
    • test_gemm_group32_interface.py routes 1x32, checks that 1x128 is still rejected, and checks 1x32 accuracy against a dequantized FP32 reference.

Related PRs

Tests

Results from #6060 (MI355, gfx950):

  • op_tests/test_gemm_group32_interface.py: passed.
  • op_tests/test_flydsl_batched_gemm.py, 1x32 / 32x32 / 128x128 a8w8: b in {1, 8, 16}, M from 1 to 16384, N=1024, K=4096; 0 cases with cos < 0.99.

The code in this PR is the 1x32 subset of #6060, unchanged; the _xcd4 1x32 accuracy cases move to the configs PR. black: clean.

Accept a 1x32 w_scale [B, N, K/32] (one e8m0 per weight row per 32 K) in
the gfx950 mxscale bmm, as OCP MX checkpoints such as MiniMax-M3 carry.
The kernel reads the B-scale panel one row per B row, the same way it
reads A's; the layout is row-major like x_scale, so no repack.

- W_SCALE_ROWS = (1, 32, 128); check_bmm_config allows a 1-row w_scale
  only with 32-wide K blocks.
- Wired through _RUNNERS, gemm_a8w8_blockscale_bpreshuffle and AOT.
- 32x32 / 128x128 are unchanged.
- Tests: a 1x32 case in test_flydsl_batched_gemm.py (weight magnitudes
  change every row, each a8w8 candidate gets its own reference);
  test_gemm_group32_interface.py routes 1x32, checks 1x128 is still
  rejected, and checks 1x32 accuracy against a dequantized reference.

Split out of ROCm#6060.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
@andrei-kochin
andrei-kochin requested review from a team and a balanced review from Copilot October 12, 2026 16:07
@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
ci:windows Windows JIT op smoke test on the gfx1201 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 6439 --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.

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.

🔵 Needs a closer look

The GPU kernel’s row-wise scale addressing and AOT specialization require final gfx950 validation.

0 open findings

What changed in this PR

Extends the gfx950 FlyDSL MXFP8 BMM path to support per-weight-row 1×32 E8M0 scales, including dispatch, AOT compilation, and correctness coverage.

Changes:

  • Adds 1×32 scale validation and row-wise kernel loading.
  • Wires the layout through runtime dispatch and AOT.
  • Adds routing and numerical tests across kernel configurations.
File Description
aiter/​ops/​flydsl/​kernels/​bmm_a8w8_mxscale_gfx950.py Implements 1×32 scale handling.
aiter/​ops/​flydsl/​batched_gemm_a8w8.py Registers gfx950 1×32 dispatch.
aiter/​ops/​flydsl/​batched_gemm_a8w8_gfx950.py Infers and validates row-wise scale shapes.
aiter/​ops/​batched_gemm_op_a8w8.py Documents the expanded BMM contract.
aiter/​aot/​flydsl/​gemm.py Adds AOT support for non-square 1×32 scales.
op_tests/​test_gemm_group32_interface.py Tests routing, rejection, and accuracy.
op_tests/​test_flydsl_batched_gemm.py Adds batched 1×32 benchmark coverage.

🧠 Review effort: Balanced


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

@andrei-kochin

Copy link
Copy Markdown
Contributor Author

Opened by mistake against the wrong PR; closing.

@andrei-kochin
andrei-kochin deleted the split/mxfp8-1x32-wscale branch October 12, 2026 16:41
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.

[Feature]: Centralized MXFP8 (E4M3 + E8M0 1x32) dense GEMM support

3 participants