Repository navigation
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
87d9ffd to
ad4ab51
Compare
Extends the gfx950 OPUS MXFP8 blockscale GEMM (FP8 A / B, E8M0 scales 1x128 for A and 128x128 for B, BF16 C) from NT to the three other operand layouts, without a transpose copy. Stacked on PR ROCm#7387. - One pipeline / traits pair for the three directions: opus_gemm_pipeline_mxfp8_4wave_gfx950.cuh / opus_gemm_traits_mxfp8_4wave_gfx950.cuh. Each operand picks its LDS path from its storage: A_T (A stored [K, M]) and B_T (B stored [K, N]) read with ds_read_tr8; NN = (0, 1), TT = (1, 0), TN = (1, 1). 2x2 waves, LDS-DMA copies, A / B and part of C pinned to AGPRs; TR8 reads use the ds_read_tr8 builtin so their results land in AGPRs. - Traits <BM, BN, PadM, GroupM>: 256x256 or 256x128 tiles, optional PadM, GroupM 0 (2x2 raster) / 4 / 8 / 16 as NT's gm. - CO kids 56-85, appended to co_kernels_gfx950_a8w8_blockscale_bpreshuffle.json; images and build records in gen_co/gfx950/a8w8_blockscale_bpreshuffle/ (pin toolchain, 0 spills): 56-67 NN / TT / TN x {256x256, 256x256 PadM, 256x128, 256x128 PadM} 68-85 NN / TT / TN x {256x256, 256x128} x GroupM {4, 8, 16} - Same kargs and launcher family as NT (a8w8_blockscale_bpreshuffle); the direction comes from the kernel name (_mxfp8_(nn|tt|tn)_) and the generated launcher checks that direction's operand / scale strides. - Called through the public exact-kid entry opus_gemm(..., family= "a8w8_blockscale_bpreshuffle", layout="bpreshuffle", kid=56..85); a tensor layout of another direction is rejected by the launcher's stride check. The shape heuristic / tuner never pick the direction kids. Like the other gfx950 MXFP8 kids they are compiled on request (tuned rows, the compiled-kids sidecar or opus_gemm_tune._ensure_kids_compiled), not by default. - build_co: the pin check of the direction kids accepts AGPR ranges filled by plain or TR8 LDS reads. - test_opus_co_integration.py: NN / TT / TN kids (256x256 across the scale panel, 256x128 PadM, GroupM 16) against a torch reference, and another direction's launcher rejecting the strides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ad4ab51 to
8673a97
Compare
… TT / TN - aiter.ops.opus.gemm_a8w8_blockscale_bpreshuffle_opus(XQ, WQ, x_scale, w_scale, dtype, *, kernelId=None, out=None): reads NN / TT / TN from the operand strides, rejects NT, and picks a kid by shape when kernelId is not given (256x128 for N % 256 or outputs up to 2048 x 2048, GroupM 16 from M = 16384, PadM only when M % 256). - default_compiled_keys adds kids 56-85 on gfx950, so the API runs on a fresh JIT build; no tuned row or heuristic requests these kids. - test_opus_co_integration: every kid 56-85 against the reference, plus API tests (shape-picked kid per layout, explicit kernelId + out, NT and unsupported-shape rejection). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…T / TN Merge _BPRESHUFFLE_ARGUMENTS and _mxfp8_direction_arguments into one _bpreshuffle_arguments(direction) template; only the XQ/WQ layout check, the scale layout check and stride_a / stride_b / stride_sfb differ per direction. Read the direction from the CO manifest "pipeline" field instead of matching the kernel name. Generated NT sources (8784 instances) are byte-identical; the 30 NN/TT/TN sources differ by one line break only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Adds the NN, TT and TN operand layouts to the gfx950 OPUS MXFP8 1x128 blockscale GEMM with B preshuffle (the NT kernel from #6696 / #7387), so callers whose A is stored
[K, M]or whose B is stored[K, N]run directly, with no transpose copy.Details
One pipeline for three layouts:
opus_gemm_pipeline_mxfp8_4wave_gfx950.cuh/opus_gemm_traits_mxfp8_4wave_gfx 950.cuh. Each operand picks its LDS path by its storage:A_T(A stored[K, M]) andB_T(B stored[K, N]) read withds_read_b64_tr_b8. NN = (0, 1), TT = (1, 0), TN = (1, 1). 2x2 waves, LDS-DMA copies, A / B and part of C pinned to AGPRs.Formats: same as NT. FP8 A / B, E8M0 scales (1x128 for A, 128x128 for B), BF16 C. B is the
shuffle_weight(layout=(16, 16))of its own storage ([N, K]or[K, N]).Interface: the existing exact-kid entry
opus_gemm(..., family="a8w8_blockscale_bpreshuffle", layout="bpreshuffle", kid=...). The direction comes from the kernel name; the generated launcher checks that direction's operand / scale strides, so a tensor of another layout is rejected. The shape heuristic and the NT tuner never pick these kids, sodefault_compiled_keysadds them to the gfx950 compile set.Performance
MI355X (gfx950, CU256), BF16 output. NT is the fastest NT CO kernel for the shape; NN / TT / TN are each direction's fastest kid. All four run in the same process, alternated over 3 rounds (min, spread <= 2.6%).
| Shape (M x N x K) | NN (us / vs NT) | TT (us / vs NT) | TN (us / vs NT) |
|---|---|---|---|---|
| 16384 x 16384 x 16384 | -6.6% | +3.1% | +1.1% |
| 8192 x 8192 x 8192 | +1.0% | +2.6% | +3.4% |
| 4096 x 4096 x 4096 | +2.9% | +2.0% | +2.8% |
| 2048 x 7168 x 7168 | +2.9% | +1.9% | +1.7% |
| 8192 x 7168 x 2048 | +3.2% | +2.3% | +2.5% |
Test Plan
op_tests/test_opus_a8w8_interface.py: 8 passed.op_tests/test_opus_co_integration.py -k gfx950: 38 passed.