-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CUDA: use 1 thread if model is fully offloaded #2915
CUDA: use 1 thread if model is fully offloaded #2915
Conversation
Maybe update the help for
It might be good to mention the ability to set it to |
Using 1 vs 15 for me does make it .2-.5 tokens faster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to implement this entirely in llama_eval_internal
, similar to what has been done for BLAS:
common/common.cpp
Outdated
#ifdef GGML_USE_CUBLAS | ||
if (params.n_gpu_layers >= llama_model_n_layer(model) + 3) { | ||
params.n_threads = 1; | ||
} | ||
#endif // GGML_USE_CUBLAS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an implementation detail that the user should not need to know and in the future we will fix this anyway
I haven't forgotten about this, I've only prioritized other things because I think that this is not that high priority. |
ff65f9a
to
de8035a
Compare
@ggerganov thank you for the hint with |
Currently when using the maximum possible number of GPU layers with CUDA there is no benefit from > 1 thread. In fact, using more than 1 thread is detrimental due to increased overhead. This PR changes the logic for the default number of threads in such a way that (unless the user manually overrides it) only a single thread is used if all layers are offloaded.
I also changed the logic for
llama-bench
to be the same asmain
: -1 is interpreted as the number of logical cores.