Repository navigation
metal: somewhat faster f16 x f32 matrix multiply kernel - #2951
Merged
Merged
Conversation
Collaborator
|
The speedup column is not so intuitive. It's usually reported as |
ggerganov
approved these changes
Sep 1, 2023
Member
There was a problem hiding this comment.
M2 Ultra
| model | size | params | ngl | test | master t/s | PR t/s | speedup |
|---|---|---|---|---|---|---|---|
| LLaMA 7B Q4_0 | 3.56 GiB | 6.74 B | 1 | pp 32 | 686.11 ± 4.85 | 684.45 ± 3.89 | 1.00 |
| LLaMA 7B Q4_0 | 3.56 GiB | 6.74 B | 1 | pp 64 | 852.72 ± 2.61 | 859.01 ± 1.66 | 1.01 |
| LLaMA 7B Q4_0 | 3.56 GiB | 6.74 B | 1 | pp 128 | 910.65 ± 1.78 | 927.03 ± 2.15 | 1.02 |
| LLaMA 7B Q4_0 | 3.56 GiB | 6.74 B | 1 | pp 256 | 811.85 ± 0.98 | 837.43 ± 0.99 | 1.03 |
| LLaMA 7B Q4_0 | 3.56 GiB | 6.74 B | 1 | pp 512 | 632.02 ± 0.11 | 663.84 ± 0.14 | 1.05 |
| LLaMA 7B Q4_0 | 3.56 GiB | 6.74 B | 1 | pp 1024 | 467.89 ± 0.12 | 498.51 ± 0.09 | 1.07 |
| LLaMA 7B Q4_0 | 3.56 GiB | 6.74 B | 1 | tg 128 | 87.20 ± 0.12 | 87.46 ± 0.03 | 1.01 |
I think this PR does not conflict with #2891 so we can merge it
Member
|
Here is the speedup after the last commit:
🦙 |
Seunghhon
pushed a commit
to Seunghhon/llama.cpp
that referenced
this pull request
Apr 26, 2026
* Somewhat faster f16 x f32 matrix multiply kernel * Better use 32 thread groups for f16 x f32 --------- Co-authored-by: Iwan Kawrakow <[email protected]>
phuongncn
pushed a commit
to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4
that referenced
this pull request
Apr 28, 2026
* Somewhat faster f16 x f32 matrix multiply kernel * Better use 32 thread groups for f16 x f32 --------- Co-authored-by: Iwan Kawrakow <[email protected]>
ljubomirj
pushed a commit
to ljubomirj/llama.cpp
that referenced
this pull request
May 6, 2026
* Somewhat faster f16 x f32 matrix multiply kernel * Better use 32 thread groups for f16 x f32 --------- Co-authored-by: Iwan Kawrakow <[email protected]>
AlexiAlp
pushed a commit
to minghaop/llama.cpp
that referenced
this pull request
Jun 2, 2026
* Somewhat faster f16 x f32 matrix multiply kernel * Better use 32 thread groups for f16 x f32 --------- Co-authored-by: Iwan Kawrakow <[email protected]>
AlexiAlp
pushed a commit
to minghaop/llama.cpp
that referenced
this pull request
Jun 2, 2026
* Somewhat faster f16 x f32 matrix multiply kernel * Better use 32 thread groups for f16 x f32 --------- Co-authored-by: Iwan Kawrakow <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Simply via better accumulation of thread results. The larger the context (prompt), the more improvement we see in pp timing.
7B
Q4_0on 30-core M2 Max.Update:
If we also change the number of thread groups from 64 to 32, it gets even better:
It does give a small benefit for TG too. E.g., for TG-128 I get
61.28 +/- 0.16vs59.98 ± 0.10on master.