Repository navigation
Stop reporting a fast-kernel failure that never ran in test_topk_row_prefill - #6479
Conversation
…prefill `top_k_per_row_prefill_fast` is only called under `if get_gfx() == "gfx942"`, but everything downstream consumed its results unconditionally. On every other arch the kernel is never launched, so `indices_fast` keeps the `-1` fill it was allocated with and `us_fast` keeps its `1e6` sentinel -- and the test then compares that buffer against `torch.topk` and derives a speedup from the sentinel. A gfx950 run reports `2048 invalid indices` per row, `correct=False`, `0.000x` speedup and `-2831676.54%` improvement for a kernel that was never on the GPU, which reads as a kernel bug. Hoist the arch test into `fast_supported` and gate every consumer on it: the `indices_fast` dump, the correctness comparison, the speedup and improvement math, the terminal summary, and the four result columns. Unsupported now yields `None` rather than a sentinel, so the summary DataFrame and `prefill_topk.csv` no longer carry fabricated `1000000.0` / `0.00x` / `False` values. The gfx942 path is unchanged except that a kernel reporting `us_fast == 0` now gives `None` instead of `0.0`. Also fail loudly on an unimplemented `data_generation`. `create_random_logits` only implements `random` and `10LSBits`, yet `load_pt` and `threshold_bin_data` were both offered in `choices`; either one fell through to the shared `-inf` epilogue and died with an `UnboundLocalError` on `logits` at a line that has nothing to do with the cause. Add the missing `else: raise` and narrow `choices` to what exists.
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
fast_supported only means the kernel exists. A zero timing still left speedup as None, and the summary then compared and formatted that None. Co-authored-by: Cursor <[email protected]>
fast_timed can be true while improvement_pct stays None, and formatting that None aborted the run before the CSV was written. Co-authored-by: Cursor <[email protected]>
top_k_per_row_prefill_fastis only called underif get_gfx() == "gfx942", but everything downstream consumed its results unconditionally. On every other arch the kernel is never launched, soindices_fastkeeps the-1fill it was allocated with andus_fastkeeps its1e6sentinel -- and the test then compares that buffer againsttorch.topkand derives a speedup from the sentinel. A gfx950 run reports2048 invalid indicesper row,correct=False,0.000xspeedup and-2831676.54%improvement for a kernel that was never on the GPU, which reads as a kernel bug.Hoist the arch test into
fast_supportedand gate every consumer on it: theindices_fastdump, the correctness comparison, the speedup and improvement math, the terminal summary, and the four result columns. Unsupported now yieldsNonerather than a sentinel, so the summary DataFrame andprefill_topk.csvno longer carry fabricated1000000.0/0.00x/Falsevalues. The gfx942 path is unchanged except that a kernel reportingus_fast == 0now givesNoneinstead of0.0.Also fail loudly on an unimplemented
data_generation.create_random_logitsonly implementsrandomand10LSBits, yetload_ptandthreshold_bin_datawere both offered inchoices; either one fell through to the shared-infepilogue and died with anUnboundLocalErroronlogitsat a line that has nothing to do with the cause. Add the missingelse: raiseand narrowchoicesto what exists.Motivation
Technical Details
Test Plan
Test Result
Submission Checklist