Repository navigation
Conversation
🏷️ 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 |
26b7ae6 to
5b4af18
Compare
|
Rebased onto the current head of #7178 ( Thanks @karverma-amd for pointing this out. |
|
Standard Tests (1 GPU) shard 2 failed in @karverma-amd this file comes from #7178, so #7178 will hit the same failure once its tests run; feel free to take the same change there, and I will drop mine on the next rebase. |
a17fb17 to
47d53cd
Compare
|
Rebased onto #7178's current head (803a3cd). #7178 now carries the Checked (no GPU): py_compile / black / ruff on the changed files, the changed modules import from the branch tree, |
47d53cd to
cfc5415
Compare
|
The previous |
cfc5415 to
5aa2e85
Compare
…4-1536, 2048/3072 In the model a FlyDSL compute kernel runs 10-25 us slower after another compute specialization than it does alone, which the tuner cannot see. Pick kernels that do not have the penalty: - Q-B (1,32768,1280) M=576/672: compute -> bmm t192x256x256 nb2 _pl (needs the software-pipelined K loop from #7668, stacked on #7667) - O-A batched (8,1024,4096) M=1024..1536 step 64: compute -> bmm t256x256x256 nb2 (9 rows replaced; kernelName only; the fused-quant entry uses the tuned row only with #7667) - Shared down (5120,2304) M=2048/3072: new rows, bmm t256x256x256 nb2 - O-B (5120,8192) M=2048/3072: new rows, compute t256x256x128 nb2 cm1_cn1
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (4)
- Flatten the epilogue into three peer branches and drop the dead code in the new branch.
kernels/gemm_a8w8_gfx1250.py:959/1068/1079/1105: useif const_expr(not fuse_quant_out): <bf16 store, unchanged>/elif const_expr(wmma_n_rep % 2 == 0): <acc quant>/else: <#7178 LDS quant>. The bf16 path then keeps its old indentation and drops out of the diff. In the new branch,row64(:991) andcbase_blk(:986-988) are never read (c8_offat :1049-1051 computescbase_blkagain). MoveGN,v2i32_ty,n32_64,srowandsbase_blkabove the fused branches so both quant paths share one copy. - Fix the comment on the new path.
gemm_a8w8_gfx1250.py:963says "no LDS staging, no barrier", but the e4m3 and scale bytes are staged in LDS (:1018-1032) and there is aworkgroup_barrierat :1033. Say the amax needs only oneshuffle_xor(16)and the bytes still go through LDS for the TDM store. - Add tests that pin each epilogue branch and the tuned-row lookup.
test_woa_fused_quant_epilogue(op_tests/test_flydsl_batched_gemm.py:347) uses only the heuristic tile, so no test is guaranteed to reach a given branch. Both branches are live in the DSv4.1 table:t16x64_nw4andt32x32_nw2(wmma_n_rep 1) take the #7178 path, andt32x64_nw2,t64x32_nw1andt128x128_nw2take the new one. Add akernel_nameparameter and run one tile of each kind againstquantize_fp8. Also add a CPU test of_fused_quant_tuned_kernelnext toop_tests/test_bmm_a8w8_fused_quant_supported.py, withlookup_mxscale_bmm_configpatched to return no row, an opus row and a flydsl row. CI has no gfx1250 runner, so this CPU test is the only part that runs in CI. - Make the fused entry handle a bad row the way the bf16 entry does.
batched_gemm_op_a8w8.py:515: a flydsl row whose nameparse_bmm_mx32_kernel_namerejects makes the fused entry quietly use the heuristic tile, while the bf16 entry raisesValueErrorfor that same row (run_bmm_a8w8_mxfp8_32_gfx1250). Drop the check and pass the flydsl row'skernelNamethrough. Keep returningNoneonly when there is no row or the row is an opus row.
Index mapping checked on CPU (lanes l and l^16 cover each 32-column group, every e4m3 and scale byte in LDS is written exactly once, and the new LDS use fits in C_STORE_B) for 156 tiles and every DSv4.1 row: probes/test_epilogue_index_model.py. CI is green (MI35X only). #7668 is stacked on this PR: it contains these two commits and changes neither the epilogue nor _fused_quant_tuned_kernel, so merge this PR first.
Reviewed at 5aa2e85.
5aa2e85 to
bd6cc9b
Compare
…ate_up tests - recipes/DeepSeek-V4.1-Flash.md: gfx1250 needs an AITER that contains ROCm/aiter#7667, #7668 and #8057 (aiter main after #8057; the exact commit goes in once they land). The pinned AITER is noted as the gfx950 one: with it a gfx1250 V4.1 build fails at the shared expert's import. - Expert.gate_up_silu_quant: the batch-size note is exact. The dequantized values stay within one e4m3 step, but a group's E8M0 scale, and every code in it, can differ when its max sits on 448 * 2**k in one chain and on the next bf16 value in the other. - Tests: the fused branch hands AITER quantize_fp8's e4m3 rows and E8M0 scales (the objects themselves); the op's fake returns e4m3 [m, inter] and E8M0 [m, inter / 32] on x's device, called directly and through the registered op under FakeTensorMode. Co-Authored-By: Claude Opus 5.5 <[email protected]>
6807132 to
305f898
Compare
|
@valarLip Rebased onto main Conflict resolution:
Checks on this head: gfx950, Could you approve formally? |
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (2)
- Rebase onto main and resolve the #8101 conflict so that both arches keep their tuned rows. The PR conflicts with main in
aiter/ops/batched_gemm_op_a8w8.pyandop_tests/test_flydsl_batched_gemm.py, because #8101 (gfx950 fused quant) adds its own_fused_quant_tuned_kernelwithif gfx != "gfx950": return None. Please watch for these traps:- Don't keep main's gfx950-only gate. It silently drops every gfx1250 tuned row. Keep your body (
:494-519: lookup,Nonefor a compute row, otherwise pass the name through) and main's_fused_quant_falls_backblock, which is gated ongfx == "gfx950". - Delete the second
_device_arch_and_cuimport and call. Git merges it into the fused entry without a conflict marker. - Rewrite #8101's docstrings, which become false after the merge. In
_fused_quant_tuned_kernel, "None ... on every other arch: a gfx1250 32x32 table row may name a compute kernel, which has no fused epilogue" is already false since #7673. In the fused entry, "... as does every other arch" is also false. Say that the flydsl row picks the tile on both arches, and that an opus row, a gfx1250 compute row or no row leaves the choice to the runner. Keep #8101's sentence that the fused GEMM may differ from the bf16 entry's by an fp32 rounding. - Test file, gfx950 branch: don't pass
kernel_nameto the gfx950run_ref. It isfunctools.partial(..., kernel_name=tile), and a call-timeNoneoverridestile. - Test file,
main(): give the gfx1250 fused call its own block, e.g.if arch == "gfx950": _run_fused_quant(shapes)andif arch == "gfx1250": _run_fused_quant(shapes, pin_tiles=not custom_shape). TheFUSED_QUANT_TILESnames are gfx1250 kernels. A separate block also gives #7668/#8057 a safe place for_run_pipelined()/_run_gate_up_silu(). Under a shared("gfx1250", "gfx950")gate a mechanical rebase lands them there with no conflict, and they raise on MI35X (batched_gemm_a8w8_gfx1250.py:422). - Expected result: checked on CPU, with that resolution, gfx950 behaves as main on all 681 gfx950 table rows, gfx1250/strict behaves as this head on all 122 rows, and both CPU test files pass (8/8).
- Don't keep main's gfx950-only gate. It silently drops every gfx1250 tuned row. Keep your body (
- Share the accumulator group-32 quant with #7673's epilogue instead of adding a second copy. The new branch (
kernels/gemm_a8w8_gfx1250.py:994-1002_group_scale, the per-group loop after:1031, the scale-row loop and the e4m3 TDM store) is near-verbatim the fused epilogue #7673 put on main (kernels/gemm_a8w8_256x256_gfx1250.py:1642-1734): same h0/h1 amax,shuffle_xor(16), 1e-10 floor, RoundUp e8m0,emit_cvt_scalef32_pk8_fp8_f32, LDS offsets andrrscale-row store (~60 of ~100 lines identical, the rest renames). In this rebase, move the per-group step (acc pair -> e4m3 and scale bytes in LDS) and the scale-row store intokernels/quant_utils.pynext toemit_mx_e8m0_scale, call it from both kernels, keep each kernel's own TDM view, and rerun the bit-exact fused check for both kernels on gfx1250.
Optional:
- Add
t64x32x512 mw4 nw1(GN 1) andt160x128x256 nw2(tile_m > 128, so a second scale-row pass) toFUSED_QUANT_TILES. Both are shipped accumulator-branch rows that no test pins. A CPU model of the branch is bit-exact for them. - Since the rebase is needed anyway, a squash message that states the final behaviour would keep 6c2a1f1's "the runner rejects it when y_scale_out is set" out of main.
Reviewed at 305f898 (deep, 3 hunters + 2 verifiers + miss pass; full diff). The kernel is byte-identical to 6807132. The accumulator epilogue is bit-exact against the LDS-staged branch and a quantize_fp8 reference on all 40 gfx1250 32x32 rows on main, and the bf16 path is unchanged. The fused and bf16 entries pick the same row on gfx1250 and strict. Already fixed: all 9 earlier asks (three peer branches, new-path comment, pinned-tile and tuned-row tests, a bad flydsl name raising, the gfx1250 run, test comments, compute rows → None, _group_scale, the _check_bmm_operands docstring). Item 2 became visible only when #7673 landed (11-19), after the 6807132 LGTM. Leaving tuned compute rows to the runner matches main's behaviour and is stated in the PR; not required. CI: 8 MI35X shards pending, nothing failed. #7668/#8057 must re-check main() after they rebase.
305f898 to
e552b7c
Compare
|
@valarLip Addressed review 5979457321. Rebased onto main 1. #8101 conflict, both arches keep their tuned rows (
2. Accumulator group-32 quant shared with #7673's epilogue (
Optional
Checks on this head:
|
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (4)
- Post the gfx1250 bit-exact run for both kernels at this head. This is still open from the last review.
085326080moved the accumulator quant intokernels/quant_utils.py:189-265: the per-group step and the scale-row store are now@flyc.jithelpers that takeout_clsand the tile constants as arguments, and bothgemm_a8w8_gfx1250.pyandgemm_a8w8_256x256_gfx1250.pycall them. The PR description and your 11-20 comment both say the gfx1250 run is pending. The only evidence for the move is an offline ISA compare. The two newly pinned tiles (t64x32x512 mw4 nw1,t160x128x256 nw2) have never run on hardware, and CI has no gfx1250 FlyDSL lane. Runpython op_tests/test_flydsl_batched_gemm.pyon gfx1250 and paste:- the scale and fp8 mismatch lines for all five
FUSED_QUANT_TILESat M = 48 and 200, which should all be 0; - the heuristic-tile fused sweep, including M 1025 and 2048 on the 256x256 compute kernel;
- if you can, one call of the public
batched_gemm_a8w8_mxscale_bpreshuffle_fused_quanton a DSv4.1 wo_a table shape, compared bit-exact against the bf16 entry plusquantize_fp8. No test goes through the real lookup on gfx1250.
- the scale and fp8 mismatch lines for all five
- Fix the gfx950 fixture name in the new CPU test. At
op_tests/test_bmm_a8w8_fused_quant_tuned_row.py:22-23,flydsl_bmm_mxfp8_mfma_t16x16x256_w1x1_nb6_sk4_nt_spsis commented as "A gfx950 row of main's tuned bmm tables". It is only in the 2-D*_tuned_gemm.csvtables, not in any*batched_gemm_a8w8_blockscale_mxscale_bpreshuffle_tuned*.csvthatlookup_mxscale_bmm_config(bpreshuffle=True)reads. Useflydsl_bmm_mxfp8_mfma_t64x32x512_w2x2_nb3_sk1_nt, which is the DSv4 bmm row for exactly_SHAPE_950, or fix the comment. - Fix the "one row per thread" text this PR adds. The scale-row loop runs
ceil(tile_m / block)passes (threadtidwrites rowstid,tid + block, …). So on the shipped t160/t192/t256x128 nw2 tiles a thread writes two rows. Reword both new sites:quant_utils.py:251, theemit_mxfp8_scale_rows_storedocstring;gemm_a8w8_gfx1250.py:1056.
For example: "each thread copies whole scale rows (rows tid, tid + block, …); a row's GN bytes are contiguous in the row-major scale, so each row is one small store." The same comment ingemm_a8w8_256x256_gfx1250.py:1688came from main, but sits in a hunk you edit; fix it too.
- Fix the squash message.
ca4d44203says the pinned tiles are "one LDS-staged, two accumulator", butFUSED_QUANT_TILESnow has one LDS-staged and four accumulator tiles. Please correct it in the squash text when merging.
Pre-existing (not required here): quant_utils.py:363 refers to emit_amax_e8m0_recip, which doesn't exist. The module docstring lists mxfp6/mxint8, but _DTYPE_CFG has only fp4/fp8.
Reviewed at e552b7c (deep: 3 hunters + ecc:review-pr, 2 verifiers, miss pass, and an independent second pass; full diff). Checked on CPU and clean:
- The three helpers are AST-identical to the inline code they replace in both kernels, and every call-site argument matches, including the batched sbase.
- An index/LDS/bit-exact model passes on every gfx1250 table tile, including GN=1 and tile_m > block.
- The bf16 path is unchanged.
_fused_quant_tuned_kernelmatches main on all 680 gfx950 rows. On gfx1250 it passes 37 rows through, all accepted by the runner withy_scale_out, and the 3 compute rows go toNone.
Already fixed: the #8101 rebase (one function for both arches, a single _device_arch_and_cu, rewritten docstrings, gfx950 run_ref, separate main() blocks), the helpers shared with #7673, both optional tiles, and the squash into one commit. CI: shards 0/4/5/7 of the MI35X 1-GPU Standard Tests failed with "runner lost communication" (infra), so the Test Gate needs a rerun.
e552b7c to
99d9d6d
Compare
|
@valarLip thanks, addressed at head
Pre-existing, also fixed in The new commit touches only comments, docstrings and one test constant; the three kernel files are AST-identical to |
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (5)
- Post the gfx1250 bit-exact run at this head (still open from the last review). Since the last hardware run (
1631e8ebd, 3 tiles), the quant moved into thequant_utils.pyhelpers, andt64x32x512 mw4 nw1andt160x128x256 nw2were added; none of these has run on gfx1250. CI has no gfx1250 FlyDSL lane. Paste the mismatch lines for all fiveFUSED_QUANT_TILESat M = 48 and 200, the heuristic fused sweep including M 1025/2048, and one public fused-entry call on a DSv4.1 wo_a shape. Also include tiles that the fused entry now runs from main's tuned rows but no test pins:t192x128x256 nw2(M 544-736, tile_m > 128 threads),t128x256x256 mw1 nw4(M 800-896, GN = 8),t96x128x256(M 352) andt32x32x512(M 20, LDS branch, GN = 1). Either pin them inFUSED_QUANT_TILESor add them to the run. - Keep the per-shape import and regex off gfx950.
aiter/ops/batched_gemm_op_a8w8.py:528,543now runsfrom .flydsl.mxfp8_bpreshuffle_gemm_gfx1250 import is_compute_wmma_kernel_nameand the compute-name regex on everylru_cachemiss, on gfx950 too, where no row name can match. Each new M (eager prefill on the DSv4.1 wo_a path) costs +1.2-1.3 µs: base 0.96-2.3 µs vs head 2.2-3.6 µs, two independent A/B runs on a pinned core with controls. Do not hoist the import to module level:aiter/__init__.pywould then import flydsl unconditionally. Instead end the function with:This measures the same as base on gfx950, and the new CPU test still passes.name = cfg["kernelName"] if gfx == "gfx950": return name from .flydsl.mxfp8_bpreshuffle_gemm_gfx1250 import is_compute_wmma_kernel_name return None if is_compute_wmma_kernel_name(name) else name
- Use the new helper in the gfx950 bmm kernel too.
aiter/ops/flydsl/kernels/bmm_a8w8_mxscale_gfx950.py:1179-1185repeatsemit_mxfp8_group32_scale(quant_utils.py:190-201) step for step: 1e-10 floor, RoundUp FP8_E4M3 e8m0,<<23scale. Replace it withe8, scale = emit_mxfp8_group32_scale(amax), imported next toemit_mx_e8m0_scaleat :53, and keep the gfx950 fused-quant lines at 0 mismatches. We missed this last round and filed it as pre-existing. - Fix the two "bf16 C tile" sentences that the accumulator branch made untrue. In
batched_gemm_a8w8_gfx1250.py:489, write e.g. "y_scale_out: when given, the epilogue writes the output group-32 MXFP8-quantized (e4m3) instead of bf16 -- ...". Ingemm_a8w8_gfx1250.py:75, write e.g. "fuse_quant_out: the output is group-32 MXFP8-quantized in the epilogue instead of written as bf16, from the accumulators rounded to bf16 when wmma_n_rep is even, else from the bf16 C tile staged in LDS." You already fixed the same point in_check_bmm_operands. - Give one tuned-row test fixture a CU count other than 256. In
op_tests/test_bmm_a8w8_fused_quant_tuned_row.py, both_SHAPEand_SHAPE_950use cu 256, so replacingcu_num=cu_numwith a constant 256 still passes all cases. Use e.g. 80 in one of them.
Reviewed at 99d9d6d (deep, full diff: 4 hunters including ecc:review-pr, 2 verifiers, a miss pass). Checked on CPU and clean:
- An index, LDS and numerics model of both epilogue branches and the scale-row store passes on all 44 gfx1250 table and heuristic tiles at head and current main.
- The helper code is AST-equivalent to main's inline 256x256 code, the bf16 path is unchanged, and the semantic merge with current main is clean.
- The runner accepts all 41 gfx1250 rows the fused entry now passes through. gfx950 routing is identical to main on 680 rows.
- CI is green, and the new CPU test ran in shard 2.
Already fixed: the fixture row, the "one row per thread" text at all three sites, the squash tile count, and both stale quant_utils docstrings.
99d9d6d to
dfc6215
Compare
|
@valarLip thanks, addressed at head
Also at this head: |
|
gfx1250 run at head 1. 2. Heuristic-tile fused sweep, same run: all 45 heuristic lines (B 16/8/4/2/1 x M 1, 16, 17, 32, 48, 128, 1024, 4096, 16384) have 0 scale / 0 fp8 mismatches, and the run ends with For M > 1024 the heuristic is the 256x256 compute kernel: 3. Public entry on DSv4.1 wo_a table shapes, real lookup path. Small script (not committed): B = 8, N = 1024, K = 4096, raw 32x32 weight scale; The shapes cover both epilogue branches through the public entry: LDS-staged ( The PR description's Validation section now points to this comment. |
A shared expert whose down projection reads MXFP8 runs the gate_up GEMM (bf16 [M, 2I]), silu_and_mul and quantize_fp8 as three launches. The batched mxfp8_32 gfx1250 kernel now applies the SwiGLU before its fused group-32 MXFP8 epilogue, so the three become one GEMM. Kernel (kernels/gemm_a8w8_gfx1250.py), new fuse_act_mul / act_limit constexprs (batched mxfp8_32, 32x32 B scale, fuse_quant_out, no K tail): - B is the unmodified [gate; up] weight. Each CTA gathers its tile_n B rows, and their scale rows, as tile_n/64 blocks of [32 gate rows, the matching 32 up rows] through one nested TDM view, so a wave's 64 columns hold gate and up of the same 32 outputs in the same lanes. - The epilogue rounds the accumulators to bf16 and forms bf16(silu(bf16(min(g, L))) * clamp(u, -L, L)) as aiter silu_and_mul does (L = 0: no clamp), then quantizes each 32-column group with ROCm#7667's emit_mxfp8_acc_pair_to_lds / emit_mxfp8_scale_rows_store; only the e4m3 TDM store stays local, shared with the accumulator-quant epilogue. - Against the bf16 GEMM + silu_and_mul + quantize_fp8 chain, a SwiGLU value can sit one bf16 step from silu_and_mul's (exp/rcp rounding), so an e4m3 code can differ by one step; where that value is its group's amax at 448 * 2**k, the group's e8m0 scale moves by one instead (and so all 32 codes). - The kernel name gets a _silu<limit>q suffix, so it never collides with the plain GEMM; fuse_act_mul defaults to off. Host (batched_gemm_a8w8_gfx1250.py): - run_gate_up_silu_mxfp8_32_gfx1250: the raw launch. Operand dtypes, strides, shapes, devices, alignment, the limit and the kernel name are checked before the arch check; the e8m0 x_scale / w_scale checks run after it. swiglu_limit is read as the f32 silu_and_mul receives. kernel_name=None picks the tile from the runtime row count. - gate_up_silu_supported(n2, k): gfx1250 with the measured CU count at the measured [2I, K]; independent of the row count. - gate_up_silu_kernel_for(m, n2, k): the table tile for the measured device and shape only, else None. A host helper for code that sees the real row count; not for branching in a traced forward. - The table tiles end in _pl (the pipelined K loop). Op (batched_gemm_op_a8w8.py): functional registered op gate_up_silu_mxfp8_32 (mutates_args=[]) that picks the tile from the runtime row count and returns the e4m3 / e8m0 outputs. Tests: op_tests/test_flydsl_gate_up_silu_host.py (CPU: gating, picker, limit and operand validation, functional op under fullgraph dynamic shapes) and test_gate_up_silu_fused in op_tests/test_flydsl_batched_gemm.py (gfx1250: every tile bucket, limits 10, 0 and 5.02, vs the unfused chain). Co-Authored-By: Claude Opus 5.5 <[email protected]>
A shared expert whose down projection reads MXFP8 runs the gate_up GEMM (bf16 [M, 2I]), silu_and_mul and quantize_fp8 as three launches. The batched mxfp8_32 gfx1250 kernel now applies the SwiGLU before its fused group-32 MXFP8 epilogue, so the three become one GEMM. Kernel (kernels/gemm_a8w8_gfx1250.py), new fuse_act_mul / act_limit constexprs (batched mxfp8_32, 32x32 B scale, fuse_quant_out, no K tail): - B is the unmodified [gate; up] weight. Each CTA gathers its tile_n B rows, and their scale rows, as tile_n/64 blocks of [32 gate rows, the matching 32 up rows] through one nested TDM view, so a wave's 64 columns hold gate and up of the same 32 outputs in the same lanes. - The epilogue rounds the accumulators to bf16 and forms bf16(silu(bf16(min(g, L))) * clamp(u, -L, L)) as aiter silu_and_mul does (L = 0: no clamp), then quantizes each 32-column group with ROCm#7667's emit_mxfp8_acc_pair_to_lds / emit_mxfp8_scale_rows_store; only the e4m3 TDM store stays local, shared with the accumulator-quant epilogue. - Against the bf16 GEMM + silu_and_mul + quantize_fp8 chain, a SwiGLU value can sit one bf16 step from silu_and_mul's (exp/rcp rounding), so an e4m3 code can differ by one step; where that value is its group's amax at 448 * 2**k, the group's e8m0 scale moves by one instead (and so all 32 codes). - The kernel name gets a _silu<limit>q suffix, so it never collides with the plain GEMM; fuse_act_mul defaults to off. Host (batched_gemm_a8w8_gfx1250.py): - run_gate_up_silu_mxfp8_32_gfx1250: the raw launch. Operand dtypes, strides, shapes, devices, alignment, the limit and the kernel name are checked before the arch check; the e8m0 x_scale / w_scale checks run after it. swiglu_limit is read as the f32 silu_and_mul receives. kernel_name=None picks the tile from the runtime row count. - gate_up_silu_supported(n2, k): gfx1250 with the measured CU count at the measured [2I, K]; independent of the row count. - gate_up_silu_kernel_for(m, n2, k): the table tile for the measured device and shape only, else None. A host helper for code that sees the real row count; not for branching in a traced forward. - The table tiles end in _pl (the pipelined K loop). Op (batched_gemm_op_a8w8.py): functional registered op gate_up_silu_mxfp8_32 (mutates_args=[]) that picks the tile from the runtime row count and returns the e4m3 / e8m0 outputs. Tests: op_tests/test_flydsl_gate_up_silu_host.py (CPU: gating, picker, limit and operand validation, functional op under fullgraph dynamic shapes) and test_gate_up_silu_fused in op_tests/test_flydsl_batched_gemm.py (gfx1250: every tile bucket, limits 10, 0 and 5.02, vs the unfused chain). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keeps ROCm#7667's commits as they are and takes main's changes. The only conflict is the module docstring of op_tests/test_gemm_host_dispatch_cache.py: main's text for the nested blockscale call (ROCm#8291) plus this branch's `_pl` bullet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed entry runs the tuned row Fused MXFP8 epilogue: when the warp tile holds an even number of 16-column WMMA tiles (even wmma_n_rep), the group-32 quant reads the accumulators instead of staging the bf16 C tile in LDS and re-reading it per group. A lane holds 8 consecutive columns of one row per 16x16 tile, so a 32-column group is two adjacent tiles across lanes l and l^16 and its amax is one shuffle_xor(16). Values are rounded to the output dtype first, exactly as the bf16 path stores them, so the e4m3 codes and e8m0 scales are unchanged; the e4m3 and scale bytes still go through LDS for the TDM store. An odd wmma_n_rep keeps the LDS-staged quant. The epilogue has three peer branches (bf16 store, accumulator quant, LDS-staged quant) with the quant setup and the group-32 scale step shared by the two quant branches. batched_gemm_a8w8_mxscale_bpreshuffle_fused_quant looks the shape up in the same preshuffle table as the bf16 entry and passes a flydsl row's kernelName to the runner, so both entries run the same tuned tile. No row, an opus row or a compute-kernel row leaves the tile to the runner; any other name is passed through, so a name the runner does not accept raises, as for the bf16 entry. Tests: op_tests/test_flydsl_batched_gemm.py checks the fused quant on tuned tiles that pin each epilogue branch (two LDS-staged, seven accumulator) at ragged M against quantize_fp8 of the bf16 GEMM on the same tile; op_tests/test_bmm_a8w8_fused_quant_tuned_row.py is a CPU test of the tuned-row lookup. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After the merge with main's gfx950 fused quant, one _fused_quant_tuned_kernel serves both arches. The CPU test now also checks a gfx950 flydsl row (passed through) and a gfx950 opus row or no row (runner's choice). Co-Authored-By: Claude Opus 5.5 <[email protected]>
The batched mxfp8_32 kernel's accumulator quant and the 256x256 compute kernel's fused epilogue emitted the same per-group step (round to the output dtype, h0/h1 amax with one shuffle_xor(16), 1e-10 floor, RoundUp e8m0, scaled fp8 conversion, e4m3 and scale bytes into LDS) and the same scale-row store. Both now call emit_mxfp8_acc_pair_to_lds and emit_mxfp8_scale_rows_store in kernels/quant_utils.py, next to emit_mx_e8m0_scale; emit_mxfp8_group32_scale (floor + RoundUp scale) is also used by the batched kernel's LDS-staged quant. Each kernel keeps its own e4m3 TDM store. No change in the emitted code is intended. Co-Authored-By: Claude Opus 5.5 <[email protected]>
FUSED_QUANT_TILES adds t64x32x512 mw4 nw1 (one quant group per tile row) and t160x128x256 nw2 (more tile rows than threads, so the scale rows take a second pass), both shipped DSv4.1 rows on the accumulator branch that no test pinned. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The scale-row store loops ceil(tile_m / block) times, so a thread copies rows tid, tid + block, ...; say that in the helper docstring and at both kernel call sites instead of "one row per thread". In quant_utils, the native-scale helper no longer refers to a function that does not exist, and the module docstring names the dtypes _DTYPE_CFG actually defines. The gfx950 tuned-row test uses the DSv4 batched preshuffle table's row for its shape. Comments and test data only; no kernel change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…red group-32 scale _fused_quant_tuned_kernel imports the gfx1250 compute-kernel name check only on gfx1250, after the table lookup; gfx950 returns the flydsl row's name directly, as before the merge with the gfx1250 lookup. The gfx950 bmm fused epilogue calls emit_mxfp8_group32_scale instead of its own copy of the same steps (1e-10 floor, RoundUp e8m0, f32 scale). Two docstrings no longer say the fused epilogue always quantizes the bf16 C tile. Tests: FUSED_QUANT_TILES also pins the DSv4.1 wo_a tuned tiles the fused entry runs (t192x128x256, t128x256x256 mw1 nw4, t96x128x256, and the LDS-staged t32x32x512); the gfx1250 tuned-row fixture uses a CU count other than the gfx950 one so the lookup must forward the caller's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
dfc6215 to
f1a3bc2
Compare
A shared expert whose down projection reads MXFP8 runs the gate_up GEMM (bf16 [M, 2I]), silu_and_mul and quantize_fp8 as three launches. The batched mxfp8_32 gfx1250 kernel now applies the SwiGLU before its fused group-32 MXFP8 epilogue, so the three become one GEMM. Kernel (kernels/gemm_a8w8_gfx1250.py), new fuse_act_mul / act_limit constexprs (batched mxfp8_32, 32x32 B scale, fuse_quant_out, no K tail): - B is the unmodified [gate; up] weight. Each CTA gathers its tile_n B rows, and their scale rows, as tile_n/64 blocks of [32 gate rows, the matching 32 up rows] through one nested TDM view, so a wave's 64 columns hold gate and up of the same 32 outputs in the same lanes. - The epilogue rounds the accumulators to bf16 and forms bf16(silu(bf16(min(g, L))) * clamp(u, -L, L)) as aiter silu_and_mul does (L = 0: no clamp), then quantizes each 32-column group with ROCm#7667's emit_mxfp8_acc_pair_to_lds / emit_mxfp8_scale_rows_store; only the e4m3 TDM store stays local, shared with the accumulator-quant epilogue. - Against the bf16 GEMM + silu_and_mul + quantize_fp8 chain, a SwiGLU value can sit one bf16 step from silu_and_mul's (exp/rcp rounding), so an e4m3 code can differ by one step; where that value is its group's amax at 448 * 2**k, the group's e8m0 scale moves by one instead (and so all 32 codes). - The kernel name gets a _silu<limit>q suffix, so it never collides with the plain GEMM; fuse_act_mul defaults to off. Host (batched_gemm_a8w8_gfx1250.py): - run_gate_up_silu_mxfp8_32_gfx1250: the raw launch. Operand dtypes, strides, shapes, devices, alignment, the limit and the kernel name are checked before the arch check; the e8m0 x_scale / w_scale checks run after it. swiglu_limit is read as the f32 silu_and_mul receives. kernel_name=None picks the tile from the runtime row count. - gate_up_silu_supported(n2, k): gfx1250 with the measured CU count at the measured [2I, K]; independent of the row count. - gate_up_silu_kernel_for(m, n2, k): the table tile for the measured device and shape only, else None. A host helper for code that sees the real row count; not for branching in a traced forward. - The table tiles end in _pl (the pipelined K loop). Op (batched_gemm_op_a8w8.py): functional registered op gate_up_silu_mxfp8_32 (mutates_args=[]) that picks the tile from the runtime row count and returns the e4m3 / e8m0 outputs. Tests: op_tests/test_flydsl_gate_up_silu_host.py (CPU: gating, picker, limit and operand validation, functional op under fullgraph dynamic shapes) and test_gate_up_silu_fused in op_tests/test_flydsl_batched_gemm.py (gfx1250: every tile bucket, limits 10, 0 and 5.02, vs the unfused chain). Co-Authored-By: Claude Opus 5.5 <[email protected]>
A shared expert whose down projection reads MXFP8 runs the gate_up GEMM (bf16 [M, 2I]), silu_and_mul and quantize_fp8 as three launches. The batched mxfp8_32 gfx1250 kernel now applies the SwiGLU before its fused group-32 MXFP8 epilogue, so the three become one GEMM. Kernel (kernels/gemm_a8w8_gfx1250.py), new fuse_act_mul / act_limit constexprs (batched mxfp8_32, 32x32 B scale, fuse_quant_out, no K tail): - B is the unmodified [gate; up] weight. Each CTA gathers its tile_n B rows, and their scale rows, as tile_n/64 blocks of [32 gate rows, the matching 32 up rows] through one nested TDM view, so a wave's 64 columns hold gate and up of the same 32 outputs in the same lanes. - The epilogue rounds the accumulators to bf16 and forms bf16(silu(bf16(min(g, L))) * clamp(u, -L, L)) as aiter silu_and_mul does (L = 0: no clamp), then quantizes each 32-column group with ROCm#7667's emit_mxfp8_acc_pair_to_lds / emit_mxfp8_scale_rows_store; only the e4m3 TDM store stays local, shared with the accumulator-quant epilogue. - Against the bf16 GEMM + silu_and_mul + quantize_fp8 chain, a SwiGLU value can sit one bf16 step from silu_and_mul's (exp/rcp rounding), so an e4m3 code can differ by one step; where that value is its group's amax at 448 * 2**k, the group's e8m0 scale moves by one instead (and so all 32 codes). - The kernel name gets a _silu<limit>q suffix, so it never collides with the plain GEMM; fuse_act_mul defaults to off. Host (batched_gemm_a8w8_gfx1250.py): - run_gate_up_silu_mxfp8_32_gfx1250: the raw launch. Operand dtypes, strides, shapes, devices, alignment, the limit and the kernel name are checked before the arch check; the e8m0 x_scale / w_scale checks run after it. swiglu_limit is read as the f32 silu_and_mul receives. kernel_name=None picks the tile from the runtime row count. - gate_up_silu_supported(n2, k): gfx1250 with the measured CU count at the measured [2I, K]; independent of the row count. - gate_up_silu_kernel_for(m, n2, k): the table tile for the measured device and shape only, else None. A host helper for code that sees the real row count; not for branching in a traced forward. - The table tiles end in _pl (the pipelined K loop). Op (batched_gemm_op_a8w8.py): functional registered op gate_up_silu_mxfp8_32 (mutates_args=[]) that picks the tile from the runtime row count and returns the e4m3 / e8m0 outputs. Tests: op_tests/test_flydsl_gate_up_silu_host.py (CPU: gating, picker, limit and operand validation, functional op under fullgraph dynamic shapes) and test_gate_up_silu_fused in op_tests/test_flydsl_batched_gemm.py (gfx1250: every tile bucket, limits 10, 0 and 5.02, vs the unfused chain). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Rebased onto main |
valarLip
left a comment
There was a problem hiding this comment.
⚠️ Action required before merge (1)
- Nit: update the
FUSED_QUANT_TILESheader comment to the nine tiles it now lists.op_tests/test_flydsl_batched_gemm.py:180-185still says "one LDS-staged tile and four accumulator tiles" and names only t16x64 as LDS-staged. The tuple has two LDS-staged tiles (t16x64 nw4, t32x32 nw2) and seven accumulator tiles. The module docstring (:26-27) anda38316731already say this. For example: "Tuned DSv4.1 tiles that pin both fused-quant epilogue branches: two LDS-staged tiles and seven accumulator tiles. One 16-column WMMA tile per warp (t16x64 nw4, t32x32 nw2) keeps the LDS-staged quant; an even count quantizes from the accumulators." Keep the t64x32 / t160x128 sentences.
Everything else is done. Thanks for the gfx1250 run.
Root cause vs patch
This is a root fix. It addresses two problems: the fused epilogue staged bf16 in LDS and re-read it for each group, and the fused entry ignored the tuned tile that the bf16 entry uses. Quantizing from the accumulators, sharing one group-32 helper across all three kernels, and using the bf16 entry's tuned-row lookup solve both at the source.
Two parts look like patches but are acceptable:
- The LDS fallback for odd
wmma_n_repis structural, because a 32-column group crosses warps. - Tuned gfx1250 compute rows go to
None. This was accepted at 305f898. A possible follow-up: the runner accepts most fused compute names, so exposing the runner's fused-capable predicate would let the fused entry keep those rows too.
Reviewed at f1a3bc2 (deep re-review: two independent full passes; delta plus full diff). The PR's kernel and helper lines are identical to dfc6215, so the posted gfx1250 run covers this head: all 9 FUSED_QUANT_TILES at M 48/200, the heuristic sweep including M 1025/2048, and 8 public-entry DSv4.1 wo_a rows, all with 0 mismatches. The rebase resolution keeps main's _fused_quant_k() and the gfx950 ragged-K block, and merge-tree with current main is clean.
Already fixed:
- the gfx1250 run with the 4 named tiles pinned;
- the gfx950 early return before the function-local import (
batched_gemm_op_a8w8.py:540-545); - the gfx950 bmm kernel now uses
emit_mxfp8_group32_scale(same floor, RoundUp and<<23; ISA byte-identical); - both "bf16 C tile" sentences;
- the cu 80 fixture.
CI is green and no review threads are open.
Two LDS-staged tiles (t16x64 nw4, t32x32 nw2) and seven accumulator tiles, as the tuple and the module docstring list them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A shared expert whose down projection reads MXFP8 runs the gate_up GEMM (bf16 [M, 2I]), silu_and_mul and quantize_fp8 as three launches. The batched mxfp8_32 gfx1250 kernel now applies the SwiGLU before its fused group-32 MXFP8 epilogue, so the three become one GEMM. Kernel (kernels/gemm_a8w8_gfx1250.py), new fuse_act_mul / act_limit constexprs (batched mxfp8_32, 32x32 B scale, fuse_quant_out, no K tail): - B is the unmodified [gate; up] weight. Each CTA gathers its tile_n B rows, and their scale rows, as tile_n/64 blocks of [32 gate rows, the matching 32 up rows] through one nested TDM view, so a wave's 64 columns hold gate and up of the same 32 outputs in the same lanes. - The epilogue rounds the accumulators to bf16 and forms bf16(silu(bf16(min(g, L))) * clamp(u, -L, L)) as aiter silu_and_mul does (L = 0: no clamp), then quantizes each 32-column group with ROCm#7667's emit_mxfp8_acc_pair_to_lds / emit_mxfp8_scale_rows_store; only the e4m3 TDM store stays local, shared with the accumulator-quant epilogue. - Against the bf16 GEMM + silu_and_mul + quantize_fp8 chain, a SwiGLU value can sit one bf16 step from silu_and_mul's (exp/rcp rounding), so an e4m3 code can differ by one step; where that value is its group's amax at 448 * 2**k, the group's e8m0 scale moves by one instead (and so all 32 codes). - The kernel name gets a _silu<limit>q suffix, so it never collides with the plain GEMM; fuse_act_mul defaults to off. Host (batched_gemm_a8w8_gfx1250.py): - run_gate_up_silu_mxfp8_32_gfx1250: the raw launch. Operand dtypes, strides, shapes, devices, alignment, the limit and the kernel name are checked before the arch check; the e8m0 x_scale / w_scale checks run after it. swiglu_limit is read as the f32 silu_and_mul receives. kernel_name=None picks the tile from the runtime row count. - gate_up_silu_supported(n2, k): gfx1250 with the measured CU count at the measured [2I, K]; independent of the row count. - gate_up_silu_kernel_for(m, n2, k): the table tile for the measured device and shape only, else None. A host helper for code that sees the real row count; not for branching in a traced forward. - The table tiles end in _pl (the pipelined K loop). Op (batched_gemm_op_a8w8.py): functional registered op gate_up_silu_mxfp8_32 (mutates_args=[]) that picks the tile from the runtime row count and returns the e4m3 / e8m0 outputs. Tests: op_tests/test_flydsl_gate_up_silu_host.py (CPU: gating, picker, limit and operand validation, functional op under fullgraph dynamic shapes) and test_gate_up_silu_fused in op_tests/test_flydsl_batched_gemm.py (gfx1250: every tile bucket, limits 10, 0 and 5.02, vs the unfused chain). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@valarLip Thanks. Fixed in |
Summary
Two follow-ups to the fused MXFP8 epilogue of the gfx1250 batched mxfp8_32 GEMM (#7178), on main with #7673 (gfx1250 compute-kernel fused epilogue) and #8101 (gfx950 fused quant):
batched_gemm_a8w8_mxscale_bpreshuffle_fused_quantruns the tuned row the bf16 entry uses for the same shape on gfx1250 too ([FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101 does it for gfx950), instead of the runner's heuristic tile.Motivation
wmma_n_repa 32-column group is two adjacent tiles across lanes l and l^16 and its amax needs a singleshuffle_xor(16).Changes
kernels/gemm_a8w8_gfx1250.py: the epilogue has three peer branches:not fuse_quant_out: the bf16 store, unchanged (its LDS staging moved into a small_stage_c_tile()helper shared with the third branch);wmma_n_rep % 2 == 0: quantize from the accumulators. Values are rounded to the output dtype first, exactly as the bf16 path stores them; the amax needs oneshuffle_xor(16). The e4m3 and scale bytes still go through LDS (one barrier) so the global writes are the tile's TDM store and one small store per scale row;The quant setup and the scale addressing (
GN,v2i32_ty,n32_64,srow,sbase_blk) are set up once ahead of the branches for both quant paths.kernels/quant_utils.py: the group-32 MXFP8 steps shared with the 256x256 compute kernel's fused epilogue ([FlyDSL] [gfx1250] Compute GEMM: fused MXFP8 epilogue; untuned prefill-sized batched mxfp8_32 runs the compute kernel #7673), next toemit_mx_e8m0_scale:emit_mxfp8_group32_scale(amax floor, RoundUp e8m0 and its f32 scale; also used by the LDS-staged branch),emit_mxfp8_acc_pair_to_lds(one 32-column group from two adjacent accumulator tiles: round, amax withshuffle_xor(16), scaled fp8 conversion, e4m3 and scale bytes into LDS) andemit_mxfp8_scale_rows_store(LDS scale rows to the row-major scale).kernels/gemm_a8w8_256x256_gfx1250.pynow calls the last two instead of its own copy; each kernel keeps its own e4m3 TDM store.ops/batched_gemm_op_a8w8.py:_fused_quant_tuned_kernel(one function for gfx950 and gfx1250, merged with [FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101's) looks the shape up withlookup_mxscale_bmm_config(same table, same row as the bf16 entry) and passes a flydsl row'skernelNamethrough as is; no row, an opus row, or a gfx1250 compute-kernel row (is_compute_wmma_kernel_name, imported and checked only off gfx950, where no row name can match) keeps the runner's own choice (None). On gfx1250 the runner then picks the tile (since [FlyDSL] [gfx1250] Compute GEMM: fused MXFP8 epilogue; untuned prefill-sized batched mxfp8_32 runs the compute kernel #7673 the compute kernel with its fused epilogue for prefill-sized M, the heuristic bmm tile otherwise); running tuned compute rows on the fused entry is left for a follow-up. Any other name the runner does not accept raises there, as for the bf16 entry. [FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101's gfx950 split-K fallback (_fused_quant_falls_back) is unchanged.kernels/bmm_a8w8_mxscale_gfx950.py: the gfx950 bmm fused epilogue ([FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101) callsemit_mxfp8_group32_scaleinstead of its own copy of the same steps.PR Self-Review
Reviewed revision
d4016d5
Behavior and intent
3fd42598c(rebased from67a2084e2; includes [FlyDSL] [gfx1250] Compute GEMM: fused MXFP8 epilogue; untuned prefill-sized batched mxfp8_32 runs the compute kernel #7673, [FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101, [FlyDSL] [gfx1250] Compute GEMMs: cluster_m as a launch argument, DSv4.1 Flash prefill rows #7868, [FlyDSL] Fix issue 7967:mm_a8w8_mxscale_gfx950: support a K of 32 mod 64 (DeepSeek-V4.1 shared-expert down projection at TP8, K = 288) #8636) (includes [FlyDSL] [gfx1250] Compute GEMM: fused MXFP8 epilogue; untuned prefill-sized batched mxfp8_32 runs the compute kernel #7673 and [FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101) plus six commits: the earlier nine squashed into one that states the final behavior (accumulator quant, three peer branches, fused entry on the tuned row with compute rows left to the runner, tests); the tuned-row CPU test extended to gfx950 rows after the merge with [FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101; the accumulator group-32 quant shared with [FlyDSL] [gfx1250] Compute GEMM: fused MXFP8 epilogue; untuned prefill-sized batched mxfp8_32 runs the compute kernel #7673's epilogue inquant_utils.py; two more pinned accumulator tiles; comment and test-data fixes from review (scale-row copy wording, two stalequant_utils.pydocstrings, the gfx950 fixture row); a second review round (no compute-name import or regex on gfx950, the gfx950 bmm epilogue on the shared group-32 scale helper, two docstrings, four more pinned tuned tiles, a non-256 CU count in the tuned-row fixture).wmma_n_rep(for examplet32x64 nw2,t64x32 nw1,t128x128 nw2,t128x256 nw4) the group amax comes from the accumulators; an oddwmma_n_rep(t16x64 nw4,t32x32 nw2) keeps the [FlyDSL] [gfx1250] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #7178 path. The e4m3 codes and e8m0 scales are the same asquantize_fp8of the bf16 output in both cases. The fused entry runs the same tuned row as the bf16 entry on gfx1250 when that row is a non-compute flydsl kernel; a compute-kernel row (main's DSv4.1 wo_a table has some) is left to the runner's own tile choice, and a flydsl row with a bad name raises instead of silently falling back. gfx950 keeps [FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101's behavior (a flydsl row picks the tile,_fused_quant_falls_backrows run bf16 plus the same quant).Validation and unverified scope
quantize_fp8(amax floor 1e-10, e8m0 round-up): e4m3 codes and e8m0 scales bit-identical over many M including ragged tails, three data sets (all-zero rows, saturating fp8 inputs with large scales, fp8 subnormals and half-sparse rows), CUDA graph capture and replay with new inputs, and with the tuned rows. DeepSeek-V4.1-Flash served end to end with wo_a on the fused entry; GSM8K in line with the baseline.bd6cc9b50, offline gfx1250 compile oflaunch_gemm_a8w8(flydsl 0.5.0, no GPU), final ISA compared: the bf16 path (batched and 2-D mxfp8_32, mxfp8_128, ptpc) is ISA-identical to main; the three-branch restructure is ISA-identical to the head before it. No VGPR spill, no scratch.68071323b(on main0d894387b, before [FlyDSL] [gfx1250] Compute GEMM: fused MXFP8 epilogue; untuned prefill-sized batched mxfp8_32 runs the compute kernel #7673), gfx1250:python op_tests/test_flydsl_batched_gemm.pyexits 0. The compute kernelName cases from main pass; the pinned tilest16x64x512 nw4(LDS-staged) andt32x64x512 nw2/t128x128x256 nw2(accumulator) have 0 scale and 0 fp8 mismatches at M = 48 and M = 200; the heuristic-tile fused cases have 0 mismatches and the fused quant epilogue reports all bit-exact.python -m pytest op_tests/test_bmm_a8w8_fused_quant_tuned_row.py op_tests/test_bmm_a8w8_fused_quant_supported.py: 7 passed. Log in the PR comments.e552b7c00(on main67a2084e2), offline gfx1250 compile (flydsl 0.5.0, no GPU), final ISA compared: the batched kernel's fused-quant variants (LDS-staged and accumulator tiles, includingt160x128x256andt96x128x256) are ISA-identical before and after thequant_utils.pymove; the 256x256 compute kernel (batched and 2-D, fused and bf16) is ISA-identical to main; the batched and 2-D bf16 variants are ISA-identical to main. No VGPR spill, no scratch.python op_tests/test_flydsl_batched_gemm.pyexits 0 with the same accuracy columns and the same fused-quant mismatch counts (all 0) as main67a2084e2;python -m pytest op_tests/test_bmm_a8w8_fused_quant_supported.py op_tests/test_bmm_a8w8_fused_quant_tuned_row.py: 10 passed.test_compute_operand_guardsfails on gfx950 the same way on main (a gfx1250 test, not gated by arch).99d9d6d6f: the last commit changes only comments, docstrings and one test constant; the three kernel files are AST-identical toe552b7c00once docstrings are blanked, so the ISA statements above carry over. gfx950:python op_tests/test_flydsl_batched_gemm.pyoutput is identical toe552b7c00(exit 0, all fused-quant mismatches 0);python -m pytest op_tests/test_bmm_a8w8_fused_quant_supported.py op_tests/test_bmm_a8w8_fused_quant_tuned_row.py: 10 passed.dfc62154e, gfx950:python op_tests/test_flydsl_batched_gemm.pyexits 0 with output identical to99d9d6d6f(all 45 fused-quant lines 0 mismatches, fused quant epilogue all bit-exact); with the final ISA dumped, all 30 fused-quant (_fq) bmm kernels are byte-identical to99d9d6d6f, so the helper call emits the same code.python -m pytest op_tests/test_bmm_a8w8_fused_quant_supported.py op_tests/test_bmm_a8w8_fused_quant_tuned_row.py: 10 passed.dfc62154e, gfx1250 (FlyDSL 0.5.0): results in [FlyDSL] [gfx1250] Batched mxfp8 GEMM fused-quant epilogue: quantize from the accumulators, use the tuned row #7667 (comment).python op_tests/test_flydsl_batched_gemm.pyexits 0: all nineFUSED_QUANT_TILES(two LDS-staged, seven accumulator) have 0 scale and 0 fp8 mismatches at M = 48 and 200, the 45 heuristic-tile fused lines are all 0, and the compute kernelName cases pass; the heuristic sweep at M 1025 and 2048 (B 2 and 8, the 256x256 compute kernel) also has 0 mismatches; and the publicbatched_gemm_a8w8_mxscale_bpreshuffle_fused_quanton eight DSv4.1 wo_a table shapes (B 8, M 2 to 608, both epilogue branches, tile from the real table lookup) is bit-identical to the bf16 entry plusquantize_fp8.f1a3bc230(this head; [FlyDSL] [gfx1250] Batched mxfp8 GEMM fused-quant epilogue: quantize from the accumulators, use the tuned row #7667's six commits rebased onto main3fd42598c, only conflict a test-file one inop_tests/test_flydsl_batched_gemm.py: main's_fused_quant_k()and gfx950 ragged-K block kept): the kernel code of this PR is the same as atdfc62154e(kernels/gemm_a8w8_gfx1250.pyandkernels/quant_utils.pybyte-identical; the patches togemm_a8w8_256x256_gfx1250.py,bmm_a8w8_mxscale_gfx950.py,batched_gemm_a8w8_gfx1250.pyandbatched_gemm_op_a8w8.pyline-identical, on top of main's [FlyDSL] [gfx1250] Compute GEMMs: cluster_m as a launch argument, DSv4.1 Flash prefill rows #7868 / [FlyDSL] Fix issue 7967:mm_a8w8_mxscale_gfx950: support a K of 32 mod 64 (DeepSeek-V4.1 shared-expert down projection at TP8, K = 288) #8636). Offline gfx1250 compile (flydsl 0.5.0, null pointers, no GPU), final ISA: 15 batched-kernel configs (bf16 batched / 2-D / mxfp8_128 / ptpc and the fused LDS-staged and accumulator tiles) byte-identical todfc62154e; the four 256x256 compute configs (bf16 and fused, batched and 2-D) byte-identical to main3fd42598c(as they were to main67a2084e2atdfc62154e); no spill, no scratch. CPU (GPU-less container):test_gemm_host_dispatch_cache.py+test_bmm_a8w8_fused_quant_tuned_row.py+test_bmm_a8w8_fused_quant_supported.py27 passed; the 10 failures (CUDA-only cases) fail the same way on main. black / ruff clean. No idle gfx950 GPU for a rerun; the gfx1250 results ofdfc62154ebelow carry over through the identical ISA.d4016d527: adds one comment-only commit on top off1a3bc230(theFUSED_QUANT_TILESheader now counts two LDS-staged and seven accumulator tiles); no code changes, so every result above forf1a3bc230carries over.ci:gfx1250-ffm-tritonruns only for branches in ROCm/aiter and only the Triton suite plus two FlyDSL tests), so gfx1250 coverage is the manual runs above (this head: the comment linked above).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?
op_tests/test_bmm_a8w8_fused_quant_tuned_row.py: before this PR the fused entry had no tuned-row lookup (every case fails); on earlier heads of this PR the unparsable-name case fails (the entry silently fell back to the heuristic tile while the bf16 entry raises) and the compute-row case fails (the compute kernelName was passed through; before [FlyDSL] [gfx1250] Compute GEMM: fused MXFP8 epilogue; untuned prefill-sized batched mxfp8_32 runs the compute kernel #7673 the runner rejected it withy_scale_out). On main ([FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101) the gfx1250 flydsl-row cases fail (the lookup returns None on every arch but gfx950). No other test calls_fused_quant_tuned_kernel;test_bmm_a8w8_fused_quant_supported.pyonly covers the arch check.op_tests/test_flydsl_batched_gemm.py(gfx1250 pinned tiles): a wrong lane pairing, group column or scale-byte index in either epilogue branch, or a branch picked for the wrongwmma_n_rep, gives e4m3 / e8m0 mismatches againstquantize_fp8of the bf16 GEMM on the same tile. The existingtest_woa_fused_quant_epilogueruns only the heuristic tile, which reaches one branch at most, so it does not pin both.Changed op tests
op_tests/test_flydsl_batched_gemm.py(gfx1250):test_woa_fused_quant_epiloguetakes akernel_name; the bf16 reference and the fused run use the same tile.FUSED_QUANT_TILESruns shipped DSv4.1 tiles that pin both epilogue branches: two LDS-staged tiles (t16x64x512 nw4,t32x32x512 nw2with one group per tile row) and seven accumulator tiles (t32x64x512 nw2,t128x128x256 nw2,t64x32x512 mw4 nw1with one group per tile row,t160x128x256 nw2andt192x128x256 nw2with more tile rows than threads,t128x256x256 mw1 nw4with eight groups per tile row,t96x128x256 nw2) on the DSv4.1 wo_a N/K, at M = 200 (ragged for every tile) and M = 48 (ragged for every tile butt16x64, of which it is a whole number). The last four are tuned wo_a rows the fused entry runs. gfx950 runs only the heuristic-tile fused check ([FlyDSL] [gfx950] flydsl batched mxfp8 GEMM: optional fused mxfp8 quant epilogue #8101), in its own block inmain(). Not redundant: the existing check uses only the heuristic tile, so nothing guaranteed that either branch is reached.op_tests/test_bmm_a8w8_fused_quant_tuned_row.py(new, CPU):_fused_quant_tuned_kernelwithlookup_mxscale_bmm_configpatched to return no row, an opus row, a compute-kernel row (one of main's DSv4.1 wo_a rows), a flydsl row and an unparsable flydsl name on gfx1250, and a flydsl row (the DSv4 batched preshuffle table's row for that shape), an opus row and no row on gfx950; also checks the lookup arguments (bpreshuffle table, weight-scale block, arch, CU count; the gfx1250 fixture uses a CU count other than the gfx950 one). It is the part of this PR that runs in CI.🤖 Generated with Claude Code