Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ggml/src/ggml-cuda/fattn-gemm.cu
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ static __global__ void fattn_gemm_softmax(
}
__syncthreads();
vmax = red[0];
// every thread must have read the max out of red[0] before pass 2 reuses red for the row sum:
// without this barrier warp 0 can store its partial sum into red[0] first, a late warp then
// takes that sum as the row max, and exp(v - m) is wrong for its keys -- run-to-run drift in
// fp32, and in fp16 a probability that overflows to inf and NaNs the output
__syncthreads();
}

const float m_old = m_state[h*nt + t];
Expand Down