Files
nvfp4-megamoe-kernel/dsv4/kernels/cuda
biondizzle 7d41f4861a Fix indexer score kernel: use static shared memory, correct FP4 head offsets
Root cause of Xid 13 crash: extern __shared__ with reinterpret_cast
chain caused alignment faults on SM100. Switched to static __shared__
arrays (s_heap_scores[1024], s_heap_blocks[1024], s_w[64], s_lock).

Also fixed the FP4 key addressing: keys are stored flat as
[num_blocks, epb, n_h*c_I/2] total bytes per entry. Head h starts
at byte offset h*(c_I/2) and group offset h*(c_I/16) within each
entry. Previous code used per-head n_groups indexing which was wrong
for the flat layout.

Kernel now runs successfully on B200. FP4 quantization noise causes
ranking differences vs FP32 oracle (expected — the tcgen05 FP4 MMA
path with FP32 accumulation will fix this). Top-k structure and heap
logic verified correct via separate heap-only test (exact match vs torch.topk).
2026-05-22 01:45:05 +00:00
..