BREAKTHROUGH: Found the real bug!
Each epilogue thread owns only 32 of 128 columns per row (4 warps partition the 128 columns). The scalar row_max is max of 32 elements (not global row max). The scalar row_sum is sum of 32 P values (not all 128). Evidence: kernel row_sum=5.5 for row 0, correct=29.22, ratio=5.3x (128/32 = 4, but the P values arent uniformly distributed so not exact). Fix: need warp reduce across the 4 threads that own the same rows columns. CUTLASS FMHA uses utils.sm100 warp-reduce helpers for this exact reason.
This commit is contained in: