hexagon: new vtcm layouts and improved pipelines for MUL_MAT, MUL_MAT_ID and FLASH_ATTN_EXT#25425
Merged
max-krasnyansky merged 32 commits intoJul 8, 2026
Merged
Conversation
…r doesnt help here
… vtcm layout funcs
2abc5b0 to
074fede
Compare
lhez
approved these changes
Jul 8, 2026
Member
Author
|
@ggml-org/maintainers may I get the second approval please. |
yomaytk
approved these changes
Jul 8, 2026
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.
Overview
Another round of updates for the big three (
MUL_MAT,MUL_MAT_ID,FLASH_ATTN_EXT) in ggml-hexagon.This update introduces a concept of 'VTCM layout' that is used by the host CPU for selecting the right kernel (HMX, HVX, etc) and decide on the VTCM partitioning. The same functions are used by the NPU to do the actual VTCM partitioning. The new layouts improve buffer overlap/reuse in several cases and allows us to put more data into VTCM. Kernel param solvers have improved as well (more iterations and tuning are coming).
All big Ops have been updated to use this and the smaller Ops are next (I'm working on
GEGLUand some other ones that started popping up in the profiles as we improve the big ones).The PR also adds significant improvements to the pipelining (DMA, HVX-work, HMX-work,...).
At the Op level we see major (sometimes 2x) gains shaving milliseconds from big
MUL_MATs andFAs.It does not always translate to big gains at the model level but we do see a steady improvement (see some examples below).
It's been tested on all supported devices (ie hexagon v73...v81) and most popular models in Q4_0/1, Q8_0, MXFP4.
With these changes we handle longer contexts much better (I've been playing with 16K and 32K).
Also the improved latency on smaller models helps with the MTP Spec-Dec (i.e it makes the drafters much faster, will share some updates on that separately).
Additional information
Details
Requirements