Repository navigation
[HIP] Fix mxfp4 MoE aux sort build on gfx1250 - #8164
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 |
|
@aiter-bot review |
|
aiter-bot — queued behind 3 review(s); expect to start in about 79 min. The box reviews one PR at a time. |
aiter-bot
left a comment
There was a problem hiding this comment.
ROCm/aiter PR #8164 — [HIP] Fix mxfp4 MoE aux sort build on gfx1250
Review (advisory):
Validation (deterministic): NOT RUN — the PR changes runtime code that is executed at run time (the gfx1250 mxfp4 MoE aux-sort scan in csrc/kernels/mxfp4_moe/moe_aux/moe_sort_quant.cuh) but ships no test target for the validator to run; compile-level checks re-derived by hand on this box: base fails to assemble for gfx1250 with #8133's exact error, head builds clean for gfx1250 and gfx950, head's gfx950 device assembly is identical to base modulo the __hip_cuid hash, and the readlane carry is proven equal to the removed row_bcast pair by host simulation (300k random waves incl. negatives, wave64 and wave32, 28.8M lane-checks, 0 mismatches).
Perf (advisory): NOT RUN — Step 1 triaged perf as required but the PR ships no perf target; the in-repo benchmark (op_tests/op_benchmarks/hip/bench_mxfp4_moe_sort_quant.py) could not be run from this review box (no GPU access), and on gfx942/gfx950 the emitted sort code is unchanged, so gfx1250 is the only arch where a number could move.
Size: 25 lines / 1 files
Design (advisory): NONE — re-applies the #7540 gfx1250 row_bcast-removal pattern already landed for moe_sorting_opus
Human: N/A — design is NONE: the diff applies an existing, twice-landed pattern and decides nothing new
📝 [verified] csrc/include/dpp_scan.h:47 still carries the same unguarded GFX9-only row_bcast (0x142/0x143) this PR arch-gates out of moe_sort_quant.cuh: a minimal TU instantiating wave_inclusive_sum_dpp fails to assemble for gfx1250 with #8133's exact error, though no current TU instantiates it there (both module_top_k_per_row TUs build clean for gfx1250 — the wave64-only kernels that call it are preprocessor-gated off, and topk_sampled traps non-gfx950 passes), so a future gfx1250 caller of that shared helper hits the same build break this PR just fixed. Reviewer should ask whether dpp_scan.h should get the same GFX9 guard now rather than at the next #8133.
|
ci failed |
dpp_inclusive_scan_wave used DPP row_bcast:15/31, which exists only on
GFX9, so module_moe_mxfp4_aux failed to build for gfx1250 ("Invalid
dpp_ctrl value: broadcasts are not supported on GFX10+"). Keep the GFX9
path; elsewhere add the earlier 16-lane rows' totals with readlane, as
#7540 did for moe_sorting_opus.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
a7ddb49 to
b874e0b
Compare
Motivation
Fixes #8133:
module_moe_mxfp4_auxfails to build for gfx1250:Technical Details
dpp_inclusive_scan_waveincsrc/kernels/mxfp4_moe/moe_aux/moe_sort_quant.cuhused DPProw_bcast:15androw_bcast:31(0x142,0x143), which exist only on GFX9. #7540 fixed the same bug inmoe_sorting_opus, and this PR uses the same fix:readlane.parallel_cumsumalready sizes its waves withWARP_SIZE(opus::get_warp_size(), 32 on gfx1250). The worst case is E=896, which is 28 waves; itsstatic_assertstill holds.The 36 failed gfx1250 MoE AOT replays in #8133 are not caused by this build failure. They fail at
assert slot_width <= 128inmxfp4_preshuffle_gfx1250_tdm.py, which is tracked as #8162. With this fix in place, row 68 oftuned_grouped_fmoe.csvstill fails, and the traceback ends at that assertion. The gfx1250 grouped path never buildsmodule_moe_mxfp4_aux. A failed JIT build raisesRuntimeError, not an emptyAssertionError.Test Plan / Result
On gfx1250, ROCm 10.1 SDK image:
Module build: with
GPU_ARCHS=gfx1250,origin/mainfails with the ld.lld error above. With this PR the full module builds (about 43 s).Scan unit test: compiled
dpp_inclusive_scan_waveandparallel_cumsumand compared them on the GPU with a host reference. That covers 4 random 1024-lane inputs, including negative values, and E = 24, 33, 96, 128, 129, 256, 257, 385, 513 and 896. All pass.End-to-end aux sort: compared
fused_moe._adaptive_moe_sortoutput with routes computed on the host. Checked fields:num_valid_idssorted_expert_idsm_indicesreverse_sortedmoe_bufCovered:
num_local_tokensResult: 400/400 pass. With the cross-row carry deliberately removed, all 200 BM16 cases fail.
gfx950: the device assembly of a sort instance is identical before and after; only the per-file
__hip_cuidhash differs. The full module also builds for gfx950.🤖 Generated with Claude Code