]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
CUDA: Fix data-races when reusing SMEM in block_reduce (llama/26385)
authorOliver Simons <redacted>
Mon, 3 Aug 2026 12:22:44 +0000 (14:22 +0200)
committerGeorgi Gerganov <redacted>
Tue, 4 Aug 2026 10:37:47 +0000 (13:37 +0300)
commit3fee8a1e05a2ce904e12c6caf0e4c5b70701a6d2
treeb231bee20f1115742abcf549b4046976ba9a1d87
parente5f6c74112740c05d50c9f82c241525ec6d7680c
CUDA: Fix data-races when reusing SMEM in block_reduce (llama/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