Repository navigation
[FlyDSL] pa_decode: MXFP4 K/V on gfx1250 (MTP, sliding window, query splits) - #7923
Conversation
Extend the MXFP4 KV-cache decode (e2m1 data + e8m0 scale per 32 elements,
head_dim 128, page 128, query_length 1, up to 16 query heads per KV head)
from gfx950 to gfx1250, with the same pa_decode API, views and numerics:
e4m3 Q (or bf16 Q normalized per row, the scale's exponent on the WMMA B
scale), bf16 P and V, P shifted by 2**-20.
Gfx1250Mxfp4Pipeline: four wave32 waves each own 64 tokens of a 256-token
tile and all dims, so the tile loop has no barrier; the waves merge once
through LDS. Raw K/V rows load straight into WMMA operand order one tile
ahead, page ids two tiles ahead.
- QK: one V_WMMA_SCALE_F32_16X16X128_F8F6F4 per 16 tokens, A = e2m1 K rows
with their e8m0 dwords, B = e4m3 Q (layouts measured on gfx1250 B0).
- V: dequantized by the same scaled WMMA against e2m1 identity blocks: exact
in f32 and transposed (lane = dim), i.e. the bf16 PV A operand after a pack.
v_cvt_scale_pk8_{f32,f16,bf16}_fp4 ignore their data operand on gfx1250
with FlyDSL 0.5.0, and the gfx950 v_cvt_scalef32_pk_bf16_fp4 does not
exist there. The eight identity operands are windows of two 14-dword rows.
- Dim tiles dequantize in groups of four before packing, so the dequant
WMMAs overlap; the O rescale is skipped when no row's maximum grew.
- Output: plan-free (one CTA per sequence), packed partials for the reducer,
or the gfx1250 cluster merge (2..16 tasks per sequence) instead of it.
Tests: the MXFP4 cases of test_flydsl_pa_decode.py now run on gfx1250 too
(66 pass, incl. extreme-scale, 128k peaked, graph and NaN/Inf unowned rows);
the full file passes on gfx1250 (298 passed, 94 skipped).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
…per-token KV gfx1250 MXFP4 KV now takes MTP query lengths, sliding windows and query splits; MXFP4 KV is per-token KV on both architectures. - Rows: a CTA owns (query positions of its split) x (GQA heads) rows in 16-row M-tiles, each row masking its own causal and window bounds. Every M-tile reuses the tile's V dequantization; only QK, softmax and the bf16 PV WMMAs repeat per M-tile. Tiles at the causal edge or a window start mask; others run unmasked. - query_splits: positions split across CTAs through block_id.y as on the other gfx1250 paths. By default a CTA keeps at most 32 rows (two M-tiles: 441 VGPRs, no spills; G16 x MTP4 splits in two); at most 64 are allowed. G16 x MTP4 verify, us for splits 1/2/4: B3 x 32k 12.88/10.57/11.15, B3 x 225k 25.13/23.77/27.69. - Sliding window: plans cover the window union as before; plan-free CTAs start at the first tile their positions can see. - Per-token KV: MXFP4's e8m0 bytes are each row's scales, so its kernels are requested with per_token_kv=True (gfx950's schedule keys it so instead of refusing it). On both architectures the kernel keeps the f32 per-token scale path off and either flag selects the same kernel: the gfx950 MXFP4 ISA is unchanged (5 specializations cross-compiled and diffed against the base). - Wrapper: query rows are context_lengths x query_length; windowed plans must match the window and query length; the reducer and scratch take query_length x group rows. gfx950 still refuses MTP and windows. Tests: gfx1250 MXFP4 cases for MTP 2-4 (groups 1/4/8/16, contexts below the query length), windows 1..1000 with and without MTP (planned and plan-free), forced query_splits 1/2/4, MTP graph replay and 2 KV heads; MTP4 unowned-row poisoning; the per-token classification; refusals of 80-row CTAs and windowed plans of another query length. Full file on gfx1250: 321 passed, 94 skipped. Single-token decode is unchanged (A/B within 0.05 us). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A gfx1250 MXFP4 CTA with several query M-tiles (G16 x MTP4 splits into two CTAs of 32 rows, 441 VGPRs) fits two to a CU, so a default plan (2 x CU tasks) runs its split CTAs in two rounds, each paying a task's load latency and epilogue over only a couple of tiles. Measured: one CTA per task costs about 3 us before its first tile and 0.6 us a tile alone, and halving the plan budget made MTP4 15-20% faster. When the tasks times the query splits exceed two CTAs a CU (bounded by the batch's tile count), a CTA now runs two plan slots (fuse_tasks=2): a sequence's adjacent tiles run as one task whose partial is the first slot's, the second slot gets an empty partial (max -inf, sum 0) for the reducer, and pairs across sequences run one after the other. Single-token decode, cluster merges and plan-free calls never fuse; their kernels are ISA-identical. G16 x MTP4, default plan, us (A/B interleaved): B3 x 8k 7.44 -> 7.44 (not fused), B3 x 32k 10.55 -> 9.98, B8 x 32k 14.5 -> 13.0, B3 x 225k 23.7 -> 23.4, B32 x 8k 15.2 -> 13.8. Tried and dropped (slower): FP8 P and V in PV (PV costs ~0 of MTP4), a wave per M-tile over LDS-staged K/V (4x the V dequantization), an async global-to-LDS K/V ring (decode and MTP both slower), occupancy hints (spills). Tests: two MTP4 cases with 80 sequences (one windowed) that fuse; full file on gfx1250: 322 passed, 94 skipped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve conflicts with #7619 (gfx1250 wide steps, shared clusters, MTP4) and #7709 (gfx942 schedule tuning). - gfx1250_tile_traits also selects MXFP4 tiles: direct_output becomes plan_free, per_token_kv is off, query splits default to mxfp4_gfx1250_query_splits, and latency_grid stays off (no page16 stages). compile_gfx1250_pa_decode(t) validates the MXFP4 limits on the traits and refuses cluster_steps/cluster_runs/cluster_seqs for MXFP4. - Gfx1250Traits keeps plan_free/fuse_tasks after the new fields, which the selection passes positionally. - Kernel: the fuse_tasks branch is unchanged; its else holds main's task selection plus the plan-free tasks and the MXFP4 pipeline. - Host: cluster kernels now read work as context lengths and take run_tiles, so MXFP4 cluster launches pass context_lengths and 0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
zhiding512
left a comment
There was a problem hiding this comment.
FlyDSL PA review (automated harness)
Verdict: CHANGES_NEEDED · head 97b22a4156 · base = merge-base e3931369ce
No FP8/BF16 regression on gfx1250 (their ISA is identical). The new MXFP4 path passes every test on gfx1250, but the fuse_tasks heuristic slows down windowed and ATOM-style MTP calls, and several of the PR's speedup claims do not reproduce once the KV cache is rotated out of the MALL.
Performance and correctness
| arch | machine | status | verdict | key numbers |
|---|---|---|---|---|
| gfx1250 | MI450 container, 256 CUs, FlyDSL 0.5.0 both sides | done | no regression in FP8/BF16; MXFP4 perf issues (code review 1, 3) | geomean time ratio head/base: prod 104 cases 0.999, unit 325 1.003 (60 MXFP4 cases run on head only), grid 1467 0.997, claims 36 1.000. 0 cases lost on head. All 1851 shared cases have bit-identical outputs. FP8/BF16 ISA identical: 306 kernels from the unit set, plus 46 from the two prod-set shards that finished before the GPU hang. pytest: base 306 passed / 159 skipped, head 395 / 94, 0 new failures |
| gfx950 | MI355X | not verified | - | the harness container was unreachable. CI (MI35X) at this head: test_flydsl_pa_decode.py 427 passed / 62 skipped. No ISA check here. The PR reports gfx950 MXFP4 ISA identical for 5 specializations |
| gfx942 | MI308X | not verified | - | the harness container was unreachable. Code reading only: gfx942 still refuses MXFP4, and every shared change is MXFP4-gated or defaulted |
About the gfx1250 A/B: with the 2.5% band, 104 cases come out slower and 134 faster, with ratios between 0.90 and 1.14. Most are short latency-bound cases: median 6.4 us, 90% under 11 us. The kernels are ISA-identical and the outputs bit-identical, and a same-code control in the same session (two head-tree workers) spread 0.97-1.07. So this is noise, not a regression. The slower cases were not re-measured at 30 pairs, because the GPUs then hit a KFD hang that has nothing to do with this PR. The trigger was fp32 hipBLASLt faults in the test's reference GEMM when two workers built cases on one GPU at once. Those crashes hit base and head alike, and every affected case was re-run serialized and passed.
PR claims, re-measured on gfx1250. These use the head tree only, with the PR's shapes: G16, 1 KV head, D128, page 128, bf16 Q, default plan, tight max_context_length, FP8 with per-token scales. Times are in us. The harness rotates KV copies (at least 512 MB) so each call reads cold KV.
| B x ctx (q1) | FP8 measured (PR) | MXFP4 measured (PR) | MXFP4 vs FP8, measured | claimed |
|---|---|---|---|---|
| 1 x 8192 | 4.83 (5.04) | 5.50 (4.94) | 0.88x | 1.02x |
| 8 x 8192 | 5.76 (5.52) | 6.26 (5.49) | 0.92x | 1.01x |
| 32 x 8192 | 9.23 (7.51) | 9.06 (6.83) | 1.02x | 1.10x |
| 64 x 8192 | 14.74 (10.75) | 11.70 (8.95) | 1.26x | 1.20x |
| 128 x 8192 | 26.24 (24.11) | 21.11 (14.42) | 1.24x | 1.67x |
| 4 x 32768 | 8.61 (6.36) | 7.56 (6.35) | 1.14x | 1.00x |
| 16 x 65536 | 26.19 (23.97) | 18.77 (13.55) | 1.40x | 1.77x |
| 3 x 225280 | 18.50 (14.90) | 14.26 (10.79) | 1.30x | 1.38x |
-
The large-shape speedups do not reproduce. Measured 1.24x and 1.40x against the claimed 1.67x and 1.77x.
- BF16 KV is 537 MB at B128 x 8K and at B16 x 64K, and there our times match the PR's: 38.6 vs 38.4 us and 38.0 vs 37.1 us.
- MXFP4 KV is 92-142 MB at B128 x 8K, B16 x 64K and B3 x 225K, and there our times are 32-46% higher than the PR's.
This pattern suggests the PR's numbers were taken with KV resident in the MALL. Please say whether the KV was rotated, and re-measure cold.
-
At B1 and B8 x 8K, MXFP4 is 8-12% slower than FP8 here. The PR claims parity. See code review 3 for a likely cause.
-
MTP4 without a window: MXFP4 is slower than FP8 at all five table-2 shapes. The gap is 11-46% (B3 x 8K 7.77 vs 7.02 us, B32 x 8K 16.01 vs 10.93 us), not 8-17% at three shapes. MTP2 and window-4096 decode reproduce in direction: MTP2 B3 x 225K gives 1.41x (claimed 1.37x); window 4096 gives 1.10-1.26x (claimed 1.19-1.37x).
-
MXFP4 MTP4 + window 4096 is 12.3-12.6 us at B3 x 32K, B8 x 32K and B3 x 225K, against the claimed 7.2-7.9 us. At B3 x 8K it is 7.57 us, which matches the claim. See code review 1.
-
The FP8 baselines in table 2 predate the merge with main. FP8 MTP4 + window 4096 measures 16.3-16.7 us against the claimed 11.3-11.9 us. FP8 code and ISA are identical between base and head, so this difference does not come from this PR.
Code review
-
[major]
fuse_tasksfires on the length bound, not on the tiles a call can actually have (pa_decode.py:386-395).max_tasks = min(capacity, num_seqs * ceil(schedule_context_length / 256))ignores the sliding window. It also takesmax_context_lengthat face value, and ATOM passes the block-table capacity there. When the bound overstates the tiles, the few real tasks get paired and run serially. For MXFP4,max_context_lengthchanges nothing else in the selected tile (gfx1250_tile_traitsuses it only for FP8/BF16 stages), so the slowdown below comes from the fuse alone. Measured on the head tree, G16 MTP4 MXFP4, default plan:- Window 4096: B3 x 8K does not fuse and runs in 7.57 us. B3 x 32K and B3 x 225K read the same 4K-token window, but
max_tasksis 384 and 512, so they fuse and take 12.5 and 12.3 us. That is 1.65x slower, and slower than the PR's own 7.25 us, which was measured before commit 4 added fusing. - ATOM-style
max_context_length= 128K table: B3 x 8K goes from 7.77 to 10.05 us (+29%).
Suggestion: bound the per-sequence tiles by the window, as the FP8/BF16 path already does (
window_tilesatpa_decode.py:1051-1056). Also consider deciding the fuse on the device from the plan's live task count, since the host cannot know real lengths without a sync. A test pinningfuse_tasks == 1for a windowed long-context case would keep this from coming back. - Window 4096: B3 x 8K does not fuse and runs in 7.57 us. B3 x 32K and B3 x 225K read the same 4K-token window, but
-
[major]
gfx1250-strict(MI450 A0) gets the new MXFP4 kernel without validation (pa_decode.py:246,:713).chip_info._detect_nativesays strict maps to the gfx1250 family "only at explicitly validated dispatch sites". The PR states that A0 was not run, and that the A0 erratum on scaled WMMAs insideS_CLAUSEwas not checked. Meanwhile the tests skip MXFP4 ongfx1250-strict(arch not in ("gfx950", "gfx1250")), so production calls on A0 run an untested kernel. Suggestion: refuse MXFP4 ongfx1250-strictuntil the ISA has been checked against the erratum and the tests run there. -
[minor] With a default plan, MXFP4 never takes the on-chip cluster merge (
pa_decode.py:369-379).partitions = min(work_plan.max_partitions, capacity)equals the CU count (256) for a default plan, so2 <= partitions <= 16never holds and every planned call launches the reducer. FP8/BF16 first bound partitions byceil(max_context_length / 256)and by the window, and merge up to 32 partitions with 16-CTA clusters (pa_decode.py:1046-1124). So at B1-B32 x 8K FP8 merges on chip while MXFP4 pays a second launch. The comment "As for FP8/BF16 on gfx1250" and the PR text ("sequences with 2..16 tasks merge within a workgroup cluster") do not match what runs. This plausibly explains the 0.88x and 0.92x rows above. That attribution comes from code reading only; it was not isolated by experiment. -
[minor] Conflicts with #7401.
git merge-treereports textual conflicts intraits.py,pa_decode_kernel.pyandtest_flydsl_pa_decode.py. #7401 also appendsquantized_output,output_scaleandquant_rowsafterrun_tilesin the gfx1250 tile kernel's launch signature. The new positional MXFP4 gfx1250_run_compiled(...)call (pa_decode.py:461-481) does not pass them.pa_decode.pyitself merges cleanly, so whichever PR lands second would only find the mismatch at runtime. The PR merges cleanly onto current main, and #7864 does not conflict. -
[nit] Misleading refusal message (
traits.py:248-251). The check is stillarch != "gfx950", but the message now says "requires gfx950 or gfx1250". Called with gfx1250, it prints "requires gfx950 or gfx1250; got gfx1250".PaDecodeScheduleis the gfx942/gfx950 schedule; say so, and point gfx1250 togfx1250_tile_traits. -
[process]
- The PR body's "Reviewed revision" is
aa93dff0f, not the head (aiter-bot flags it). - CI runs only on MI35X, so none of the roughly 60 new gfx1250 MXFP4 cases run in CI. They do pass on gfx1250 in this run: head pytest 395 passed, 0 failed.
- The PR body's "Reviewed revision" is
Method
- A/B design. Paired ABBA A/B on gfx1250. Two worker processes share one GPU, one per tree, each building cases with its own tree's
op_tests/test_flydsl_pa_decode.py::_run_pa_decode_case(that tree's reference check included). Each worker captures a CUDA graph of 10 ATOM-style calls with explicit output and plan scratch, rotating at least 512 MB of KV copies to defeat the MALL. Each case uses 3 memory layouts, 12 pairs x 8 replays. Ratio = head / base. - Sets.
- prod: ATOM's route, FP8 per-tensor, page 16, default plan (D256: 64/256),
max_context_length= 128K table plus bounded twins. - unit: every valid test parameter.
- grid: every non-MXFP4 test geometry x B{1,16,64} x {1K,8K,32K}.
- claims: the PR's FP8/BF16 rows.
- prod: ATOM's route, FP8 per-tensor, page 16, default plan (D256: 64/256),
- Verdict rule. slower = median ratio > 1 + band with at least 90% of pairs slower in every layout. The band is max(2.5%, A/A spread); the A/A control was base vs base on prod, 88 cases, 1-99% spread 1.9%.
- Serialized builds. Workers were run with builds serialized after the hipBLASLt faults described above. Timing is unchanged by this.
- MXFP4 claims. Measured head vs head, since base refuses MXFP4 on gfx1250. The time is the mean of both workers.
- ISA. FlyDSL final ISA dumps, instruction streams hashed and compared as multisets, compile cache off.
- Environment. torch 2.11.0+rocm10.1.0a, FlyDSL 0.5.0 (both sides).
Conflicts with #7401 (fused FP8 output quantization): - pa_decode_kernel.py: the gfx1250 tile body is main's (quant_output, pad_output, pad_grid) under the fused-task branch, with the MXFP4 plan-free task and pipeline dispatch re-applied. - traits.py: main's quant_output/store_output precede the PR's plan_free and fuse_tasks; MXFP4 keeps its own LDS size. - MXFP4 tiles refuse quant_output (pa_decode already does), and the positional MXFP4 gfx1250 launch passes the new quantized_output, output_scale and quant_rows arguments. Co-Authored-By: Claude Opus 5.5 <[email protected]>
zhiding512
left a comment
There was a problem hiding this comment.
Follow-up: remaining measurements and second review pass
Head 97b22a4156, same gfx1250 box (MI450, 256 CUs, FlyDSL 0.5.0). The GPU hang that cut the first run short has cleared, so the measurements it left open are done. They confirm code review 1 and the MALL explanation, find no FP8/BF16 regression, and turn up one more issue with the fuse rule.
Measurements the first review left open
-
FP8/BF16: no regression. The 104 cases flagged slower at 12 pairs were re-measured at 30 pairs: 100 same, 3 faster, 1 slower (
unit|bf16-cluster8, 1.032). That one did not hold up: a repeat gave 0.996, head against head gave 0.962, and with base and head swapped the base came out slower (1.022). All 104 outputs are bit-identical. The prod-set ISA comparison now covers all 104 cases, and the ISA is identical. -
Forcing
fuse_tasks=1confirms code review 1. Same case, the wrapper's choice againstfuse_tasks=1, interleaved in one process (G16, MTP4, MXFP4, 1 KV head, default plan). Times in us:case wrapper (fuses) fuse_tasks=1window 4096, B3 x 32K 12.68 7.71 window 4096, B8 x 32K 12.81 8.41 window 4096, B3 x 225K 12.52 7.61 no window, 128K table bound (ATOM style), B3 x 8K 10.07 7.86 no window, tight bound, B3 x 32K 11.49 12.24 no window, tight bound, B8 x 32K 15.10 16.75 no window, tight bound, B32 x 8K 16.10 17.74 Fusing pays where it was designed to (the last three rows, 6-10%), so it is worth keeping. It is the trigger that needs to change.
-
The large-shape speedups depend on the MALL. Same shapes, q1, with KV rotated over at least 512 MB (cold) and with one resident copy (warm). Times in us:
B x ctx FP8 cold / warm MXFP4 cold / warm PR FP8 / MXFP4 128 x 8192 26.25 / 25.65 21.01 / 15.14 24.11 / 14.42 16 x 65536 26.18 / 25.51 18.08 / 14.20 23.97 / 13.55 Warm, MXFP4 lands within 5% of the PR's numbers, and the speedup matches the claim: 1.69x against 1.67x, and 1.80x against 1.77x. The 264 MB FP8 caches miss either way, while the 136 MB MXFP4 caches stay resident. Cold, the speedups are 1.25x and 1.45x. In a full model the other layers' KV reads evict each layer's cache between steps, so the cold numbers are closer to serving. Please state the cache condition next to the table, or add cold numbers.
-
The merge with main did not change MXFP4. Pre-merge
aa93dff0fagainst the head on the 28 MXFP4 claim cases (same harness, same test builder): every output is bit-identical, and the time ratios are 0.96-1.02 (geomean 0.999). So the window slowdown predates the merge, and so does the gap to the PR at B1 x 8K (5.4 us here at both revisions, 4.94 us in the PR). The head's gfx1250 pytest run (395 passed) already covers the merged cluster path. What is left is bookkeeping: please update "Reviewed revision" to the head, and re-run the gfx950 ISA cross-compile there.
New in this pass
-
[minor] The fuse trigger also misses shapes where fusing pays (
pa_decode.py:395).max_tasks * splits > 2 * num_compute_unitsmatches the point the PR measured: 32-row CTAs, two per CU, one KV head. The grid, though, iscapacity x (kv_heads * query_splits), and the> 16rows gate also admits CTAs with 3 or 4 M-tiles. With one split and the default budget,max_tasks * 1is at most 512 (for B up to 512), which never exceeds 2 x 256 CUs, so those shapes never fuse. Measured at B8 x 32K, tight bound, default plan. Times in us:shape rows per CTA (splits) wrapper: no fuse fuse_tasks=2MTP3 x G16 48 (1) 15.56 13.44 MTP5 x G8 40 (1) 16.32 13.20 MTP7 x G8 56 (1) 18.41 14.89 MTP5 x G12 60 (1) 18.07 14.97 MTP4 x G16, 2 KV heads 32 (2) 22.82 20.93 That leaves 8-19% unused. With 4 KV heads, forcing the fuse changed nothing (within 1%). MTP6 x G16 (48 rows, 2 splits) does fuse and saves 26% (22.48 against 30.46 us).
Together with code review 1, the rule fires on windows and table-capacity bounds, where fusing hurts, and stays off here, where it helps. Basing it on the tiles a task really gets, and on how many CTAs of that M-tile count fit on a CU, would cover both. A benchmark or test with 3-M-tile CTAs and with 2+ KV heads would keep the threshold honest.
-
[nit] The docstring's "at most 32 rows by default" is not what the split does (
pa_decode.py:617).mxfp4_gfx1250_query_splitsfalls back to the largest of 1/2/4 that dividesquery_length. So MTP3/6 x G16 keep 48 rows, MTP5/7 x G8 keep 40/56, and MTP5 x G12 keeps 60. MTP5/7 x G16 (80/112 rows) are refused.- Every accepted shape above passes the test's reference check here, with an np7 plan, the default plan, plan-free, and window 300. Only the wording needs fixing.
- Adding MTP5 x G8 or MTP5 x G12 to
_MXFP4_GFX1250_CASESwould cover multi-M-tile CTAs whose last M-tile is partly filled.
-
[minor] A GPU-free guard was dropped. Commit
55273278cremovedtest_pa_decode_mxfp4_is_per_token_kv. Without a GPU, it checked thatPaDecodeSchedule.selectkeys MXFP4 as per-token whilePaDecodeTraits.createkeeps the f32 per-token scale path off, which is what keeps the gfx950 MXFP4 kernel unchanged. What is left (test_flydsl_pa_decode.py:2326) only checks that the host passesper_token_kv=True, and CI has no ISA check. Consider restoring theselect/createhalf. -
[nit] Most of the kernel diff is re-indentation. Of the +432/-210 lines in
pa_decode_kernel.py, only +242/-20 remain with whitespace ignored. Thefuse_tasks > 1branch re-indents main's task-selection block, and that is what makes the #7401 conflicts large. Handling the fused case first and leaving main's block at its indentation would shrink both.
Method
- The re-measurement, the ISA comparison and the pre-merge A/B use the same paired harness as the first review: two worker processes on one GPU, 3 memory layouts, ABBA pairs (30 pairs for the re-measurement).
- The fuse, MALL, row-count and KV-head experiments run the head tree in one process.
- Each case and its variant are built by the test's
_run_pa_decode_case, including its reference check, then captured as CUDA graphs of 10 ATOM-style calls and timed interleaved (12 rounds x 8 replays over 3 layouts). fuse_tasksis forced through the compile arguments the wrapper passes; the launch grid follows it.
- Each case and its variant are built by the test's
- The row-count and KV-head runs were repeated, and the two runs agree within about 1%.
|
#7401 landed on main ( The conflicts will not show the part most likely to break. MXFP4 has no quantized output (the wrapper already refuses it), so passing what the FP8/BF16 caller passes with quantization off should be enough: MI35X CI skips every gfx1250 MXFP4 case, so it will not catch a slip here. Please run the gfx1250 MXFP4 tests after rebasing and post the counts; the harness will re-check the new head. |
- Fused MTP tasks follow the plan's live tasks: a fuse_tasks=2 CTA reads the live count from reduce_info with its slots and runs two slots only when live tasks x KV heads x splits exceed two CTAs per CU; otherwise CTA b runs slot b. The host compiles the fusing kernel when the length bound, now within the sliding window and counting KV heads, allows it. Cold KV, G16 MTP4: window 4096 B3 x 32k 11.7 -> 6.7 us; 128K-table bound B3 x 8k 9.7 -> 8.0 us; two KV heads B8 x 32k 21.1 -> 19.6 us. - Default plans merge in a cluster as on the FP8/BF16 path (partitions bounded by the length bound and window, up to 32 over 16-CTA clusters). Residency counts query splits. Single-token decode uses a cluster only with at most 16 tiles a sequence or clusters that fill the CUs: B1 x 8k keeps the reducer (5.5 us against 5.9 us). Cold KV: MTP4 B8 x 8k 8.4 -> 7.1 us, MTP2 B32 x 8k 10.3 -> 9.4 us. - gfx1250-strict (MI450 A0) refuses MXFP4 in pa_decode and compile_pa_decode_tile: it was not run there, nor checked against A0's S_CLAUSE erratum for scaled WMMAs. - PaDecodeSchedule's MXFP4 refusal says the schedule is gfx950-only and points gfx1250 to gfx1250_tile_traits. - Tests: fused cases take 256 sequences; new loose-bound fusing, windowed long-context (fuse_tasks == 1, cluster 16), decode cluster and reducer pins, and the gfx1250-strict refusal. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The LDS merge of a CTA's waves used to merge and store one M-tile at a time. The stores' row checks and lane-masked max/sum stores split each tile into its own basic blocks, so every tile's LDS loads waited behind the previous tile's stores: four serial ~500-cycle merges for a 64-row wave-pair CTA. `merge_rows` now merges all M-tiles first, and `store_rows` stores them afterwards. Only a part-filled M-tile checks its rows. All eight threads of a row store its (equal) maximum and sum, so no exec mask is needed. Per-wave partial stores drop their half-wave mask the same way. Cold KV, MXFP4 (us): G16 x MTP4 B3 x 8k 6.96 -> 6.73, B3 x 32k 9.37 -> 9.17, B32 x 8k 11.64 -> 11.46; MTP4 with a 128K bound B3 x 8k 8.24 -> 8.00; MTP2 B8 x 32k 10.28 -> 9.76. Single-M-tile decode is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Latency-bound MXFP4 decode lost to FP8 mostly in the merge of its token-split waves. Each wave held a 16 x 128 partial O over 64 tokens, and the CTA merged the four through 32 KB of LDS and a barrier. An ablation that dropped the V dequant entirely still lost B1 x 4k (4.7 against 4.0 us). With wave dims (`run_dims`), wave w still scores its own 64 tokens. It now dequantizes dim block w (32 dims) of all 256 tokens of the tile, and runs its PV against every wave's P'', which the waves exchange through LDS once a tile: - Four tokens' 16-byte block slices pack into one E2M1 A operand, so the identity dequant stays at 32 WMMAs a wave, with one running S a wave. - Each P'' is relative to its source wave's running maximum. Wave w therefore keeps one accumulator per (source wave, dim tile) and rescales it by that wave's alpha. - The end exchanges the rows' (max, sum) and combines the accumulators in registers. Each wave stores its own 32 dims in the existing partial format. At 522-532 VGPRs one CTA fits a CU, so the host uses dims for one-M-tile clusters whose CTAs all run in one round: - Single-token decode then takes the cluster instead of the reducer. - Cluster runs apply to dims decode. - Dims replace per-wave partials from 8-CTA clusters. Cold KV, G16 decode (us, MXFP4 before -> after, FP8): | Shape | before | after | FP8 | |-------|-------:|------:|----:| | B1 x 4k | 4.81 | 4.01 | 4.01 | | B4 x 4k | 4.88 | 4.10 | 4.26 | | B4 x 8k | 5.86 | 5.17 | 5.22 | | B8 x 8k | 5.84 | 5.29 | 5.42 | | B16 x 8k | 6.17 | 5.56 | 6.30 | Throughput-bound decode keeps its path (B32 x 8k with dims: 10.5 against 7.7 us). Co-Authored-By: Claude Opus 5.5 <[email protected]>
G16 x MTP4 splits its 64 query rows over two 32-row CTAs. Each CTA dequantizes the whole V for its half of the rows. An ablation that skips the dequant saves 1.2 us at B32 x 8k (11.5 us). When the call's clusters fit one round with one 3-4 M-tile CTA a CU, and give each CTA at least 8 tiles, the host now runs each sequence and KV head as one such CTA instead. It dequantizes V once, and cluster sizing then counts one split. The host passes its query split to the compile, so the kernel's default cannot disagree. Cold KV (us, MXFP4 before -> after, FP8): | Shape | before | after | FP8 | |-------|-------:|------:|----:| | MTP4 B64 x 8k (4-CTA clusters) | 17.35 | 16.00 | 17.21 | | MTP4 B128 x 8k (2-CTA clusters, not the reducer) | 29.72 | 25.99 | 31.10 | | 2 KV heads, B32 x 8k | 17.66 | 16.41 | 17.23 | | 2 KV heads, B64 x 8k | 29.76 | 26.38 | 31.22 | | 4 KV heads, B16 x 8k | 17.88 | 16.47 | 17.60 | | 4 KV heads, B32 x 8k | 29.90 | 26.22 | 30.94 | With 4 tiles a CTA the splits still win (B32 x 8k: 11.5 against 11.7 us), so those calls keep them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… conflicts The wave pairs' per-page V'' swap and the wave dims' P'' exchange stored each lane's 8-dword WMMA operand at a 32-byte lane stride. That makes every 128-bit LDS store and load 2-way bank-conflicted. They now store the operand as two 16-byte halves at a 16-byte lane stride, in the same 1 KB slot (`lds_store_operand` / `lds_load_operand`). Cold KV (us, MXFP4 before -> after): - G16 decode B2 x 8k 5.18 -> 5.02 (FP8 5.00); B1 x 8k 5.01 -> 4.96; B4 x 8k 5.16 -> 5.11. - G16 x MTP4 B3 x 225k 23.23 -> 23.02; B16 x 16k 12.50 -> 12.39. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lection tests Remove `test_pa_decode_mxfp4_gfx1250_strict_refused` and `test_pa_decode_mxfp4_is_per_token_kv`, as requested in review. Co-Authored-By: Claude Opus 5.5 <[email protected]>
zhiding512
left a comment
There was a problem hiding this comment.
FlyDSL PA review (automated harness), round 4
Verdict: changes needed · head d371a58aac · base = merge-base db3b870ea1 (main afc300d7 has no newer PA commits)
This round covers rounds 3-7 of the PR (6e6de7f38 … d371a58aa): FP8 PV, wave pairs, wave dims, per-wave partials, whole-CTA MTP and the reducer bound. FP8/BF16 is unchanged on every arch I could check. MXFP4 has three correctness problems, though. One of them already fails the MI35X CI (gfx950).
Performance and correctness
| arch | machine | verdict | key numbers |
|---|---|---|---|
| gfx942 | MI308X, 80 CUs | PASS | Geomean time ratio head/base: prod (104 cases) 1.000, unit (367) 1.002, grid (2016) 1.000, claims (FP8 rows) 1.000. No case lost on head. The first pass flagged 5 grid cases at 3.5-4.5% over a 3.0% band. At 30 pairs they measure 0.981-1.009, and 0.981-1.008 with base and head swapped: noise. ISA: all 236 kernels identical. pytest: base 414 passed / 128 skipped, head 414 / 165, 0 new failures. |
| gfx1250 | MI450 | not verified on hardware | The harness container on the MI450 host has been down for ~35 h, and the host's 4 GPUs were running other jobs. Compile-only instead ( ARCH=gfx1250 COMPILE_ONLY=1, every unit case plus the 104 prod cases, from both trees): all 280 base kernels (FP8/BF16 tiles, reducers, planner) compile to identical ISA in head. The 56 head-only kernels are all MXFP4 tiles.The PR's cold-KV claims were not re-measured this round. Round 3 reproduced them at 31628751e. |
| gfx950 | MI355X | not verified on hardware | The harness host was unreachable (ssh timeout). Compile-only, same case list: 276 of 279 kernels are identical (all tiles, the planner, and the FP8/BF16 reducers). The 3 that differ are MXFP4 reducer rungs (np40 / np80 → np5 / np64), i.e. finding 1 below. MI35X CI on 0f8a5533a failed test_pa_decode[mxfp4-short-bound-np2] ("Tensor-likes are not close", shard 0, 1 failed / 510 passed). The head has the same code, and its CI was still building when I wrote this. |
Findings
-
[blocker] The MXFP4 reducer now drops partitions when a context exceeds
max_context_length. This is a gfx950 regression against main, and it already fails CI.- Since round 4 (
24c5d6750),_pa_decode_mxfp4passesmax_partitions = min(plan max_partitions, capacity, seq_tiles)to the reducer, whereseq_tilescomes from the length bound (L529, L774). Main usedmin(work_plan.max_partitions, capacity), with the comment "a task may own more tokens than it". - The plan, though, splits the real length.
plan_pa_decode([1024], 1, max_partitions=2)gives the sequence 2 tasks; I ran the planner to check. A bound of 128 then selects the np1 reducer. - The reducer handles at most NP live partials. Called directly with 2 live partials (O = 0 and O = 1, equal max and sum), it returns 0.5 at
max_partitions=2and 0.0 atmax_partitions=1(shared reducer, run on gfx942). - This is exactly what
mxfp4-short-bound-np2tests ("the reducer must merge both partials, whatever the bound"). Thepa_decodedocstring still promises the same for MXFP4: "A real context longer than that bound is still fully attended". - Suggested fix: keep
min(work_plan.max_partitions, capacity)for the MXFP4 reducer. If the FP8-style contract (contexts ≤ bound) is intended for MXFP4 too, change the docstring and the test together, and note it as a behaviour change on gfx950.
- Since round 4 (
-
[major] Per-wave partials can write past the scratch (gfx1250, MTP with clusters that shrank).
wave_partials(L611-617) guards only4 * num_seqs * cluster_merge <= capacity. That guard assumes sequence s starts at slots * cluster_merge.- Without cluster runs (any window, or no
max_context_length), the cluster kernel takesfirstfrom the plan'sreduce_info.store_wavethen writes slottask_slot * 4 + warp(pipeline.py L4467), and the merge readsfirst * 4onwards (pa_decode_kernel.py L1670). - When MTP shrinks the cluster below the plan's tasks per sequence,
firstruns ahead ofs * cluster_merge. - Checked with the PR's own planner and host rules (256 CUs, default plan, capacity 512):
- G16 × MTP8 with window 4096 at B10 × 4k compiles
cluster_merge=8, wave_partials=True, query_splits=4. The plan gives every sequence 16 tasks, and the last sequence starts at slot 144, so its waves write slots up to (144 + 7) · 4 + 3 = 607 > 511. - B12 × 8k (G16 or G12 × MTP8) reaches slot 779.
- G16 × MTP8 with window 4096 at B10 × 4k compiles
- With 1 KV head that is an out-of-bounds write. With more KV heads it overwrites the next head's partials.
- Suggested fix: index wave partials by
seq * cluster_merge + part, or require the plan's per-sequence count to equal the cluster size.
-
[major] The whole-CTA and wave-pair rules can build CTAs of more than 64 rows, so MTP shapes the docstring supports now raise (gfx1250).
- The whole-CTA rule (L536) checks only
40 < query_length * group. The pairs rule (L604) checks only> 40, after whichgfx1250_tile_traitsforcesquery_splits = 1. - Host-checked (256 CUs, default plan):
- G16 × MTP6 at B3 × 32k and B8 × 32k (default split 2 × 48 rows):
ValueError: wave_pairs requires one split of 33-64 MXFP4 rows. - G16 × MTP8 at B64 × 8k (whole rule, 128 rows):
NotImplementedError: … at most 64 query rows. - G16 × MTP8 at B16 × 8k with ATOM's 128K-table bound: the same wave_pairs ValueError.
- G16 × MTP6 at B3 × 32k and B8 × 32k (default split 2 × 48 rows):
- The docstring says MTP positions split by 1/2/4 until a CTA keeps ≤ 32 rows (≤ 64 allowed), so these should run. Both rules need
query_length * group <= MXFP4_GFX1250_MAX_ROWS. - Add one MTP6 × G16 case and one MTP8 case: the suite currently stops at MTP5.
- The whole-CTA rule (L536) checks only
-
[minor] Tokens before the window start still raise S_b.
- In the masked tile, only tokens past the context get their V scales zeroed (pipeline.py L3666 / L4283). Tokens of the first tile that lie before the window start keep theirs. They then enter the wave's running S_b for the rest of the sequence, although their P is 0.
- A large out-of-window V scale therefore costs every later in-window token of that 32-dim block mantissa bits (V'' flushes to 0 once the spread reaches about 2^19).
- Zeroing those rows' scales as well would make the masked tile consistent.
Notes
- Numerics on gfx1250 MXFP4. P is now E4M3 (FP8 PV) and the tests compare at 1.5e-2, against 5e-3 elsewhere, so gfx1250 and gfx950 MXFP4 no longer agree numerically. An end-to-end accuracy check (e.g. GSM8K on the MXFP4-KV model) before ATOM routes gfx1250 MXFP4 here would close this out. Not blocking.
- Tests. Dropping
test_pa_decode_mxfp4_gfx1250_strict_refusedleaves the A0 refusal, which stays in the code, without a test. A one-linepytest.raiseswithget_gfx_runtimepatched togfx1250-strictwould keep it covered. The per-token assertion still lives in the main case runner. - Review state. All seven earlier threads are resolved, thanks. #8365 (draft, gfx1250 NVFP4 MXFP8 output) touches the same five PA files, so whichever lands second needs a rebase.
- Method. Paired base/head A/B on the same GPU, 3 memory layouts, ≥ 512 MB of KV rotated per graph. ATOM-style launches with explicit plan scratch. The noise band comes from an A/A run.
zhiding512
left a comment
There was a problem hiding this comment.
FlyDSL PA review (automated harness), round 4 addendum: gfx1250 on hardware
Verdict: changes needed (unchanged) · head d371a58aac · base = merge-base db3b870ea1 · MI450 (gfx1250, 256 CUs), FlyDSL 0.5.0
The round-4 review could not run gfx1250 on hardware. The MI450 harness container is back, so this addendum adds the hardware results for the same head.
- FP8/BF16 is unchanged on gfx1250.
- Findings 1-4 of round 4 stand. Finding 2 now crashes the GPU, and finding 3 reproduces as written.
- There is one new performance finding (5).
Performance and correctness (gfx1250)
| check | result |
|---|---|
| FP8/BF16 vs base | PASS. 2604 paired A/B cases. Geomean time ratio head/base: prod 0.988, unit 0.978, grid 1.005, claims (FP8 rows) 0.989. No case lost on head. The first pass flagged 265 cases over a 2.5% band, mostly under 20 µs. At 30 pairs they measure a geomean of 0.988, and 1.007 with base and head swapped. One case stays above the band in both orders: unit|fp8-torch.float16-per-tensor-plain-v-mtp4-g16-page128-varied, 6.3 µs, +3.7% / +7.4%. Its case definition and ISA are identical in both trees, so I count it as tiny-kernel noise: a head-vs-head control on this box spreads up to 7% below 6 µs.ISA: all 433 base kernels (unit + prod) compile identically in head. The 56 head-only kernels are all MXFP4. pytest: base 368 passed / 174 skipped, head 470 / 109, 0 new failures. The 37 added tests pass, and so do the four mxfp4-short-bound-* cases. |
| MXFP4 claims (head only; main refuses MXFP4 on gfx1250) | 42 of the 44 claimed MXFP4-vs-FP8 ratios reproduce within 10%. MXFP4 is faster than FP8 in 34 of the 47 measured pairs. Not reproduced: decode B128 × 8k measures 1.30× against 1.53× claimed (MXFP4 20.4 µs against 16.9 claimed; FP8 26.4 against 25.9). Window decode B3 × 8292 measures 1.65× against 2.04× claimed. That gap comes from FP8, which is faster here (8.8 against 10.9 µs); MXFP4 matches (5.32 against 5.33). |
MXFP4 against round 3 (31628751e, same box) |
Geomean 0.933 over 122 cases. Slower, confirmed at 30 pairs and in swapped order: - B1 × 128k with max_partitions=8: +30-33% (48.6 → 64.3 µs), with bf16 or e4m3 Q. See finding 5.- e4m3 Q with one or two partitions: +6-10%. mxfp4-np1 11.1 → 12.2 µs, mxfp4-plan-free-e4m3-q 11.3 → 12.0, mxfp4-short-bound-reducer 69 → 76, B1 × 32k np2 30.5 → 33.1. At the same shapes bf16 Q changes by 1-2%. At np1 the compile flags are the same as in round 3, so the cost is in the e4m3-Q tile body. |
| Round-4 findings on hardware | Finding 2: G16 × MTP8 with window 4096 triggers a GPU memory access fault in pa_decode_tile_kernel_kvmxfp4_qbf16_d128_bs128_gqa16_mtp8_sw4096_qs4_cluster8_wp at B10 × 4k and B12 × 8k. G12 × MTP8 at B12 × 8k faults too, as does B12 × 8k with 2 KV heads. With 2 KV heads at B10 × 4k it returns wrong values instead: 0.9-2.5% of the elements are off, max abs diff 0.06 against 0.015 allowed.Finding 3: G16 × MTP6 at B3 / B8 × 32k, and G16 × MTP8 with the 128K bound at B16 × 8k, raise ValueError: wave_pairs requires one split of 33-64 MXFP4 rows…. G16 × MTP8 at B64 × 8k raises NotImplementedError: … at most 64 query rows a CTA.Finding 1 is gfx950-only. The gfx1250 path passes mxfp4-short-bound-np2 and two probes with a bound below the context. MI35X CI on d371a58aa fails test_pa_decode[mxfp4-short-bound-np2] again (shard 0: 1 failed, 507 passed). |
New finding
- [minor, perf] Wave dims are chosen for clusters whose CTAs run many tiles.
dims_cluster(L563) only checks that the clusters fit in one round, andwave_dims(L623) follows it whenever wave partials are off.- With a capped plan, B1 × 128k at
max_partitions=8gives an 8-CTA cluster with 128 tiles a CTA.- Head compiles
cluster_merge=8, wave_dims=True; round 3 compiledcluster_merge=8without dims. - The call goes from 48.6 to 64.3 µs (+32%). That holds for both Q dtypes and both data patterns, at 30 pairs and with the order swapped.
- Head compiles
- The default plan at the same shape doesn't change: it uses no cluster and measures 7.5 µs. B1 × 8k (a 16-CTA cluster, about 4 tiles a CTA) gains, as the comment says.
- Limiting wave dims to clusters with few tiles a CTA (
seq_tiles / cluster_merge) would keep the short-context gain without the long-CTA loss.
Notes
- Speed of e4m3 Q. Only callers that pass an e4m3 query and few partitions see the +6-10%. The PR's tables use bf16 Q, where nothing regressed. It's worth a look if ATOM is going to quantize Q before the call.
- Method. Same harness as round 4, on 2 of the MI450's 4 GPUs (the other two were running other jobs). Case builds were serialized per worker. Claims are head-only absolute times with a cold-KV rotation of at least 512 MB.
- Reducer: take the plan's partition cap again. The plan splits the real length, so a bound below the context dropped partials (gfx950 mxfp4-short-bound-np2). - Cluster runs: the cluster's last CTA also runs the tiles past the runs, so a context longer than the bound is attended in full. Its run end is chosen before the context length's wait. - Wave partials: slots start at seq * cluster_merge, the range the host bounds by the scratch. A shrunk MTP cluster wrote past it. - Whole CTAs and wave pairs take at most 64 query rows. - Masked tiles zero the V rows and scales of tokens before every row's window start, so they no longer raise S_b. - Wave dims take at most 4 tiles a CTA (B1 x 128k, max_partitions=8: 68.4 -> 52.6 us). - Tests: ten cases, each failing before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the round-4 review and the MI450 addendum. All five findings are fixed in
Tests. There are ten new cases, and I ran each at
On MI450, the full file gives 480 passed / 109 skipped, and Cost.
Notes:
|
zhiding512
left a comment
There was a problem hiding this comment.
FlyDSL PA review (automated harness), round 5
Verdict: the round-4 findings are fixed in code, and the MI35X PA tests pass; one question is open before approval · head 4b0a62f214 · base = merge-base db3b870ea1 (main bd1416a1 adds two commits to tensor_shim.py only, which this PR does not touch)
This round reviews 4b0a62f21 ("review round 4 fixes") on top of d371a58aa, the head that round 4 and its MI450 addendum measured.
Round-4 findings, checked against the code
| # | finding | at 4b0a62f21 |
|---|---|---|
| 1 | [blocker] MXFP4 reducer drops partials when a context exceeds max_context_length (gfx950 CI) |
Fixed. The reducer takes min(work_plan.max_partitions, capacity) again, main's value. The gfx1250 cluster runs had the same gap: now the last CTA's run end is 2**30, so task_end = tiles, and count = min(ceil(tiles / run_tiles), P) makes the merge read every live CTA. Working through contexts below, at and above the bound by hand (including a bound that is not a multiple of P), every tile runs exactly once. |
| 2 | [major] per-wave partials write past the scratch | Fixed. With wave_partials, first = seq * P. store_wave writes slot 4 (seq P + part) + wave, and the merge reads count * 4 slots from first * 4, so writes and reads share one base. The highest slot is 4 B P - 1, below capacity by the host guard. MXFP4 never sets cluster_seqs > 1, which is the one merge call that doesn't scale by the wave count. |
| 3 | [major] whole-CTA / wave-pair rules build CTAs of more than 64 rows | Fixed. Both rules now require 40 < query_length * group <= 64, which falls inside wave_pairs' own check (one split of 33-64 rows). The MTP6 and MTP8 × G16 shapes keep their default splits. |
| 4 | [minor] tokens before the window start raise S_b | Fixed in run, run_dims and run_pairs. tile_low = first_upper - window - first, and first_upper is the CTA's smallest row bound (with query_begin). So only tokens that no row of the CTA can see are zeroed, and the score masks are unchanged. |
| 5 | [minor, perf] wave dims on CTAs with long runs | Fixed as suggested (seq_tiles <= 4 * cluster_size). |
There are ten new cases, one or more per finding, and the author reports that each one fails at d371a58aa. On MI35X, mxfp4-decode-runs-short-bound and mxfp4-decode-np8-long-cta also run, next to the existing mxfp4-short-bound-* cases. The others are gfx1250-only, so CI doesn't run them.
Verification
-
Harness hardware runs: none this round. All three harness containers were down:
- gfx942: the MI308X host rebooted, and its container has exited.
- gfx950: the MI355X cluster's login node times out on ssh.
- gfx1250: the MI450 container exited after a host reboot.
-
By construction: the delta only touches MXFP4 code:
Gfx1250Mxfp4Pipeline(run,run_dims,run_pairs);- the gfx1250 tile kernel's
const_expr(t.mxfp4)andconst_expr(t.wave_partials)branches; _pa_decode_mxfp4.
FP8/BF16 kernels on every arch, and the gfx950 MXFP4 tile, are therefore the same code as at
d371a58aa, which round 4 found ISA-identical to the base (gfx942 and gfx1250 on hardware, gfx950 compile-only). The only gfx950 change is the reducer rung, which is back to main's. -
CI (MI35X): shard 0, the one that runs
test_flydsl_pa_decode.py, passed on this head: 510 passed, 79 skipped, 0 failed. Atd371a58aait had 1 failure,mxfp4-short-bound-np2. So finding 1 is also fixed on gfx950 hardware. The other seven shards were still running when this was posted.
Open before approval
- The intermittent page-fault abort on MI450 is not root-caused. The description reports that
-k mxfp4aborted in 5 of 12 runs atd371a58aaand in 6 of 12 at4b0a62f21, on no-retry TCP page faults at near-null addresses (0x8000, 0x1c000). WithAMD_SERIALIZE_KERNEL=3 HIP_LAUNCH_BLOCKING=1it passed 8 of 8.- A near-null base plus an offset usually means a read through a null or not-yet-written pointer. The timing dependence fits a read that races an allocation or a free.
- One abort hit an FP8 case before any MXFP4 kernel had run in that process. That points away from this PR's kernels.
- However, nobody has measured the rate at the merge-base. The harness has also hit GPU faults on this MI450 when two processes built cases at the same time (inside hipBLASLt, not pa_decode), so the box itself isn't clean.
- Ask: run the same loop at
db3b870ea(the suite; MXFP4 is skipped there) and at the head with-k "not mxfp4", and post the abort counts. A similar rate at the base makes it pre-existing, to be tracked as its own issue. A rate that appears only with this PR needs a root cause before merge.
Notes (non-blocking)
- e4m3 Q at np1/np2 (+6-10%): reproduced and explained (where LLVM places the
v_movof the next tile's first V-scale word). It is listed under Performance as a follow-up. Fine with me. - Claims: decode B128 × 8k is now listed at 1.23×, against 1.53× before, in line with the 1.30× the addendum measured. The window B3 × 8292 FP8 difference is noted in the body.
- gfx1250-strict refusal: it still has no test. The author says that is intentional, but a one-line
pytest.raiseswithget_gfx_runtimepatched would stop the refusal from being dropped silently. - E2E accuracy (GSM8K-style) before ATOM routes gfx1250 MXFP4: agreed, outside this PR.
- Review state: the six open round-4 threads are all addressed in code. #8458, #8459 and #8462 (drafts, gfx1250 NVFP4) touch the same PA files, so whichever lands later needs a rebase.
zhiding512
left a comment
There was a problem hiding this comment.
FlyDSL PA review (automated harness), round 5 addendum: gfx1250 on hardware
Verdict: changes needed. The intermittent GPU page fault reproduces with this PR's tree and not with main's, and it is not limited to MXFP4. · head 4b0a62f214 · base = merge-base db3b870ea1 · MI450 (gfx1250, 256 CUs), ROCm 10.1, torch 2.11, FlyDSL 0.5.0
Round 5 could not run gfx1250 because the harness's MI450 container was down. It is back, so this addendum adds hardware results for the same head. The code findings of round 5 are unchanged.
Performance and correctness (gfx1250)
| check | result |
|---|---|
| FP8/BF16 vs main | PASS. All 2106 common cases give bit-identical outputs. The ISA of all 433 base kernels (unit + prod) is identical in head; the 62 head-only kernels are all MXFP4. First pass: prod 1.002, unit 1.004, grid 1.016, claims (FP8 rows) 0.989. It flagged 543 cases over the 2.5% band. Re-measured at 30 pairs, those 543 give 0.972, and 1.012 with base and head swapped. Four stay above the band in both orders, all under 6.5 µs: three fp8-bf16-per-tensor-plain-v-g6-d64-cluster4 grid points at +5-10%, and unit|fp8-fp16-per-token-transposed-v-default-cap at +3-4%. Their ISA, plan and output bits are the same as main's. A head-vs-head control on this box spreads up to 7% below 6 µs, so I count them as noise. |
| pytest | base 368 passed / 174 skipped; head 480 / 109. 0 new failures, and the 47 added tests pass. |
| Round-4 findings | Fixed on hardware. The 11 review probes for findings 1-3 run on head. On d371a58aa, the same harness worker still hits an illegal address on the first finding-2 probe (G16 × MTP8, window 4096, B10 × 4k).The new mxfp4-*-runs-short-bound, np8-long-cta, whole-capped, window4096-cluster and window-head-scales cases run on head, and their pytest versions pass. |
MXFP4 vs round 4 (d371a58aa) |
58 cases are measured on both heads (the rest come after the finding-2 crash on d371a58aa). Outputs are bit-identical, and the geomean is 1.003.Decode B128 × 8k is +4.6% (21.0 → 22.0 µs, all three layouts; single pass). |
The intermittent page fault (round 5's open question)
1. Run as asked: 0 aborts in 48 runs. Each loop ran alone on one GPU, with the 12 rounds interleaved:
| loop | aborts | each run |
|---|---|---|
-k mxfp4 at head |
0 / 12 | 113 passed |
| full suite at main | 0 / 12 | 368 passed |
-k "not mxfp4" at head |
0 / 12 | 367 passed |
-k mxfp4 at d371a58aa |
0 / 12 | 103 passed |
2. The harness reproduces it, only with this PR's tree.
- The harness launches ATOM-style: explicit scratch, a cold-KV rotation of at least 512 MB, and two worker processes alternating on one GPU.
- The process dies with
illegal memory accessorMemory access fault … Page not present. The dmesg bursts I checked areno-retry page faults at low addresses:
| tree the process imports | process crashes | about how many case runs | fault addresses (dmesg) |
|---|---|---|---|
this PR (4b0a62f21) |
9 | ~5800 (FP8/BF16 ~3600, MXFP4 ~2200) | 0x6c000, 0x7000, 0x8000, 0x180000, 0x512000, … |
main (db3b870ea) |
0 | ~3800 (FP8/BF16) | — |
(Case runs exclude the pytest loops above.)
- One of the nine is an FP8 case:
grid|fp8-torch.bfloat16-per-tensor-transposed-v-mtp5-g12-page128|b16|c1024, at address0x7000, during the 30-pair re-measure.- Its kernels are ISA-identical to main's, and its outputs are bit-identical whenever it doesn't crash.
- So the fault is unlikely to be in the MXFP4 tile body.
- The other eight are MXFP4 claims cases. One was in the round-4 comparison run:
w-mxfp4-q4-w4096-b3-c225380, which passed in the two other runs that day. Seven were in a dedicated loop over the 59 MXFP4 claims cases, head against head:- rounds 1-9: clean;
- round 10: 1 crash;
- round 11: 6 crashes;
- round 12: cases started to time out (2040 s each).
- The GPU stayed broken. After the processes were stopped, GPU 3 still did not answer a simple allocation, and dmesg keeps logging
vmid:0faults on it. TheAMD_SERIALIZE_KERNEL=3half of that loop never ran, so I can't confirm the description's "8/8 pass when serialized".
What it points to. It is intermittent, its signature is near-null, it gets more frequent as a process runs longer, and an FP8 case with main's ISA can hit it. That fits host-side state this PR changed for every dtype, more than a tile-kernel bug. Two candidates:
- a kernel pointer argument that can be 0, for example an optional workspace passed as None, dereferenced on a path that is only sometimes taken;
- a workspace, counter or flag read before anything writes it. Memory from
torch.emptyis reused, so what such a read sees depends on what the process allocated before.
Ask before merge:
- Find the read.
- Check every pointer the gfx1250 and common host paths pass that can be 0.
- Check every scratch or plan buffer the kernels read before writing; zero it, or guard the read.
- Then rerun a long loop of ATOM-style launches, with a cold-KV rotation and two processes on one GPU, at head and at main. The harness runs above can be shared on request.
Notes
- Method. Same harness and box as the round-4 addendum, on 1-2 of the MI450's 4 GPUs; other users' jobs held the rest. Case builds were serialized per worker. The 30-pair re-measure and its swapped run each had a GPU of their own.
- Not done this round.
- The head-only claims were measured but not compared with the PR's table.
- The B128 × 8k +4.6% would need a 30-pair re-measure on a healthy GPU.
zhiding512
left a comment
There was a problem hiding this comment.
FlyDSL PA review (automated harness), round 6
Verdict: no blocking issue. I withdraw the round-5 addendum's "changes needed": the MI450 page fault also happens with main's tree and no code from this PR, and every fault at this head that the runtime attributed to a kernel was in a hipBLASLt GEMM from the test's reference. One minor issue is noted inline. · head 4b0a62f214 (unchanged since round 5) · base = merge-base db3b870ea1 · also checked merged with current main e6d2d3100a (FlyDSL 0.5.3)
Since round 5 the PR has no new commits. On main, the FlyDSL pin moved from 0.5.0 to 0.5.3 (#8356, #8450, #8467), and tensor_shim.py and kernels_common.py changed. The PR merges with main without conflicts. Once merged, its gfx1250 MXFP4 kernels build with FlyDSL 0.5.3, which MI35X CI never exercises, so this round also tests the merged tree.
The MI450 page fault (round-5 addendum): not this PR
I reran the round-5 loop (two harness workers alternating on one GPU, the MXFP4 or FP8 claims group, 3 pairs a round), stopping each variant at its first crash:
| GPU | tree, cases | first crash | faulting kernel (runtime / dmesg) |
|---|---|---|---|
| GPU 1 | this PR, MXFP4, rocBLAS preferred | round 5 | not named |
| GPU 1, next | this PR, MXFP4, default (hipBLASLt) | round 1 | Cijk_Alik_Bljk_S_B_Bias_HA_S_SAV_UserArgs_MT32x32x16_MI16x16x1_… at 0xa000 |
| GPU 0 (no fault loop had run on it) | main db3b870ea only, FP8 only |
round 4 | Cijk_Alik_Bljk_S_B_Bias_HA_S_SAV_UserArgs_MT32x32x16_MI16x16x1_… at 0x51ed000; dmesg: GC_UTCL2 no-retry fault, same address |
| GPU 0, afterwards | this PR, MXFP4 | round 1 | not named |
| GPU 1, after its first crashes | main FP8 / PR FP8 / PR MXFP4 with AMD_SERIALIZE_KERNEL=3 |
round 1 / 1 / 3 | not named |
- The crash with main's tree, FP8 only and no PR code, settles it. That process imported
db3b870ea, ran FP8 cases only, and faulted in the same hipBLASLt FP32 GEMM, at a low address, as round 5. - Every attribution points at hipBLASLt. Across round 5 and this round, the runtime named a kernel for five faults. Four were in that hipBLASLt FP32 batched GEMM, at low addresses (
0x512000,0xbf8000,0xa000, and0x51ed000above), and none were in a pa_decode kernel of this head. The fifth was in the round-4 head's kernel, at a real address: finding 2, now fixed. The only FP32 batched matmul these processes run is the einsum in the test's_reference, which both trees share. - Neither serializing nor switching GEMM libraries prevents it.
AMD_SERIALIZE_KERNEL=3 HIP_LAUNCH_BLOCKING=1also crashed in this loop (round 3). The description's 8/8 serialized passes were pytest runs, a lighter load.TORCH_BLAS_PREFER_HIPBLASLT=0(rocBLAS preferred) crashed in round 5. The runtime did not name a kernel for that crash.
- Other users hit it too. The host's dmesg shows two other
python3processes with GPU page faults on GPUs 0 and 1 at 02:38–02:40Z, eight hours before these runs. - The PR's kernels write nothing outside their tensors.
- What I checked: for 133 cases (all 70 MXFP4 claims and review probes, the 62 unit MXFP4 params, and round 5's crashing FP8 grid case),
output,exp_sums,max_logitsandtemporary_outputwere views inside buffers with 1 MiB of canary bytes on each side. - Result: no canary byte changed. Outputs are bit-identical whether those tensors start as zeros or as NaN, so no unwritten scratch is read, and every case passes the test's reference check.
- What I checked: for 133 cases (all 70 MXFP4 claims and review probes, the 62 unit MXFP4 params, and round 5's crashing FP8 grid case),
- So round 5's reading was wrong. I took the different crash counts between the trees as a PR effect. They most likely came from how often a process built cases with large reference GEMMs. This is an MI450 / ROCm 10.1 hipBLASLt problem to track separately. No ask on this PR.
Verification
| arch | result |
|---|---|
| gfx942 (MI308X, 80 CUs; first hardware run at this head) | PASS. Geomean head/base: prod 1.000, unit 1.001, grid 1.000, claims 1.000 (FP8 rows; MXFP4 is skipped on gfx942 as designed). Every timed case gives bit-identical outputs (104 prod, 278 unit, 1674 grid, 47 claims). The first pass flagged 6 cases at +2.6–3.8%, all 9–13 µs. Re-measured at 30 pairs in both orders, they are within ±1.1%. ISA of the unit kernels: 236/236 identical. A/A band 2.5% (spread 0.7%). pytest: 414 passed on both sides; the 47 added tests skip. Merged with main (FlyDSL 0.5.3): 414 passed against main's 414, 0 failures. |
| gfx1250 (MI450, 256 CUs), merged with main at FlyDSL 0.5.3 | PASS. pytest: merged 480 passed, 0 failed (main: 368 passed). The 47 added tests pass. Claims, head at 0.5.0 against the merged tree at 0.5.3: all 117 cases give bit-identical outputs. Geomean MXFP4 1.001 (70 cases), FP8 0.992. The first pass flagged three small MXFP4 decode cases at +3.5–4.5%; at 30 pairs in both orders the merged tree is not slower. FP8 prod, main against merged (both 0.5.3): geomean 0.999, all 104 cases bit-identical, none slower. Claims against the PR table: MXFP4 measured / PR geomean 1.04 (45 of 56 within +10%), FP8 1.06. On geomean over the 44 MXFP4/FP8 twin cases, MXFP4 is 1.21× faster, exactly the table's 1.21×. MXFP4 is slower in 10 of them, as the table also shows. The largest absolute gap is decode B128 × 8k: 21.1 µs measured against 16.9 µs listed. FP8/BF16 against main at this head was covered by the round-5 addendum (bit-identical, ISA 433/433). |
| gfx950 (MI355X) | Not verified on hardware. ssh to the cluster's login node timed out on every attempt this round. Compile-only cross-check on the MI308X box (unit + prod cases): 279/279 kernels have identical ISA at head and base, MXFP4 included. |
Code review
- [minor] Plan-free MXFP4 with a window near
INT32_MAXzero-fills visible rows (inline atpa_decode_kernel.pyL1565). Reproduced on MI450; details in the inline comment.
Areas read with nothing found:
- context 0 in every branch: plan-free, cluster runs/non-runs, wave dims/partials, fused pairs;
- stale plan slots under fused pairs: the planner zero-fills
[total, capacity), and loads clamp tocapacity - 1; - 64-bit partial, output and K/V offsets at 128K–512K tokens;
- block-table prefetches, which are clamped;
- cache keys: every new codegen field is in
Gfx1250Traits.
Summary
Run the FlyDSL
pa_decodeMXFP4 KV cache (e2m1 data + one e8m0 scale per 32 elements) on gfx1250. Until now it was gfx950-only. The API and cache views are the same as on gfx950. gfx1250 runs PV in FP8 (an E4M3 P), as the FP8 KV path does; gfx950 keeps its bf16 P and V. Supported: head_dim 128, page 128, 1..16 query heads per KV head, e4m3 or bf16 query, bf16 output.Beyond gfx950, gfx1250 also takes MTP query lengths, sliding windows and
query_splits> 1 (at most 64 query rows per CTA).MXFP4 KV is classified as per-token KV on both architectures: its e8m0 bytes are each row's scales. It is requested with
per_token_kv=True, and on both architectures the kernel keeps FP8's f32 per-token scale path off.Motivation
On gfx1250,
pa_decoderefused MXFP4 caches (NotImplementedError: MXFP4 pa_decode supports gfx950). MXFP4 K+V is 136 B per token and head, against 264 B for FP8 with per-token scales. Decode at long context is bandwidth-bound, so the smaller cache should cut decode time.Changes
Commit 1 (
0e03046e2): gfx1250 MXFP4 decode withquery_length1.Gfx1250Mxfp4Pipeline(kernels/pa_decode/pipeline.py): four wave32 waves each own 64 tokens of a 256-token tile and all 128 dims, so the tile loop has no barrier. The waves merge once through LDS (34 KB, the only LDS use). Raw K/V rows load straight into WMMA operand order one tile ahead, and page ids two tiles ahead.V_WMMA_SCALE_F32_16X16X128_F8F6F4per 16 tokens. A is the e2m1 K rows with each token's e8m0 dword as scale A; B is the e4m3 Q. A bf16 Q is normalized per row in the kernel: the exponent of its scale goes to scale B and the mantissa scales the scores, as on gfx950. Lane/byte layouts of the mixed fp4×fp8 operands and of both scale operands were measured on gfx1250.V_WMMA_F32_16X16X32_BF16, and P stays in registers as B. The eight identity operands are 8-dword windows of two 14-dword rows (28 VGPRs).v_cvt_scale_pk8_{f32,f16,bf16}_fp4ignore their data operand on gfx1250 with FlyDSL 0.5.0 (B0 silicon,asic_rev=1). Inputs0x22222222and0x76543210both convert to the nibbles of0x7F7F7F7F, whether the operands are VGPRs, SGPRs or literals. The gfx950v_cvt_scalef32_pk_bf16_fp4does not exist for gfx1250 and asserts in LLVM.kernels/pa_decode/op_lds.py:Gfx1250Mxfp4Loader(row/scale loads in WMMA order, page ids from the block table; pages past the context read the sequence's first page).op_gemm.py:Gfx1250Gemm.mma_mx.kernels/pa_decode/traits.py,pa_decode_kernel.py:Gfx1250Traits(compute_dtype="mxfp4", plan_free=...). The gfx1250 tile kernel serves the plan-free form (one CTA per sequence, context lengths aswork) and dispatches the new pipeline.pa_decode.py(_pa_decode_mxfp4): accepts gfx1250 and launches its kernel. Output modes:PAGE_ID_STAGE_LIMITbound, since page ids come from the table._pa_decode_mxfp4keeps its launch arguments, now built through a shared tuple.Commit 2 (
411283ff7): MTP, sliding window, query splits, per-token KV.query_splits: positions split across CTAs throughblock_id.y, as on the other gfx1250 paths.per_token_kv=True.PaDecodeSchedule.selectnow keys MXFP4 as per-token instead of refusing it, andPaDecodeTraits.createkeeps the f32 per-token scale tensors and LDS buffers off for MXFP4.ARCH=gfx950 COMPILE_ONLY=1from the PR base and from this branch, are identical.context_lengths × query_length; windowed plans must match the window and the query length; the reducer and scratch takequery_length × grouprows. gfx950 still refuses MTP and windows with the same errors.Commit 4 (
aa93dff0f): fuse adjacent MXFP4 MTP tasks.Review round 1 (
886d8d941), on a merge of main (debc901ea) that brings in #7401:quantized_output,output_scaleandquant_rowsto the gfx1250 tile launch. The positional MXFP4 launch now passes null pointers and the batch size. MXFP4 tiles also refusequant_outputin the kernel;pa_decodealready refused it.fuse_tasks=2the grid is half the plan capacity. Each CTA reads the live task count (the last sequence's first slot plus its count inreduce_info) alongside its slots.max_context_length(as ATOM passes) no longer serializes a short batch.pa_decodeand incompile_pa_decode_tile. It was not run there, nor checked against A0'sS_CLAUSEerratum for scaled WMMAs.PaDecodeSchedule.selectnow says it takes MXFP4 only on gfx950 and that gfx1250 selectsgfx1250_tile_traits.Review round 2 (
31628751e):mxfp4_gfx1250_resident_ctasgives the CTAs resident at once: two a CU up to 32 rows (≤ 441 VGPRs), one with 3 or 4 M-tiles (579 / 710 VGPRs).pa_decodedocstring states the default query split as it is.Round 3 (
6e6de7f38): toward MXFP4 beating FP8 across the PA configs.Round 4 (
24c5d6750,ce4d3dd99): wave pairs, reducer bound, merge order.Round 5 (
804782ed3): wave dims for one-M-tile decode.run_dims):Round 6 (
0f8a5533a): G16 × MTP4 runs whole in long clusters.Round 7 (
01e902c4e): bank-conflict-free LDS operand exchanges.Round 8 (
4b0a62f21): review round 4 and its MI450 addendum.min(max_partitions, capacity)), as in round 3. The plan splits the real length, so round 4's bound bymax_context_lengthdropped partials (MI35Xmxfp4-short-bound-np2).seq × cluster_merge, the range the host bounds by the scratch. Waves then wrote past the scratch or into the next KV head: a GPU memory fault at G16 × MTP8 with window 4096, B10 × 4k.seq × cluster_merge.query_length × group <= MXFP4_GFX1250_MAX_ROWS. G16 × MTP6 and G16 × MTP8 keep their splits instead of raising.run,run_pairsandrun_dimsnow zero the V rows and scales of tokens before every row's window start, as they do past the context, so those scales no longer raise S_b.max_partitions=8gets round 3's 8-CTA cluster back without dims: 68.4 → 52.6 µs (round 3: 53.1).d371a58aa, and times agree within 1.5% on the same GPU, except B128 × 8k above.Performance (if applicable)
gfx1250 (MI450 eng. sample, B0, 256 CUs), FlyDSL 0.5.0, torch 2.11 ROCm. Shapes: 16 query heads / 1 KV head / D128 / page 128, bf16 query and output, planner defaults (2×CU budget), tight
max_context_length. FP8 uses per-token K/V scales.pa_decodecall (tile plus reducer or cluster merge), median of 3 rounds of min-of-5.Before this PR MXFP4 was refused on gfx1250, so the comparison is against FP8. As of round 7 (
01e902c4e), MXFP4 is faster in 60 of 71 configs of a cold-KV matrix (59 in round 5, 55 in round 4, 50 in round 3):The other 11 are 0.86–0.99×: G16 × MTP4, decode B128 × 1k, and three decode shapes within run-to-run noise of FP8 (below).
MTP (same harness, µs):
Sliding window 4096, at contexts that do not start the window on a tile boundary (µs):
G16 × MTP4 beyond the matrix: larger batches and more KV heads (same harness, µs; round 6 runs these whole in 2–4-CTA clusters):
Where MXFP4 still trails (round 7):
v_movcopies the next tile's first V-scale word into the loop-carried register, and it has to wait for that load.Review round 1 against the merge before it (cold, µs, MXFP4):
Review round 2, CTAs of 3–4 M-tiles (cold, µs, MXFP4, 1 KV head; before / after):
The earlier optimization-step numbers (15.0 → 13.6 µs at B16 × 64k, and others) were taken with warm KV; they still rank the steps.
Testing
Documentation
Dependencies
Breaking Changes
None. gfx1250 callers that hit
NotImplementedErrorfor MXFP4 caches now run.gfx1250-strict(A0) and gfx942 still refuse MXFP4.PaDecodeSchedule.selectrefuses non-gfx950 MXFP4 with a message pointing gfx1250 togfx1250_tile_traits.PR Self-Review
Reviewed revision
4b0a62f21Behavior and intent
pa_decodewith an MXFP4 cache (dtypes.fp4x2/uint8 data views plusdtypes.fp8_e8m0/uint8 scale views) now runs on gfx1250 instead of raising, including MTP, sliding windows and query splits there. MXFP4 is requested as per-token KV on both architectures. On gfx950 the design keeps bf16 P and V, the P shift and the query-scale split. On gfx1250, since round 3, P is E4M3 in an FP8 PV, as on the FP8 KV path, and results match the fp32 reference within 1.5e-2. The extreme-scale and exact-mean cases still pass unchanged: V'' is exact in E4M3 and the 2**(S_b - 141) restore is exact.Validation and unverified scope
On gfx1250 (B0), in a container with FlyDSL 0.5.0 (the
requirements.txtpin), GPU 1:max_context_lengthbounds; rejected inputs; and NaN/Inf poisoning of unowned rows at page 128.query_splits1 / 2 / 4;sliding-window,query-length-2,oversized-task).ARCH=gfx950 COMPILE_ONLY=1from current main and fromed730c57d, and their ISA is identical. Every FP8/BF16 kernel the suite compiles on main is byte-identical here (one reducer binary varies run to run on main too).ed730c57d:ruff 0.16.0clean,black 26.5.1clean.Not verified:
gfx1250-strict) was not run, and the ISA was not checked against A0'sS_CLAUSErule for scaled WMMAs, so MXFP4 is refused there.v_cvt_scale_pk8_*_fp4behaviour is a compiler or a hardware issue was not determined._check_output.no-retry page faultreads (TCP) at tiny addresses (0x8000, 0x1c000), i.e. a near-null pointer plus an offset.-k mxfp4subset aborted in 5 of 12 runs atd371a58aaand in 6 of 12 with round 8, each time at a different case. WithAMD_SERIALIZE_KERNEL=3 HIP_LAUNCH_BLOCKING=1it passed 8 of 8, so the abort depends on launch timing.PR-specific question
What behavior would each changed op test fail on before this PR, and why is that coverage not already provided by an existing canonical test?
Before this PR, the MXFP4 cases of
test_pa_decodeandtest_pa_decode_unowned_kv_rowswere skipped on gfx1250 by their arch gate. With the gate widened but without the kernel, they fail on gfx1250 at the firstpa_decodecall withNotImplementedError: MXFP4 pa_decode supports gfx950.The new gfx1250 MTP, window and
query_splitscases also fail after commit 1 alone:NotImplementedError: MXFP4 KV supports query_length 1, got 4... supports no sliding windowquery_splits!= 1These are the canonical MXFP4
pa_decodetests: the change widens their arch gate and adds gfx1250 cases to the same tables. No other op test exercises MXFP4 KV on gfx1250, or MXFP4 with MTP, windows or splits. The one case kept skipped there,oversized-task, asserts gfx950'sPAGE_ID_STAGE_LIMITrefusal, which gfx1250 does not need because it reads page ids from the block table.Changed op tests
op_tests/test_flydsl_pa_decode.py:The existing MXFP4 cases (functional, extreme-scale pools, rejections, graph, unowned rows) now run on gfx1250 as well as gfx950.
New gfx1250-only MXFP4 cases cover MTP, sliding windows, forced query splits, fused MTP tasks, MTP graph replay and MTP unowned rows. They are skipped on gfx950, which still refuses MTP and windows. No other test covers MXFP4 with these features.
Rejection cases are split by architecture: gfx950-only (MTP, window, page-staging bound) and gfx1250-only (rows over 64, windowed-plan query length).
Review round 1 adds the following:
fuse_tasks == 1, and default-plan decode pins for the cluster and the reducer.The fused and window cases fail before the round: the windowed case fuses, and the fused cases (80 sequences) now take the cluster.
Review round 2 adds MTP5 × G8 and MTP5 × G12 to the gfx1250 MTP cases.
Round 4 splits the 256-sequence fused cases by path, with a
pairspin on the compile requests:The pair cases fail before the round: their calls compiled
fuse_tasks=2.Round 8 adds ten cases. Each fails at
d371a58aa(checked one by one):mxfp4-mtp8-whole-capped(G16 × MTP8, 4 KV heads) andmxfp4-mtp6-g16-fusedraisedValueError(more than 64 rows a CTA, and wave pairs of 48-row splits).mxfp4-mtp8-window4096-cluster-kv1and-kv2(G16 × MTP8, window 4096, B10 × 4k): kv1 faulted the GPU, and kv2 returned wrong rows.mxfp4-decode-runs-short-boundandmxfp4-mtp4-runs-short-bound: 16-CTA cluster runs under a 4096 bound over contexts of 8192 / 6000 / 4500, with V only past the bound. Both output 0 where the reference is 0.5, because the runs dropped the tail.mxfp4-decode-np8-long-cta: an 8-partition decode plan over 16k, pinned todims=False; it compiled wave dims._tail_poolbuilds those pages: K = 0, and V = 1 on the logical pages past the bound.mxfp4-window-head-scales-decode-dims/-mtp4/-mtp4-pairs(wave dims, split CTAs, wave pairs): visible V is 1, and tokens before every row's window start carry a 2²⁰ V scale (_window_head_pool). Unmasked, those scales raised S_b and every row was off by 0.04–0.15.Round 7 removes
test_pa_decode_mxfp4_gfx1250_strict_refusedandtest_pa_decode_mxfp4_is_per_token_kv. The gfx1250-strict refusal and the per-token schedule key stay in the code.Round 6 adds
mxfp4-mtp4-whole-cluster: G16 × MTP4 with 4 KV heads over 16 sequences of about 8k, pinned to one query split in 4-CTA clusters. Before the round it compiled two splits.Round 5 replaces the decode pins with wave-dims pins (G16 at 4k and 8k, G8 at 4k with a part-filled M-tile) and a 16k reducer pin. A
dimspin checks the compile requests. Before the round the 8k case took the reducer, and no call compiledwave_dims.🤖 Generated with Claude Code