From 5f4856d771c813b60c3c7d859661248bafa6495d Mon Sep 17 00:00:00 2001 From: biondizzle Date: Sat, 30 May 2026 08:53:50 +0000 Subject: [PATCH] =?UTF-8?q?P5:=20fix=20sOacc=20init=20race=20=E2=80=94=20u?= =?UTF-8?q?se=20single=20thread=20(tid=3D=3D0)=20instead=20of=204=20softma?= =?UTF-8?q?x=20warps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dsv4/kernels/attention/fmha_6warp_multihead.cuh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dsv4/kernels/attention/fmha_6warp_multihead.cuh b/dsv4/kernels/attention/fmha_6warp_multihead.cuh index 8d5094c7..9d19e4b8 100644 --- a/dsv4/kernels/attention/fmha_6warp_multihead.cuh +++ b/dsv4/kernels/attention/fmha_6warp_multihead.cuh @@ -128,11 +128,11 @@ fmha_6warp_multihead_kernel(FmhaParams params) { float* s_p_vals = (float*)(sV + V_SUB_SZ); float* sOacc = (float*)(((uintptr_t)(s_p_vals + SK_TILE) + 15) & ~(uintptr_t)15); - // Initialize accumulator - if (is_softmax_warp && lane == 0) { + // Initialize accumulator (single thread to avoid race) + if (tid == 0) { *sRowMax = -INFINITY; *sRowSum = 0.0f; - for (int d = lane; d < HD; d += 32) sOacc[d] = 0.0f; + for (int d = 0; d < HD; d++) sOacc[d] = 0.0f; } // TMEM allocation