File tree 1 file changed +6
-1
lines changed 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2942,7 +2942,12 @@ static bool llama_eval_internal(
2942
2942
2943
2943
// for big prompts, if BLAS is enabled, it is better to use only one thread
2944
2944
// otherwise, the threads are spin-lock waiting for the BLAS calls and are degrading the performance
2945
- n_threads = N >= 32 && ggml_cpu_has_blas () && !ggml_cpu_has_gpublas () ? 1 : n_threads;
2945
+ // TODO: this is mostly important for Apple Silicon where CBLAS is still performing very well
2946
+ // we still need some threads to process all non-mul_mat ops, but not too much to avoid interfering
2947
+ // with the BLAS calls. need a better solution
2948
+ if (N >= 32 && ggml_cpu_has_blas () && !ggml_cpu_has_gpublas ()) {
2949
+ n_threads = std::min (4 , n_threads);
2950
+ }
2946
2951
2947
2952
struct ggml_tensor * res = gf->nodes [gf->n_nodes - 1 ];
2948
2953
struct ggml_tensor * embeddings = gf->nodes [gf->n_nodes - 2 ];
You can’t perform that action at this time.
0 commit comments