Skip to content

Commit 10b4f82

Browse files
authored
Added comments explaining thread block size selection logic based on row count and column size, derived from historical commit context (#18212)
1 parent 408616a commit 10b4f82

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ggml/src/ggml-cuda/mean.cu

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ void ggml_cuda_op_mean(ggml_backend_cuda_context & ctx, ggml_tensor * dst) {
6363

6464
const int id = ggml_cuda_get_device();
6565
const int nsm = ggml_cuda_info().devices[id].nsm;
66+
67+
// Heuristic for block size selection to optimize occupancy.
68+
// See discussion in: https://github.com/ggml-org/llama.cpp/pull/15132
6669
if ((nrows / nsm) < 2) {
6770
const dim3 block_dims(512, 1, 1);
6871
reduce_rows_f32</*norm=*/true><<<block_nums, block_dims, 0, stream>>>(src0_d, dst_d, ncols);

0 commit comments

Comments
 (0)