Files
project_6/ex_engine/csrc
project6 c5dfaee98a fix(MoE): rewrite topk kernel — 1 block/row, shared mem, warp-agnostic
Root cause: BI-V100 warp size may be 64 (not 32). Old kernel used
dim3(32,4) assuming 4 independent warps per block, but with warpSize=64
two rows shared the same warp → __shfl_sync mixed their data.

Debug proof: Row 0 == Row 1, Row 2 == Row 3 (identical outputs).
Even rows correct, odd rows duplicated.

Fix: 1 block = 1 row = 64 threads (1 per expert). All reductions
use shared memory (block_reduce_max/sum/argmax) instead of warp
shuffle. Zero warp-size dependency.
2026-08-10 08:03:08 +00:00
..