Skip to content

hexagon: new HMX-optimized GATED_DELTA_NET - #29199

Merged
max-krasnyansky merged 25 commits into
ggml-org:masterfrom
qualcomm:hexagon-gdn-hmx
Sep 21, 2026
Merged

max-krasnyansky merged 25 commits into
ggml-org:masterfrom
qualcomm:hexagon-gdn-hmx

Conversation

@max-krasnyansky

Copy link
Copy Markdown
Member

Overview

This PR introduces brand new HMX implementation for GATED_DELTA_NET.
Prompt processing performance improvements range from 1.5-3X depending on the model and device.
Tested with Qwen3.5 and Qwen3.8 (mostly smaller distilled modes) on Galaxy S26/25/24, VentunoQ, IQ9, X2 Elite.

This PR is layered on top of #29197
Once that PR is merged I'll rebase and update this one.

Additional information

Here are some numbers on Galaxy S26

./scripts/snapdragon/run.py --target adb --devices 'HTP0' -- bin/llama-bench -m ../gguf/Qwen3.5-4B-Q4_0.gguf -fa 1 -p 500,800,1024,1500,2000,4000 -n 128
| model             |       size | n_ubatch |  fa | dev   |    test |  dma64 PR    t/s | This PR       t/s |
| ----------------- | ---------: | -------: | --: | ----- | ------: | ---------------: | ----------------: | 
| qwen35 0.8B Q4_0  | 486.71 MiB |     1024 |   1 | HTP0  |   pp500 |  1694.70 ± 75.00 |    3248.83 ± 2.36 | 
| qwen35 0.8B Q4_0  | 486.71 MiB |     1024 |   1 | HTP0  |   pp800 |  1795.71 ± 10.22 |   3340.61 ± 99.94 | 
| qwen35 0.8B Q4_0  | 486.71 MiB |     1024 |   1 | HTP0  |  pp1024 |   1806.93 ± 5.23 |   3477.30 ± 93.92 | 
| qwen35 0.8B Q4_0  | 486.71 MiB |     1024 |   1 | HTP0  |  pp1500 |  1787.64 ± 14.58 |   3399.17 ± 10.96 | 
| qwen35 0.8B Q4_0  | 486.71 MiB |     1024 |   1 | HTP0  |  pp2000 |   1793.19 ± 4.05 |    3484.47 ± 8.28 | 
| qwen35 0.8B Q4_0  | 486.71 MiB |     1024 |   1 | HTP0  |  pp4000 |  1799.01 ± 10.69 |   3380.80 ± 43.61 | 
| qwen35 0.8B Q4_0  | 486.71 MiB |     1024 |   1 | HTP0  |   tg128 |     68.42 ± 0.67 |      68.32 ± 0.45 | 
                                                                                           
| ----------------- | ---------: | -------: | --: | ----- | ------: | ---------------: | ----------------: | 
| qwen35 2B Q4_0    |   1.13 GiB |     1024 |   1 | HTP0  |   pp500 |   1437.22 ± 1.78 |    2295.33 ± 8.81 | 
| qwen35 2B Q4_0    |   1.13 GiB |     1024 |   1 | HTP0  |   pp800 |   1468.77 ± 1.94 |   2290.27 ± 94.78 | 
| qwen35 2B Q4_0    |   1.13 GiB |     1024 |   1 | HTP0  |  pp1024 |  1419.74 ± 29.14 |   2427.21 ± 39.86 | 
| qwen35 2B Q4_0    |   1.13 GiB |     1024 |   1 | HTP0  |  pp1500 |   1474.79 ± 2.72 |   2267.64 ± 25.37 | 
| qwen35 2B Q4_0    |   1.13 GiB |     1024 |   1 | HTP0  |  pp2000 |  1429.11 ± 17.63 |   2253.39 ± 44.54 | 
| qwen35 2B Q4_0    |   1.13 GiB |     1024 |   1 | HTP0  |  pp4000 |  1436.27 ± 10.05 |   2145.39 ± 24.05 | 
| qwen35 2B Q4_0    |   1.13 GiB |     1024 |   1 | HTP0  |   tg128 |     38.57 ± 0.33 |      38.48 ± 0.27 | 
                                                                                                                         
| ----------------- | ---------: | -------: | --: | ----- | ------: | ---------------: | ----------------: |                                  
| qwen35 4B Q4_0    |   2.48 GiB |     1024 |   1 | HTP0  |   pp500 |   614.91 ± 11.04 |   1113.49 ± 22.81 | 
| qwen35 4B Q4_0    |   2.48 GiB |     1024 |   1 | HTP0  |   pp800 |    630.92 ± 1.19 |   1025.50 ± 35.91 | 
| qwen35 4B Q4_0    |   2.48 GiB |     1024 |   1 | HTP0  |  pp1024 |    616.23 ± 5.27 |     931.91 ± 8.74 | 
| qwen35 4B Q4_0    |   2.48 GiB |     1024 |   1 | HTP0  |  pp1500 |    617.92 ± 2.29 |     931.91 ± 5.36 | 
| qwen35 4B Q4_0    |   2.48 GiB |     1024 |   1 | HTP0  |  pp2000 |    597.55 ± 5.63 |     907.94 ± 6.74 | 
| qwen35 4B Q4_0    |   2.48 GiB |     1024 |   1 | HTP0  |  pp4000 |    567.17 ± 4.82 |     876.71 ± 8.46 | 
| qwen35 4B Q4_0    |   2.48 GiB |     1024 |   1 | HTP0  |   tg128 |     18.67 ± 0.10 |      18.43 ± 0.14 |

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: Yes, Antigravity (3.8-Flash) for research, experiments and testing

@max-krasnyansky
max-krasnyansky requested review from a team and ggerganov as code owners September 21, 2026 04:52
@github-actions github-actions Bot added documentation Improvements or additions to documentation testing Everything test related ggml changes relating to the ggml tensor library for machine learning Hexagon labels Sep 21, 2026
@max-krasnyansky
max-krasnyansky merged commit 5836771 into ggml-org:master Sep 21, 2026
20 checks passed
@BrewTestBot BrewTestBot mentioned this pull request Sep 23, 2026
1 task done
LadislavSopko pushed a commit to 0ics-srls/llama.cpp that referenced this pull request Oct 5, 2026
* hex-gdn: start putting together HMX support for GDN

* hex-gdn: working hmx but not-pipelined and slow for now

* hex-gdn: re-write vtcm layout handling and prep for pipelining

* hex-gdn: starting to pipeline hmx and dmas

* hex-gdn: add hvx threading for most pipeline stages

* hex-gdb: add detailed trace events

* hex-gdn: vectorize expfs and use aligned hvx reads/writes

* hex-gnd: vectorize the rest of expf

* hex-gdn: optimize tail processing (pad partial chunks)

* hex-gdb: avoid float up/down casts in hot loops

* hex-fa: remove float up/down casts from inner loops

* hex-gdn: do exp() in f16 to improve HVX utilization

* hex-gdn: optimize tiler

* hex-hmx: bump hmx-queue to 128 and dispatch all GDN gemms at once

* hex-gdn: further pipeline improvements

* hex-gdn: optimize gdn prep stage

* hex-gdn: yet more tweaks to optimize GND_SOLVE task and pipeline

* hex-gdn: improve accuracy and optmize gdn-prep further

* hex-gdn: fix rebase conflict

* hex-bufs: revert max_bufsize enforcement, it is enough to just enforce max_vmem

* hex-scripts: improved inspect script to avoid false alarms in reg spill detector

* hex-fa: improve inline softmax with in-reg VKQ32 accum

* hex-fa: minor improvement for dma pipeline in hvx kernel

* hex-fa: reduce ddr reads by 20-30% during token gen

* hex-gdn: proper alignment for hvx vtcm spads
edwardyoon pushed a commit to edwardyoon/focus-llama that referenced this pull request Oct 7, 2026
* hex-gdn: start putting together HMX support for GDN

* hex-gdn: working hmx but not-pipelined and slow for now

* hex-gdn: re-write vtcm layout handling and prep for pipelining

* hex-gdn: starting to pipeline hmx and dmas

* hex-gdn: add hvx threading for most pipeline stages

* hex-gdb: add detailed trace events

* hex-gdn: vectorize expfs and use aligned hvx reads/writes

* hex-gnd: vectorize the rest of expf

* hex-gdn: optimize tail processing (pad partial chunks)

* hex-gdb: avoid float up/down casts in hot loops

* hex-fa: remove float up/down casts from inner loops

* hex-gdn: do exp() in f16 to improve HVX utilization

* hex-gdn: optimize tiler

* hex-hmx: bump hmx-queue to 128 and dispatch all GDN gemms at once

* hex-gdn: further pipeline improvements

* hex-gdn: optimize gdn prep stage

* hex-gdn: yet more tweaks to optimize GND_SOLVE task and pipeline

* hex-gdn: improve accuracy and optmize gdn-prep further

* hex-gdn: fix rebase conflict

* hex-bufs: revert max_bufsize enforcement, it is enough to just enforce max_vmem

* hex-scripts: improved inspect script to avoid false alarms in reg spill detector

* hex-fa: improve inline softmax with in-reg VKQ32 accum

* hex-fa: minor improvement for dma pipeline in hvx kernel

* hex-fa: reduce ddr reads by 20-30% during token gen

* hex-gdn: proper alignment for hvx vtcm spads

(cherry picked from commit 5836771)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation ggml changes relating to the ggml tensor library for machine learning Hexagon testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants