Repository navigation
[FlyDSL] [Perf] Enable small-k row top-k on gfx1250 - #7878
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 |
Co-authored-by: Cursor <cursoragent@cursor.com>
99c2607 to
59ca394
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
* [FlyDSL] [Perf] Enable small-k row selector on wave32 Co-authored-by: Cursor <cursoragent@cursor.com> * [CI] Sort wave32 top-k imports Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Allow the existing
topk_per_row_small_knarrowing selector to build on wave32. ROCm ballots still return an i64 mask on wave32 with the high half clear, so the existing low/high mask storage, lane shifts, threshold search, and tie ordering work unchanged.This enables the selector on gfx1250 without changing gfx942/gfx950 behavior.
MiniMax-M3 results
MI455X e15-09 GPU0, exact ordered top-16 with forced local blocks, paired against ATOM Triton selectors:
With ATOM score + sparse-table emit included, a workload/CU-gated dispatch improves the 22 production prefill shapes by 1.045x aggregate; long shapes improve 11.8-12.9%, and DPEP q2K-q32K improves 9.2-15.6%.
Validation
ATOM integration is a separate stacked change.
Made with Cursor
PR Self-Review
Reviewed revision
ce3681929fe19dd2c0e34bc392388fcf331a2496Behavior and intent
The existing small-k row selector rejected every wave32 build even though its i64 ballot representation is valid there: ROCm leaves the upper 32 ballot bits clear, and the kernel already stores/reconstructs the low and high halves separately. This change permits wave32 while preserving the wave64 code path, threshold search, survivor bound, forced-block pins, and larger-column tie rule. The purpose is to let gfx1250 use the existing narrowing algorithm instead of sorting a wide score row tile by tile.
Validation and unverified scope
Validated on one MI455X/gfx1250 GPU with FP32 score rows and top-k 16:
The PR does not change selector dispatch policy in aiter and does not claim performance for arbitrary wave32 GPUs or k values other than the measured MiniMax-M3 top-16 use. gfx1250 integration and workload/CU gating live in ROCm/ATOM#2971.
PR-specific question
Before this PR,
build_topk_per_row_small_k_module(..., wave_size=32)failed immediately withValueError, so no gfx1250 correctness or performance test could reach the kernel. Existing gfx942/gfx950 coverage exercises only wave64 and therefore cannot detect a broken wave32 ballot/mask path. The added gfx1250 entry makes the canonical distribution and ragged matrices execute that previously rejected path.Changed op tests
op_tests/test_flydsl_topk_per_row_small_k.pyadds gfx1250 to the supported architecture list. This is necessary and non-redundant because the file is the canonical oracle/performance matrix for this selector: it covers adversarial ascending rows, FP8-like tied distributions, forced blocks, ragged lengths, and exact tie ordering. No other op test previously instantiated this kernel with wave32.