Skip to content

ggml-hrx: Q2_0 weights (shared dequantizer, decode lanes, bit-exact GET_ROWS test) [rebased] - #99

Closed
bong-water-water-bong wants to merge 3 commits into
1bit/hrx-nvfp4-rbfrom
1bit/hrx-q2_0-rb
Closed

bong-water-water-bong wants to merge 3 commits into
1bit/hrx-nvfp4-rbfrom
1bit/hrx-q2_0-rb

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Rebase of #76 onto the rebased NVFP4 branch (stacked, as before). Three patches, no conflicts, range-diff unchanged; HRX format code 42 still free at the tip.

Verified on strixhalo 2026-10-09 (power mode performance, hrx-system 98d05d94, built with the engine's HRX configuration, every GPU step under box.lock):

  • test-hrx-q2_0: bit-exact (8 rows x 256), 3 of 3 runs; NVFP4 and decode-stride tests still pass.
  • test-backend-ops -b HRX0: GET_ROWS 27/27 x3, MUL_MAT 347/347 x3 (Q2_0: 24 OK).
  • Paris: qwen38-27b-qat-q2_0 "Paris." 2 runs; one graph split, kquant decode lanes.
  • KLD vs CPU: 0.000550 (PR: 0.00106).
  • llama-bench 27B Q2_0 QAT: pp512 164.1, tg128 20.76 (PR: 156 / 19.8).

Supersedes #76.

🤖 Generated with Claude Code

bong-water-water-bong and others added 3 commits October 9, 2026 02:38
Q2_0 (ggml type 42) is 64-value blocks of an f16 scale d and 16 bytes of 2-bit codes; value j is
((qs[j / 4] >> 2 (j % 4)) & 3) - 1 times d (dequantize_row_q2_0). Four aligned values are the four fields
of one byte. The decoder takes the value index k like Q1_0 and lives in our motifs/dequant_1bit.loom; row
bytes are 18 per 64 values and a 256-value tile is 72 bytes. Input sizes are multiples of 64.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Q2_0 lane of 16 values is four code bytes under one scale, so Q2_0 joins the 16-value lanes of
kquant_decode_f32: lane l reads block l / 4 (d at its first 16-bit word) and the two 16-bit words of qs
bytes 4 (l % 4)..+4 (blocks are 18 bytes, 2-byte aligned). 72 bytes per 256 values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… on HRX

Eight rows of 256 values with f16 scales 1, 0.1, -1, the smallest subnormal, a negative subnormal, 0,
65504 and 2^-10, and every byte value in the codes. HRX's GET_ROWS must equal dequantize_row_q2_0 bit for
bit, on the HRX device with no scheduler, through the get_rows kernel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong

Copy link
Copy Markdown
Author

Landed through #100: GitHub closed this PR when #98's merge deleted its base branch, and #100 (stacked on this branch) was retargeted to 1bit/hrx-vulkan-patched and merged, which brought these three commits (5625fa2, 4f3607c, 993a733) onto the tip. Verified on the tip: git log 0e255d7 lists them. Nothing further to merge here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant