From: Georgi Gerganov Date: Mon, 10 Nov 2025 19:33:35 +0000 (+0200) Subject: metal : cap threadgroups size of set_rows (llama/17146) X-Git-Tag: upstream/0.9.4.395~202 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=8832578bc54cbc668c033de9a688d0778a405029;p=pkg%2Fggml%2Fsources%2Fggml metal : cap threadgroups size of set_rows (llama/17146) --- diff --git a/src/ggml-metal/ggml-metal-ops.cpp b/src/ggml-metal/ggml-metal-ops.cpp index 7a85edbd..5a8f150a 100644 --- a/src/ggml-metal/ggml-metal-ops.cpp +++ b/src/ggml-metal/ggml-metal-ops.cpp @@ -1036,6 +1036,11 @@ int ggml_metal_op_set_rows(ggml_metal_op_t ctx, int idx) { nth = std::min(nth, nk0); + if (nth*nrptg > ggml_metal_pipeline_max_theads_per_threadgroup(pipeline)) { + nth = ggml_metal_pipeline_max_theads_per_threadgroup(pipeline); + nrptg = 1; + } + ggml_metal_kargs_set_rows args = { /*.nk0 =*/ nk0, /*.ne01 =*/ ne01,