Skip to content

hexagon: add support for Q1_0 and Q2_0 - #30122

Merged
max-krasnyansky merged 10 commits into
ggml-org:masterfrom
qualcomm:tb/hexagon-q1_0-support
Oct 17, 2026
Merged

max-krasnyansky merged 10 commits into
ggml-org:masterfrom
qualcomm:tb/hexagon-q1_0-support

Conversation

@tboinovski1

@tboinovski1 tboinovski1 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Support for Q1_0 and Q2_0 formats.
Enables tiling layouts for both HMX and HVX kernels.

  • Native Q1_0, Q2_0 MUL_MAT through HVX.

  • Direct {-1,+1} expansion against tiled Q8_0 activations.

  • 32x1, 32x2, 2D, 4D, and matvec workers.

  • Exact host repacking and arbitrary byte-range readback.

  • Enabled Q1_0 and Q2_0 weights in the 2D HMX MUL_MAT path.

  • Support for GET_ROWS are in the works but likely will a follow-on.

Verification

  • v73, v75, v79 and v81 builds passed.
  • Tested on SM8850/v81 android.
  • Q1_0 support: 128/128 tests passed.
  • Q2_0 support: 128/128 tests passed

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: Yes, to reason about, test and verify the implementation. Codex and Anti.G.

@github-actions github-actions Bot added ggml changes relating to the ggml tensor library for machine learning Hexagon labels Oct 7, 2026
@tboinovski1
tboinovski1 force-pushed the tb/hexagon-q1_0-support branch 4 times, most recently from a5f1fc3 to 9c21deb Compare October 16, 2026 22:53
@max-krasnyansky
max-krasnyansky force-pushed the tb/hexagon-q1_0-support branch from 9c21deb to 2fcd79f Compare October 17, 2026 20:04
@max-krasnyansky
max-krasnyansky marked this pull request as ready for review October 17, 2026 20:04
@max-krasnyansky
max-krasnyansky requested a review from a team as a code owner October 17, 2026 20:04
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 17, 2026
@max-krasnyansky

Copy link
Copy Markdown
Member

@tboinovski1 I ended up doing a pass to optimize / generalize the dispatch and ukernels to make things more generic (ie removing one-off checks for Q1_0).
Did the same for Q2_0 and just folded it here.

@lhez for another review/ack

@max-krasnyansky max-krasnyansky changed the title hexagon: add support for Q1_0 hexagon: add support for Q1_0 and Q2_0 Oct 17, 2026
@max-krasnyansky max-krasnyansky added the merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge. label Oct 17, 2026
@max-krasnyansky
max-krasnyansky merged commit 797de63 into ggml-org:master Oct 17, 2026
22 of 23 checks passed
edwardyoon pushed a commit to edwardyoon/focus-llama that referenced this pull request Oct 24, 2026
* hexagon: add support for q1_0 quant

* hexagon: enable Q1_0 weights in the 2D HMX MUL_MAT path

* hex-q1: cleanup gates, generalize tiling and remove in-loop divs

* hex-tiling: document tiled formats in developer.md and update htp-tensor.h

* hex-q2: add support for Q2_0

* hex-q2: remove stale asserts and speacial cases

* hex-mm: fix MUL_MAT_NX assumption about square tiling, Q1/Q2 have non-square tiles

* hex-q1/2: minor optimizations (unrolls/un-unrolls/...)

* hex-q1: optimize Q1_0 layout to reduce unpack/vrmpy overhead

* hex-q1/q2_0: further optimize vec_dots

---------

Co-authored-by: Max Krasnyansky <[email protected]>
auRose94 pushed a commit to auRose94/llama.cpp that referenced this pull request Oct 28, 2026
* hexagon: add support for q1_0 quant

* hexagon: enable Q1_0 weights in the 2D HMX MUL_MAT path

* hex-q1: cleanup gates, generalize tiling and remove in-loop divs

* hex-tiling: document tiled formats in developer.md and update htp-tensor.h

* hex-q2: add support for Q2_0

* hex-q2: remove stale asserts and speacial cases

* hex-mm: fix MUL_MAT_NX assumption about square tiling, Q1/Q2 have non-square tiles

* hex-q1/2: minor optimizations (unrolls/un-unrolls/...)

* hex-q1: optimize Q1_0 layout to reduce unpack/vrmpy overhead

* hex-q1/q2_0: further optimize vec_dots

---------

Co-authored-by: Max Krasnyansky <[email protected]>
@BrewTestBot BrewTestBot mentioned this pull request Oct 28, 2026
1 task done
yuubinnkyoku added a commit to yuubinnkyoku/llama.cpp that referenced this pull request Nov 25, 2026
Measured on host, no device needed.

ceefd16 (ggml-org#30581 HMX FA sinks) and 27c7a76 (ggml-org#30435 softplus HVX) apply with
zero conflicts. Not committed here, because the branch should not advance past
what the device has validated; they are the first two for Phase 65.

797de63 (ggml-org#30122 Q1_0/Q2_0) is the next wall at 39 hunks across four files,
28 of them in matmul-ops.c where the fork's four-column dispatch and upstream's
generic repack dispatch claim the same table. It needs the repack layer that
b797b9c (ggml-org#30635) introduces, and that file pair does not exist in the fork.

So the shape is: repack rework is the gate, and Q1_0/Q2_0 and Op Fusion both sit
behind it. Phase 65's real work is one PR with ten files and 39+ hunks.

Assisted-by: DeepSeek Harness
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 merge ready A maintainer can use this label to indicate that they consider the changes final and ready to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants