You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stacked on #8606 / #8607 (the diff against main shows their commits; review the last one, +453 lines). A split-3 decode MXFP8 GEMM for the MiniMax-M3.1 TP4 QKV projection (N 2560, K 6144) at 65-128 rows: one-wave workgroups over RT 16-row x NI 16-column tiles of one K third, both operands in the (16, 16) preshuffled layout (the quantizer of #8606 writes the codes), W and A blocks issued ahead of the scaled MFMAs, odd-RT activation-scale re-pairing, output the fp32 slabs [3, m, 2560] that the reduce-insert of the next PR reads. Row configs: 65-80 rows (RT 5, NI 2), 81-96 (3, 4), 97-128 (4, 4). Technique from amd-kernels' decode GEMM (gemm/mxfp8_common/mxfp8_gemm_decode.py), ported to aiter's FlyDSL helpers, no import.
This PR has no consumer on its own: the slabs are read by the reduce-insert of aiter #8611, which is wired into ATOM by ATOM #3810. Open together.
Why
At 65-128 rows the public path (gemm_a8w8_blockscale on row-major codes) runs the GEMM at 9.7-11.7 us per layer while the (16, 16)-layout decode tiles with a K split run it at 8.1-9.1 us, and give the follow-up insert the fp32 partials directly.
Measured (graph replay, 8 rotated weights, us per layer, MI355X, one GPU)
rows
this PR
amd-kernels oracle
public aiter GEMM
delta vs public
65
8.19
8.04
9.76
-1.6
72
8.14
8.21
10.08
-1.9
80
8.21
8.18
9.83
-1.6
81
8.53
8.52
9.96
-1.4
88
8.60
8.56
9.84
-1.2
96
8.63
8.52
9.87
-1.2
97
9.04
8.99
11.00
-2.0
112
9.07
8.98
11.21
-2.1
128
9.12
9.08
11.71
-2.6
Combined gain of the QKV chain stack. Stage 1 (#8606, #8607, ATOM #3809, 17-64 rows) measured -0.24 to -0.69 ms per decode step at B3-B8 (in-step decode_bench --sim1, flag off/on ABAB). This stage (65-128 rows = B9-B16 at k=7) measures -0.38 to -0.51 ms per step (table below), so the chain covers B3-B16, the whole range that sets ITL p90. Not yet measured: a real 4-rank step or AgentX (sim1 has no all-reduce).
Numerics
Slabs bit-equal to the amd-kernels split-3 decode GEMM at 65, 72, 80, 81, 88, 96, 97, 112, 128 rows (all three slabs). Versus the public bf16 GEMM output: rel_l2 1.65e-3 (bf16 rounding of the public result vs fp32 slabs).
Tests
op_tests/test_flydsl_mxfp8_gemm_decode_splitk.py plus the chain tests of the paired PR: 67 passed (GPU, MI355X). black and ruff clean.
Review
Run by hand against .claude/skills/review-pr: perf claim has numbers, shapes and repro; buffer resources are sized from n_mbBMK / NK / mN4KS and host asserts guard rows, tiles and dtypes; no change to existing kernels or dispatch (new files); new files use the same legacy buffer_ops helpers as #8606/#8607 (AGENTS.md prefers buffer tensors for new code; kept consistent with the stack, to port later).
…Max-M3 TP4 prefill
Same bytes as the HIP kernel, 1.6-3.0x faster on device and 3.5x less host time per
call for calls of at least 1024 tokens (nvfp4 K/V/index-K, 16/1/1 heads, rotary 64,
gfx950). Ported from amd-kernels. AITER_FUSED_QKNORM_NVFP4_FLYDSL=0 keeps the HIP kernel.
Co-Authored-By: Claude <[email protected]>
…6) code layout + shuffled E8M0 scales
gfx950 FlyDSL quantizer: bf16 [M, K] -> fp8 e4m3 codes in the weight's (16, 16) preshuffled layout (rows padded to the row
tile, padding rows zero) plus E8M0 scales in AITER's shuffled layout, or row-major codes. One launch, a workgroup per
32-row x 256-K tile. Prerequisite of the one-launch QKV front chain (next PR): that kernel reads exactly these codes.
Technique source: amd-kernels gemm/mxfp8_common/mxfp8_quant.py and the scale/convert helpers of mxfp8_gemm_decode.py
(ported, no import). op_tests/test_flydsl_mxfp8_quant_shuffled.py compares codes and scales byte for byte against a torch
reference of the Triton MXFP8 rule (60 shape/magnitude cases).
Co-Authored-By: Claude <[email protected]>
…ode rows (TP4)
QKV MXFP8 GEMM (deferred split-3) + q/k/index-q/index-k RMSNorm + partial RoPE + NVFP4 K/V/index-K page inserts in ONE
launch: 240 five-wave workgroups, a head's 12 workgroups publish sc1 slabs and bump an epoch counter, the last roles reduce
and insert eight rows each. Replaces the three launches of the public decode path (quantize, GEMM, fused_qknorm_idxrqknorm)
for 17-64 rows. Host wrapper qkv_chain_cooperative_insert keeps counters per device/stream or HIP capture id.
Technique source: amd-kernels attention/mxfp8_qkv_norm_rope_nvfp4_insert_n2560_k6144_rot64_p128 (kernel_cooperative.py,
host.py) and the decode GEMM primitives of mxfp8_gemm_decode.py (ported, no import). Helpers come from the FlyDSL NVFP4
insert of ROCm#8576, activation codes from the quantizer of the previous commit.
Co-Authored-By: Claude <[email protected]>
…-128 rows, MiniMax-M3.1 TP4 QKV
One-wave workgroups over RT 16-row x NI 16-column tiles of one K third, both operands in the (16, 16) preshuffled layout,
W / A blocks issued ahead of the scaled MFMAs, odd-RT A scale re-pairing; writes the fp32 slabs a fused reduce-insert reads.
Bit-identical to the amd-kernels decode GEMM at 65..128 rows; graph replay 8.1-9.1 us vs 9.7-11.7 us for the public GEMM.
Technique source: amd-kernels gemm/mxfp8_common/mxfp8_gemm_decode.py (ported, no import).
Co-Authored-By: Claude <[email protected]>
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 8610 --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.
This pull request is a draft, so readiness evaluation is paused and no verdict applies. Evaluation resumes when it is marked ready for review and the required CI completes.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical input-validation and device/architecture dispatch gaps can produce incorrect results or invalid launches, while the default CI invocation executes neither added test.
Adds a gfx950 split-3 MXFP8 GEMM for MiniMax-M3.1 TP4 QKV decoding at 65–128 rows. It produces FP32 partial slabs for the follow-up reduce-and-insert PR; the broader diff also includes prerequisite quantization and QKV-chain work.
Changes:
Adds row-tiered GEMM configurations with prefetched operands and odd-row-tile scale handling.
Includes stacked shuffled quantization, fused QKV processing, and NVFP4 insert support.
Adds numerical comparisons and graph-replay tests.
File
Description
op_tests/test_fused_qknorm_nvfp4_flydsl.py
Checks NVFP4 insert parity and optional timings.
op_tests/test_flydsl_qkv_chain.py
Tests the cooperative QKV chain and graph replay.
op_tests/test_flydsl_mxfp8_quant_shuffled.py
Checks shuffled quantization codes and scale bytes.
op_tests/test_flydsl_mxfp8_gemm_decode_splitk.py
Tests split-GEMM numerics and graph replay.
aiter/ops/fused_qknorm_idxrqknorm.py
Adds conditional FlyDSL NVFP4 insert dispatch.
aiter/ops/flydsl/kernels/qkv_chain.py
Provides the cooperative-chain wrapper and counter storage.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The launcher can reuse compiled handles across GPUs, select the wrong device’s stream, and accept incompatible raw-pointer inputs, risking incorrect execution and corrupted results.
This suite has no runnable timing path, and the PR's reproduction scripts are on a private filesystem, so maintainers cannot reproduce the claimed row-tier latency improvement from this checkout. Please add the @benchmark/run_perftest sweep and summary table required by .claude/skills/aiter-op-test/SKILL.md, covering all three supported row tiers and the public GEMM baseline.
Closing: the split-K QKV GEMM (65-128 rows) is folded into the single QKV front PR #8607 (one op, tier by row count; the combined branch is being prepared there). The fork branch stays, so this can be reopened if needed.
…through the kernel, the reduce-insert and the tuned rows; tuner enumerates ks x tile; ROCm#8610's row-major split kernel merged in
Co-Authored-By: Claude <[email protected]>
…ch (1-64 rows) + split-K (65-128 rows) GEMM / norm / RoPE / NVFP4 insert (#8607)
* [FlyDSL] [Perf] fused_qknorm_idxrqknorm: FlyDSL NVFP4 insert for MiniMax-M3 TP4 prefill
Same bytes as the HIP kernel, 1.6-3.0x faster on device and 3.5x less host time per
call for calls of at least 1024 tokens (nvfp4 K/V/index-K, 16/1/1 heads, rotary 64,
gfx950). Ported from amd-kernels. AITER_FUSED_QKNORM_NVFP4_FLYDSL=0 keeps the HIP kernel.
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] mxfp8 activation quantizer for the decode GEMM tiers: (16, 16) code layout + shuffled E8M0 scales
gfx950 FlyDSL quantizer: bf16 [M, K] -> fp8 e4m3 codes in the weight's (16, 16) preshuffled layout (rows padded to the row
tile, padding rows zero) plus E8M0 scales in AITER's shuffled layout, or row-major codes. One launch, a workgroup per
32-row x 256-K tile. Prerequisite of the one-launch QKV front chain (next PR): that kernel reads exactly these codes.
Technique source: amd-kernels gemm/mxfp8_common/mxfp8_quant.py and the scale/convert helpers of mxfp8_gemm_decode.py
(ported, no import). op_tests/test_flydsl_mxfp8_quant_shuffled.py compares codes and scales byte for byte against a torch
reference of the Triton MXFP8 rule (60 shape/magnitude cases).
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] [Perf] one-launch MiniMax-M3.1 QKV front chain for 17-64 decode rows (TP4)
QKV MXFP8 GEMM (deferred split-3) + q/k/index-q/index-k RMSNorm + partial RoPE + NVFP4 K/V/index-K page inserts in ONE
launch: 240 five-wave workgroups, a head's 12 workgroups publish sc1 slabs and bump an epoch counter, the last roles reduce
and insert eight rows each. Replaces the three launches of the public decode path (quantize, GEMM, fused_qknorm_idxrqknorm)
for 17-64 rows. Host wrapper qkv_chain_cooperative_insert keeps counters per device/stream or HIP capture id.
Technique source: amd-kernels attention/mxfp8_qkv_norm_rope_nvfp4_insert_n2560_k6144_rot64_p128 (kernel_cooperative.py,
host.py) and the decode GEMM primitives of mxfp8_gemm_decode.py (ported, no import). Helpers come from the FlyDSL NVFP4
insert of #8576, activation codes from the quantizer of the previous commit.
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] [Perf] split-3 decode MXFP8 GEMM (fp32 K-third slabs) for 65-128 rows, MiniMax-M3.1 TP4 QKV
One-wave workgroups over RT 16-row x NI 16-column tiles of one K third, both operands in the (16, 16) preshuffled layout,
W / A blocks issued ahead of the scaled MFMAs, odd-RT A scale re-pairing; writes the fp32 slabs a fused reduce-insert reads.
Bit-identical to the amd-kernels decode GEMM at 65..128 rows; graph replay 8.1-9.1 us vs 9.7-11.7 us for the public GEMM.
Technique source: amd-kernels gemm/mxfp8_common/mxfp8_gemm_decode.py (ported, no import).
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] [Perf] split-3 reduce + norm / RoPE + NVFP4 insert, QKV chain for 65-128 decode rows (TP4)
Sums the three fp32 K-third slabs, rounds to bf16 and runs the norm / RoPE / NVFP4 K, V, index-K insert arithmetic of
fused_qknorm_idxr_nvfp4_insert in one launch (V in workgroups of its own through LDS); qkv_chain_insert serves 17-128 rows
(one launch to 64 rows, GEMM + reduce-insert above). Bit-identical to the amd-kernels chain at 65..128 rows; graph replay
13.7-16.3 us vs 16.9-20.0 us for quantize + public GEMM + fused_qknorm_idxrqknorm.
Technique source: amd-kernels attention/mxfp8_qkv_norm_rope_nvfp4_insert_n2560_k6144_rot64_p128 (reduce_insert.py, packing.py).
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] mxfp8 quantizer review fixes: bf16/contiguous input check, per-device compiled handle + x.device stream, whole-tile rule for rpw>2, op test entry point
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] qkv chain review fixes: operand validation (devices, dtypes, extents), per-device handle + stream, stricter page checks, op test entry point
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] [Perf] QKV front tier chosen by a tuned table: gemm_a8w8_qkv_front + deferred fused epilogue in fused_qknorm_idxrqknorm
The MXFP8 QKV projection of a decode layer is one interface (gemm_a8w8_qkv_front); a tuned row
(a8w8_mxfp8_qkv_front_tuned_gemm.csv, kernelId qkvfront) picks plain / one-launch chain (17-64 rows) / split-3 chain
(65-128 rows). A fused tier only quantizes in the projection and runs GEMM + norm + RoPE + NVFP4 insert inside the
fused_qknorm_idxrqknorm call on the same tensor. Whole-front tuner: op_tests/tune_gemm_a8w8_qkv_front.py.
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] qkv chain: row-major activation mode (a_row) for the one-launch tier and the front, to measure (16, 16) vs plain A
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] qkv front on row-major A only: drop the (16, 16) activation layout, the shuffled quantizer and code_rows; retune the one-launch lookahead; regenerate the tier rows
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] qkv front: split-K factor ks as a tuning config (1/2/3/4/6) through the kernel, the reduce-insert and the tuned rows; tuner enumerates ks x tile; #8610's row-major split kernel merged in
Co-Authored-By: Claude <[email protected]>
* drop the shuffled-A split-K op test (replaced by test_gemm_a8w8_qkv_front.py row-major split cases)
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] QKV front as one op: static tier by row count (17-64 one-launch, 65-128 split-K, ks a kernel parameter), no tuned table / tuner / config family; hand-off failure modes documented and checked; quantizer guard-byte and fused-vs-unfused bitwise tests
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] one-launch QKV front serves 1-16 rows too (RT=1 tile; no structural limit found), window 1-128
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] drop the closed#8576 FlyDSL insert and an unrelated import reorder from the QKV front branch
The QKV front kernels import only the device helpers of the FlyDSL NVFP4 insert, not the insert kernels. Keep those
helpers (qkv_front_common.py) and remove the rest: the decode and prefill FlyDSL insert kernels, their test, and the
FlyDSL route inside fused_qknorm_idxrqknorm (the NVFP4 insert stays the HIP kernel of #8472). Only the deferred QKV
front hook remains in fused_qknorm_idxrqknorm.py. bench_models.py goes back to main (an import reorder only).
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] QKV front review fixes: operand validation as exceptions, op-boundary shape / head checks, device-keyed split launches
- asserts that validated caller operands (shapes, dtypes, devices, strides, ranges, ks) are ValueError now, so
python -O keeps them; one _validate shared by the one-launch and split tiers (the split tier had fewer checks)
- the head set (16 / 1 / 1, rotary 64) and N 2560 / K 6144 are checked with a message naming the supported shape, at
gemm_a8w8_qkv_front and at both chain entries; ks outside (1, 2, 3, 4, 6) is rejected
- the split GEMM and the reduce-insert launches key the compiled handle by device and run under the operand's device
and stream (a handle reused on another device does not launch)
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] [Build] AOT prebuild of the QKV front kernels
aiter.aot.flydsl.qkv_front replays qkv_chain_insert on FakeTensors over 1-128 rows, bisected where the tile or tier
switches, so the one-launch kernels (16 / 32 / 48 / 64 rows), the split-K GEMM tiles and the reduce-insert are in the
prebuilt cache; registered in AOT_MODULES and the AOT README.
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] QKV front: drop stale skips (not-in-this-tree) and tuned-table wording from tests and comments
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] [Build] dry_run: the Event stand-in accepts record / synchronize
The QKV front's counter pool records and waits on a cuda Event on first use; under the AOT dry run the stand-in had
neither method, so the replay of qkv_chain_insert failed with AttributeError.
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] QKV front: document the slot_mapping run contract (consecutive slots per octet, no gapped or split-octet runs)
Co-Authored-By: Claude <[email protected]>
* [FlyDSL] qkv front _validate: require f32 k/v scales and non-overlapping uint8 KV pages
Harden the operand checks the raw-pointer launch depends on (Copilot review,
PR #8607):
- k_scale / v_scale: the kernels read the scalar via _gptr(..., T.f32, 4), so
require float32 with numel() >= 1; a 1-element bf16 scalar previously passed
but would be a 2-byte read reinterpreted as f32.
- kv_cache / index_cache: require uint8 and stride(0) >= full page footprint
(2*128*72 / 128*72). The kernels index pages by slot>>7, so an expanded or
overlapping page layout (e.g. stride(0)==0) would let distinct slots alias the
same page. dtype uint8 is now also enforced.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
* op_tests: consolidate gemm_a8w8_qkv_front tests into test_flydsl_qkv_chain.py (remove standalone file)
All chain and gemm_a8w8_qkv_front correctness cases are retained verbatim in the
single file; no coverage change (7 test functions / 257 parametrized cases before
and after). Shared `needs_gfx950` mark and `NB` constant deduplicated; the
standalone file is removed.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
---------
Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Stacked on #8606 / #8607 (the diff against main shows their commits; review the last one, +453 lines). A split-3 decode MXFP8 GEMM for the MiniMax-M3.1 TP4 QKV projection (N 2560, K 6144) at 65-128 rows: one-wave workgroups over RT 16-row x NI 16-column tiles of one K third, both operands in the (16, 16) preshuffled layout (the quantizer of #8606 writes the codes), W and A blocks issued ahead of the scaled MFMAs, odd-RT activation-scale re-pairing, output the fp32 slabs
[3, m, 2560]that the reduce-insert of the next PR reads. Row configs: 65-80 rows (RT 5, NI 2), 81-96 (3, 4), 97-128 (4, 4). Technique from amd-kernels' decode GEMM (gemm/mxfp8_common/mxfp8_gemm_decode.py), ported to aiter's FlyDSL helpers, no import.This PR has no consumer on its own: the slabs are read by the reduce-insert of aiter #8611, which is wired into ATOM by ATOM #3810. Open together.
Why
At 65-128 rows the public path (
gemm_a8w8_blockscaleon row-major codes) runs the GEMM at 9.7-11.7 us per layer while the (16, 16)-layout decode tiles with a K split run it at 8.1-9.1 us, and give the follow-up insert the fp32 partials directly.Measured (graph replay, 8 rotated weights, us per layer, MI355X, one GPU)
Combined gain of the QKV chain stack. Stage 1 (#8606, #8607, ATOM #3809, 17-64 rows) measured -0.24 to -0.69 ms per decode step at B3-B8 (in-step
decode_bench --sim1, flag off/on ABAB). This stage (65-128 rows = B9-B16 at k=7) measures -0.38 to -0.51 ms per step (table below), so the chain covers B3-B16, the whole range that sets ITL p90. Not yet measured: a real 4-rank step or AgentX (sim1 has no all-reduce).Numerics
Slabs bit-equal to the amd-kernels split-3 decode GEMM at 65, 72, 80, 81, 88, 96, 97, 112, 128 rows (all three slabs). Versus the public bf16 GEMM output: rel_l2 1.65e-3 (bf16 rounding of the public result vs fp32 slabs).
Tests
op_tests/test_flydsl_mxfp8_gemm_decode_splitk.pyplus the chain tests of the paired PR: 67 passed (GPU, MI355X). black and ruff clean.Review
Run by hand against
.claude/skills/review-pr: perf claim has numbers, shapes and repro; buffer resources are sized from n_mbBMK / NK / mN4KS and host asserts guard rows, tiles and dtypes; no change to existing kernels or dispatch (new files); new files use the same legacy buffer_ops helpers as #8606/#8607 (AGENTS.md prefers buffer tensors for new code; kept consistent with the stack, to port later).Repro:
/shared_nfs/ygan/p1/070-decode-closers/gbin(t_g1.py, run_pytest.py).Generated with Claude Code