]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
CUDA: Fix data-races when reusing SMEM in block_reduce (#26385)
authorOliver Simons <redacted>
Mon, 3 Aug 2026 12:22:44 +0000 (14:22 +0200)
committerGitHub <redacted>
Mon, 3 Aug 2026 12:22:44 +0000 (14:22 +0200)
commit9bd4c09ea571a9020f30eeef169b552625b5b5a4
treefa12c148da1dc06754aa780b471b5a7612711daa
parent0b14b87d7c20cb753b94b96854dd7b45306fc696
CUDA: Fix data-races when reusing SMEM in block_reduce (#26385)

* CUDA: Fix data-races when reusing block_reduce

block_reduce currently doesn't resync after reading from SMEM, causing
potential data-races when reusing SMEM for multiple reductions.

One may consider simply always adding this in block_reduce, but this
comes at a potential perf cost

* double-buffering for single-row softmax

* double-buffering for norm as well

* Add comment

* Add explanatory comment to block_reduce

* Specify need for + do memory barrier only in multi-warp scenario

* Implement review-suggestion from @gaugarg-nv
ggml/src/ggml-cuda/common.cuh
ggml/src/ggml-cuda/norm.cu
ggml/src/ggml-cuda/softmax.cu