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 and the split-3 GEMM PR (this PR's own commit is the last one, +611 lines). The split-3 reduce + q/k/index RMSNorm + partial RoPE + NVFP4 K/V/index-K insert for the MiniMax-M3.1 TP4 QKV chain at 65-128 rows: sums the three fp32 slabs in the reduce's order, rounds to bf16 exactly as the unfused chain, then runs the norm / RoPE / insert arithmetic unchanged, one launch, with V workgroups that sum, quantize and pack runs through LDS (halo rows included). qkv_chain.py gets qkv_chain_insert (17-128 row dispatcher: the one-launch chain up to 64, split GEMM + reduce-insert above), code_rows and supported_split. Technique from amd-kernels' reduce_insert.py (attention/mxfp8_qkv_norm_rope_nvfp4_insert...), ported to aiter's insert helpers, no import.
Measured (graph replay, 8 rotated weights, us per layer of the whole sequence quant + GEMM + norm/RoPE/insert, MI355X, one GPU)
rows
this PR
amd-kernels entry
public (quant + gemm_a8w8_blockscale + fused_qknorm insert)
delta vs public
65
14.12
13.73
16.92
-2.8
72
13.92
13.93
17.35
-3.4
80
14.08
14.09
17.02
-2.9
81
14.59
14.40
17.05
-2.5
96
14.78
14.79
17.01
-2.2
97
15.57
15.58
18.44
-2.9
112
15.96
15.80
19.09
-3.1
128
16.09
16.15
19.79
-3.7
In-step (decode_bench --sim1, TP4 rank-0 shard on one GPU, ctx 100K, k=7, ATOM #3810 paired, flag ATOM_M3_QKV_CHAIN off vs on, ABAB x3, median step ms): B9 (72 rows) 12.474 -> 12.090 (-0.38), B12 (96 rows) 13.372 -> 12.943 (-0.43), B16 (128 rows) 14.810 -> 14.304 (-0.51); off-to-off spread 0.05-0.15 ms, on-to-on 0.1-0.28. Raw: off 12.474/12.480/12.474, 13.322/13.427/13.372, 14.724/14.930/14.810; on 12.090/11.915/12.197, 12.943/13.095/12.924, 14.311/14.304/14.198.
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
Bit-equal to the amd-kernels chain entry: q_out, index_q, KV pages and index pages, 0 differing bytes, at 65, 72, 80, 81, 96, 97, 112, 128 rows with all slots valid and with every third request skipped (slot -1) at 65, 81, 97, 128.
Tests
op_tests/test_flydsl_qkv_chain.py extended to 17-128 rows plus graph replay at m = 40 / 72 / 112 (67 tests pass together with the GEMM and quantizer tests, GPU, MI355X). black and ruff clean.
Review
Run by hand against .claude/skills/review-pr: perf claim has numbers (kernel and in-step), shapes and repro; the reduce-insert has no counters or cross-workgroup state (V join is a workgroup barrier), so no graph-capture hazard; buffer resources are sized from the token count and strides with host asserts; amd-kernels credited in the file headers, no import; raw inline-asm helpers (LDS access, MFMA) are shared with qkv_chain_cooperative as in #8607; legacy buffer_ops kept consistent with the stack.
…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]>
…n 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]>
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 8611 --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.
Extends the gfx950 MiniMax-M3.1 TP4 QKV decode chain to 65–128 rows, building on the stacked activation-quantizer and cooperative-chain work. The new path combines split-3 reduction, normalization, RoPE, and NVFP4 cache insertion without writing an intermediate bf16 QKV tensor.
Changes:
Adds fused reduce-and-insert processing after the split-K GEMM.
Dispatches 17–64 rows to the cooperative chain and 65–128 rows to the two-launch path.
Extends numerical comparisons and graph-replay tests across the decode range.
File
Description
op_tests/test_fused_qknorm_nvfp4_flydsl.py
Compares standalone inserts with HIP, including cache preservation.
op_tests/test_flydsl_qkv_chain.py
Tests the extended chain and graph replay.
op_tests/test_flydsl_mxfp8_quant_shuffled.py
Checks shuffled activation codes and scales.
op_tests/test_flydsl_mxfp8_gemm_decode_splitk.py
Tests split-K sums and graph replay.
aiter/ops/fused_qknorm_idxrqknorm.py
Adds standalone FlyDSL NVFP4 insert dispatch.
aiter/ops/flydsl/kernels/qkv_reduce_insert.py
Fuses slab reduction, normalization, RoPE, and cache insertion.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical issues allow out-of-bounds writes, reuse device-bound launch handles across GPUs, and misplace inserted values when slots are not consecutively ordered.
Read m from keyword arguments when it is not positional
aiter/ops/flydsl/kernels/qkv_chain.py:369
The dispatcher accepts **kwargs, but reads m only from the fifth positional argument. Calling it with the first four tensors positional and m=72 (or with all arguments named) raises IndexError before reaching either implementation, even though both implementations accept that calling convention. Please obtain m from the keyword arguments when it is not positional.
Add a pytest entry point so CI runs the split-K tests
This file has no script entry point, so Aiter CI imports it and exits successfully without running either test. .github/scripts/aiter_test.sh:97 defaults to python3 "$file", and this filename is not among its pytest exceptions. Please add the same pytest entry point used by the new quantizer and QKV-chain suites so the split-K numerical and graph-replay cases actually execute in CI.
Check per-token insertion coverage and compare iq during replay
op_tests/test_flydsl_qkv_chain.py:165
The batch-wide index-Q mean permits an entire row to be missing at m=128, and the page-wide 3% bounds likewise allow missing token inserts. The graph-replay test also omits iq from its snapshot and comparisons. Use an asserted FP32 checkAllclose result with justified per-element tolerances, check insertion coverage per token, and include iq in replay comparisons so a single missing row fails.
Closing: the split-3 reduce + norm / RoPE + NVFP4 insert (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.
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 and the split-3 GEMM PR (this PR's own commit is the last one, +611 lines). The split-3 reduce + q/k/index RMSNorm + partial RoPE + NVFP4 K/V/index-K insert for the MiniMax-M3.1 TP4 QKV chain at 65-128 rows: sums the three fp32 slabs in the reduce's order, rounds to bf16 exactly as the unfused chain, then runs the norm / RoPE / insert arithmetic unchanged, one launch, with V workgroups that sum, quantize and pack runs through LDS (halo rows included).
qkv_chain.pygetsqkv_chain_insert(17-128 row dispatcher: the one-launch chain up to 64, split GEMM + reduce-insert above),code_rowsandsupported_split. Technique from amd-kernels'reduce_insert.py(attention/mxfp8_qkv_norm_rope_nvfp4_insert...), ported to aiter's insert helpers, no import.Measured (graph replay, 8 rotated weights, us per layer of the whole sequence quant + GEMM + norm/RoPE/insert, MI355X, one GPU)
In-step (
decode_bench --sim1, TP4 rank-0 shard on one GPU, ctx 100K, k=7, ATOM #3810 paired, flagATOM_M3_QKV_CHAINoff vs on, ABAB x3, median step ms): B9 (72 rows) 12.474 -> 12.090 (-0.38), B12 (96 rows) 13.372 -> 12.943 (-0.43), B16 (128 rows) 14.810 -> 14.304 (-0.51); off-to-off spread 0.05-0.15 ms, on-to-on 0.1-0.28. Raw: off 12.474/12.480/12.474, 13.322/13.427/13.372, 14.724/14.930/14.810; on 12.090/11.915/12.197, 12.943/13.095/12.924, 14.311/14.304/14.198.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
Bit-equal to the amd-kernels chain entry: q_out, index_q, KV pages and index pages, 0 differing bytes, at 65, 72, 80, 81, 96, 97, 112, 128 rows with all slots valid and with every third request skipped (slot -1) at 65, 81, 97, 128.
Tests
op_tests/test_flydsl_qkv_chain.pyextended to 17-128 rows plus graph replay at m = 40 / 72 / 112 (67 tests pass together with the GEMM and quantizer tests, GPU, MI355X). black and ruff clean.Review
Run by hand against
.claude/skills/review-pr: perf claim has numbers (kernel and in-step), shapes and repro; the reduce-insert has no counters or cross-workgroup state (V join is a workgroup barrier), so no graph-capture hazard; buffer resources are sized from the token count and strides with host asserts; amd-kernels credited in the file headers, no import; raw inline-asm helpers (LDS access, MFMA) are shared withqkv_chain_cooperativeas in #8607; legacy buffer_ops kept consistent with the stack.Repro:
/shared_nfs/ygan/p1/070-decode-closers/gbin(t_g2.py, abab_g.sh).Generated with Claude Code