UPSTREAM PR #18740: POC: group gate_exps and up_exps + fix mxfp4 alignment for PP boost#881
Open
UPSTREAM PR #18740: POC: group gate_exps and up_exps + fix mxfp4 alignment for PP boost#881
Conversation
|
Explore the complete analysis inside the Version Insights I've generated a comprehensive summary report for your project. The analysis shows significant performance concerns for pull request #881 in the llama.cpp repository: Key Highlights:Critical Issues:
Some Improvements:
Recommendation: The report suggests careful review of PR #881 before merging due to the severe performance regressions in critical STL operations. Further investigation into memory allocation patterns and compiler optimization flags is recommended. Would you like me to provide more details on any specific aspect of this performance analysis? |
2d2b258 to
78dd122
Compare
095e526 to
db6cb7a
Compare
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.
Mirrored from ggml-org/llama.cpp#18740
Instead of doing the gate and up expert
MUL_MAT_IDseparately, we group these two together (interestingly, the HF model also has them together but interleaved), so do 1 larger sparse MM (+ add) than 2. I uploaded a GGUF with this change for justgpt-oss-20bResults:
Master
Details
4090:
5090:
This PR
Details
4090:
5090:
So overall a gain of ~10% in PP.
I tried another simple but backwards incompatible change, changing the
block_mxfp4size from 17 bytes to 20 bytes to make it 4-byte aligned in 9099a1b175c804a092f6b5431d5e752386e47163, that stacked on top of this PR givesDetails
4090:
5090:
Another ~5-10% gain for the 5090 and 1-3% gain for 4090. I uploaded another GGUF for this. This increases the size by ~15% from 12.1 GB to 13.9 GB.
Does it make sense for optimisation 1 to happen during model-load via some flag? (we could add something similar for QKV merging). For optimisation 2 the best would be a re-pack in the CUDA backend as discussed in #18427, but I'm finding it difficult to implement that.
AI disclosure - since I don't intend to merge this code as is, this code is mostly written by AI for quick experiments (guided by me)