Skip to content
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

ggml : limit n_threads to the max n_tasks #5238

Merged
merged 1 commit into from
Jan 31, 2024
Merged

ggml : limit n_threads to the max n_tasks #5238

merged 1 commit into from
Jan 31, 2024

Conversation

slaren
Copy link
Collaborator

@slaren slaren commented Jan 31, 2024

This avoids using a larger number of threads that the ops in the graph can actually use.

With full offload, the CPU graph only contains a get_rows that can only use one thread, so this should fix the performance regression when full offloading due to the overhead of launching additional threads. @stduhpf can you check if this fixes the issue?

@stduhpf
Copy link
Contributor

stduhpf commented Jan 31, 2024

It fixes prompt processing speed, but not token generation.

I'll do more tresting later today.

@slaren
Copy link
Collaborator Author

slaren commented Jan 31, 2024

This effectively sets the number of threads to 1 with full offload, so if the regression was caused by the change to n_threads in llama.cpp I don't see how this would not fix it. Are you sure that you tested in the same conditions?

@stduhpf
Copy link
Contributor

stduhpf commented Jan 31, 2024

No I'm not completely sure, I'll try testing again soon.

@slaren
Copy link
Collaborator Author

slaren commented Jan 31, 2024

I can also reproduce the performance regression with CUDA, it's worse on windows but it is also noticeable under WSL, and this does fix it for me.

@stduhpf
Copy link
Contributor

stduhpf commented Jan 31, 2024

Ok, it's working. I messed up my first test, but this does fix the issue.

@slaren slaren merged commit dabcc5b into master Jan 31, 2024
60 checks passed
@slaren slaren deleted the sl/tasks-threads branch January 31, 2024 12:43
jordankanter pushed a commit to jordankanter/llama.cpp that referenced this pull request Feb 3, 2024
hodlen pushed a commit to hodlen/llama.cpp that referenced this pull request Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants