]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
metal : cap threadgroups size of set_rows (llama/17146)
authorGeorgi Gerganov <redacted>
Mon, 10 Nov 2025 19:33:35 +0000 (21:33 +0200)
committerGeorgi Gerganov <redacted>
Mon, 17 Nov 2025 13:34:43 +0000 (15:34 +0200)
src/ggml-metal/ggml-metal-ops.cpp

index 7a85edbdcdb84385f4903f7d8e519988faf1e630..5a8f150a71d9def9665d982a41b6f63c4d7bb123 100644 (file)
@@ -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,