Skip to content

Commit 696343e

Browse files
committed
opencl: add comment about workgroup size
1 parent 5bca5cc commit 696343e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ggml/src/ggml-opencl/kernels/rms_norm.cl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ kernel void kernel_rms_norm_mul(
134134
src1 = src1 + offset1;
135135
dst = dst + offsetd;
136136

137+
// The size of sum is sizeof(float)*subgroup_size.
138+
// Each subgroup writes its partial sum to this array.
139+
// So the number of subgroups per workgroup for this kernel cannot exceed the subgroup size.
140+
// This is generally true -
141+
// for subgroup size 64, workgroup size should be less than 4096 (the max is usually 1024).
137142
if (get_sub_group_id() == 0) {
138143
sum[get_sub_group_local_id()] = 0.0f;
139144
}

0 commit comments

Comments
 (0)