Skip to content

Commit 13730c1

Browse files
authored
metal : cap threadgroups size of set_rows (#17146)
1 parent 967eb4b commit 13730c1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ggml/src/ggml-metal/ggml-metal-ops.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,11 @@ int ggml_metal_op_set_rows(ggml_metal_op_t ctx, int idx) {
10361036

10371037
nth = std::min(nth, nk0);
10381038

1039+
if (nth*nrptg > ggml_metal_pipeline_max_theads_per_threadgroup(pipeline)) {
1040+
nth = ggml_metal_pipeline_max_theads_per_threadgroup(pipeline);
1041+
nrptg = 1;
1042+
}
1043+
10391044
ggml_metal_kargs_set_rows args = {
10401045
/*.nk0 =*/ nk0,
10411046
/*.ne01 =*/ ne01,

0 commit comments

Comments
 (0)