From: Georgi Gerganov Date: Tue, 11 Jun 2024 14:39:01 +0000 (+0300) Subject: cuda : fix bounds check for src0 rows in MMVQ kernel (whisper/2231) X-Git-Tag: upstream/0.0.1642~573 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=dae7aa62e4d8a448632d7933475342866440769f;p=pkg%2Fggml%2Fsources%2Fggml cuda : fix bounds check for src0 rows in MMVQ kernel (whisper/2231) * cuda : fix bounds check for src0 rows in MMVQ kernel * Update ggml-cuda/mmvq.cu Co-authored-by: Johannes Gäßler --------- Co-authored-by: Johannes Gäßler --- diff --git a/src/ggml-cuda/mmvq.cu b/src/ggml-cuda/mmvq.cu index 5f056e91..e8d15716 100644 --- a/src/ggml-cuda/mmvq.cu +++ b/src/ggml-cuda/mmvq.cu @@ -117,7 +117,7 @@ static __global__ void mul_mat_vec_q( tmp[j][i] = warp_reduce_sum(tmp[j][i]); } - if (threadIdx.x < rows_per_cuda_block) { + if (threadIdx.x < rows_per_cuda_block && (rows_per_cuda_block == 1 || row0 + threadIdx.x < nrows_dst)) { dst[j*nrows_dst + row0 + threadIdx.x] = tmp[j][threadIdx.x]; } }