summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorslaren <slarengh@gmail.com>2024-03-03 14:26:18 +0100
committerGitHub <noreply@github.com>2024-03-03 14:26:18 +0100
commit67be2ce1015d070b3b2cd488bcb041eefb61de72 (patch)
treed9678b02e872c9218890348802e9b65cbf9710de
parent231ae28f078c3148d097b301f2145f1e3e816cc1 (diff)
cuda : fix data race in soft max (#5853)
-rw-r--r--ggml-cuda.cu1
1 files changed, 1 insertions, 0 deletions
diff --git a/ggml-cuda.cu b/ggml-cuda.cu
index 7ed97430..04c6cb1b 100644
--- a/ggml-cuda.cu
+++ b/ggml-cuda.cu
@@ -6904,6 +6904,7 @@ static __global__ void soft_max_f32(const float * x, const float * mask, const f
// find the sum of exps in the block
tmp = warp_reduce_sum(tmp);
if (block_size > WARP_SIZE) {
+ __syncthreads();
if (warp_id == 0) {
buf_iw[lane_id] = 0.0f;
}