]> git.djapps.eu Git - pkg/ggml/sources/ggml/commitdiff
metal : tune soft_max number of threads (whisper/0)
authorGeorgi Gerganov <redacted>
Mon, 13 May 2024 08:01:07 +0000 (11:01 +0300)
committerGeorgi Gerganov <redacted>
Tue, 14 May 2024 12:31:03 +0000 (15:31 +0300)
src/ggml-metal.m

index 28dec762a8a440b6aaa0a6959f98e32a73a24989..bfa352c3a9aa92c0e82d3aede41fa10ff1c3b054 100644 (file)
@@ -1378,7 +1378,7 @@ static enum ggml_status ggml_metal_graph_compute(
                         const bool use_f16 = (src1 && src1->type == GGML_TYPE_F16);
 
                         if (ne00%4 == 0) {
-                            while (nth < ne00/4 && nth < 256) {
+                            while (nth < ne00/4 && nth*ne01*ne02*ne03 < 256) {
                                 nth *= 2;
                             }
                             if (use_f16) {
@@ -1387,7 +1387,7 @@ static enum ggml_status ggml_metal_graph_compute(
                                 pipeline = ctx->kernels[GGML_METAL_KERNEL_TYPE_SOFT_MAX_F32_4].pipeline;
                             }
                         } else {
-                            while (nth < ne00 && nth < 1024) {
+                            while (nth < ne00 && nth*ne01*ne02*ne03 < 256) {
                                 nth *= 2;
                             }
                             if (use_f16) {