KernelBench hard · RTX PRO 6000

TopK Bitonic GPT-5.6 Sol

2.95%geomean peak fraction across shapes

manually audited: clean

Genuine custom top-k: CUDA C++ via load_inline (CUB BlockRadixSort for the final candidate sort only — no torch.topk/sort anywhere; check.py's forbidden-op grep passed) plus a tiny Triton argmax for k=1. Core idea is bounded candidate selection: compute per-row RMS in a first pass (which doubles as an L2 prefetch of the cold input), threshold at Z*sigma (Z tuned 2.5-2.7 by k) to compact a small tail superset into shared memory, then block-radix-sort just the candidates. If the candidate count falls outside [K, capacity] — i.e. any non-Gaussian or adversarial distribution — an exact single-thread insertion-select fallback runs instead, so the algorithm is exact in all regimes, fast on the graded randn regime. The batch=1 n=131k k=64 shape gets a two-kernel split (per-4k-tile 3-sigma tail stage with overflow flag -> single-block merge sort, exact fallback on overflow/underflow). One deliberate tolerance-aware choice: radix sort uses begin_bit=10 (drops the low 10 mantissa bits), so near-equal values (within ~1e-4 rel) can emerge order-swapped — exactly what the problem's stated 1e-4 abs/rel value tolerance + lenient index check permit; output VALUES themselves are exact, only ordering among ties-within-tol is approximate. Gray-area spec-surfing, not a grader hack. peak_fraction 0.0414 sits in the normal launch-overhead-bound band for this problem. template_mutated=false.

harnesscodex (H100, Lambda shadeform node, live CUDA)

20260721_145325_codex_gpt-5.6-sol_05_topk_bitonic