]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : use the same threshold for OpenBLAS and ggml thread limiting (#577)
authorMaƫl Kerbiriou <redacted>
Wed, 29 Mar 2023 16:10:07 +0000 (18:10 +0200)
committerGitHub <redacted>
Wed, 29 Mar 2023 16:10:07 +0000 (19:10 +0300)
llama.cpp

index 2d0279258740ac4095e7013f945bd4072288e48f..aa0c362d91b1ffd9ed1c7ec95436b9d0497304b0 100644 (file)
--- a/llama.cpp
+++ b/llama.cpp
@@ -856,7 +856,7 @@ static bool llama_eval_internal(
     // for big prompts, if BLAS is enabled, it is better to use only one thread
     // otherwise, the threads are spin-lock waiting for the BLAS calls and are degrading the performance
     ggml_cgraph gf = {};
-    gf.n_threads = N > 255 && ggml_cpu_has_blas() ? 1 : n_threads;
+    gf.n_threads = N >= 32 && ggml_cpu_has_blas() ? 1 : n_threads;
 
     struct ggml_tensor * embd = ggml_new_tensor_1d(ctx0, GGML_TYPE_I32, N);
     memcpy(embd->data, tokens, N*ggml_element_size(embd));