Usage of Open MP Barrier for thread sync to avoid atomic operations #8002
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current ggml_compute thread requires exclusive sync operations for all the threads to sync after every stage of operation.
With recent introduction of openMP library into this repo, we can leverage the barrier function of openMP and also effectively remove atomic operations which introduces delay.
Command line:
./bin/llama-cli-m ../models/7B/ggml-model-q8_0.gguf -n 100 -s 01 -b 7 -t <num_of_threads> -p "AI is going to"
Running on Graviton 3 AWS machine with 64 cores
(tokens/sec)
(tokens/sec)
We see improvements in tokens/sec by as much as ~3 token/sec over the existing implementation.
This is a small change in line with openMP library usage.
Request review and feedback.