From 869460a932f0c202d06eae66849f71753ac42958 Mon Sep 17 00:00:00 2001 From: biondizzle Date: Thu, 28 May 2026 23:54:30 +0000 Subject: [PATCH] debug: add LSE verification and merge debug prints --- tests/unit/test_fmha_6warp_multirow.cu | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/unit/test_fmha_6warp_multirow.cu b/tests/unit/test_fmha_6warp_multirow.cu index 5539b9dc..b6afcd38 100644 --- a/tests/unit/test_fmha_6warp_multirow.cu +++ b/tests/unit/test_fmha_6warp_multirow.cu @@ -144,6 +144,9 @@ static int test_single(int T, int n_h = 1, int batch = 1) { cs /= (sqrtf(na)*sqrtf(nb)+1e-10f); if(cs 0.01f) { printf(" FAIL LSE b=%d h=%d t=%d kernel=%.6f ref=%.6f err=%.6f\n",b,h,t,h_lse[idx*T+t],lse_ref[t],lse_err); failed++; } } } } @@ -218,6 +221,13 @@ static int test_multitile_merge(int T) { free(h_o_tile); } + // Debug: print first LSE values per tile + for (int tile = 0; tile < N_TILES; tile++) { + printf(" tile %d lse[0]=%.6f", tile, lse_per_tile[tile * T]); + if (T > 1) printf(" lse[1]=%.6f", lse_per_tile[tile * T + 1]); + printf("\n"); + } + // Python KV merge with normalized O + LSE: // O = Σ exp(lse_i - L) * O_i_norm / Σ exp(lse_i - L) // where L = max(lse_i) for numerical stability