Repository navigation
[FlyDSL] gfx950 MXFP8 bmm: accept 1x32 (OCP MX) weight scales - #6439
andrei-kochin wants to merge 1 commit into
Conversation
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]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
There was a problem hiding this comment.
🔵 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.
|
Opened by mistake against the wrong PR; closing. |
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
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.x_scale: no repack, independent of config.w_scaleis accepted only with 32-wide K blocks; 1x128 is still rejected.test_flydsl_batched_gemm.pyadds 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.pyroutes 1x32, checks that 1x128 is still rejected, and checks 1x32 accuracy against a dequantized FP32 reference.Related PRs
main).main._xcd4.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
_xcd41x32 accuracy cases move to the configs PR. black: clean.