]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
CUDA: fix bug in topk-moe softmax (llama/16711)
authorAman Gupta <redacted>
Wed, 22 Oct 2025 04:33:08 +0000 (12:33 +0800)
committerGeorgi Gerganov <redacted>
Sat, 1 Nov 2025 07:41:35 +0000 (09:41 +0200)
src/ggml-cuda/topk-moe.cu

index d782ad948d2547a734a28a737a0ad5275d37eea7..e28c810ac5df7b7fb4c7e89b10e7de4014795cf5 100644 (file)
@@ -141,7 +141,7 @@ __launch_bounds__(4 * WARP_SIZE, 1) __global__ void topk_moe_cuda(const float *
         wt_sum              = warp_reduce_sum(wt_sum);
         const float inv_sum = 1.0f / wt_sum;
 
-        for (int i = threadIdx.x; i < n_expert_used; i += WARP_SIZE) {
+        for (int i = 0; i < experts_per_thread; i++) {
             output_weights[i] *= inv_sum;
         }
     }