Repository navigation
serve: Hadamard-rotated Q4_0 files run on --device hrx too - #277
Merged
Merged
Conversation
The engine's H32 files (tools/hadamard_q4_0.py, onebit.hadamard_q4_0 = 32) ran on the lean ROCm route only. Our llama.cpp now reads the stamp (llama-hadamard, fork #58) and rotates the activations as a matmul, so serve accepts --device hrx for them: HRX0, no W4A4 or Hadamard variables. --device auto keeps ROCm for these files until HRX routes Q4_0 prompt matmuls to a fast kernel: Qwen3.8-27B-Q4_0-H32 on HRX0 runs pp512 at 63.5 tok/s today (PPL 6.021, KLD 0.0292, same top token 92.5% vs BF16). tests/hadamard_route.sh: --device hrx -> HRX0 with neither variable. ctest -LE gpu: 19/19. docs/hrx.md gets a section, docs/lean.md a pointer. Needs the third_party/llama.cpp pin that includes fork #58. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Docs7 for 1bit-monster/engine
Commit |
Collaborator
Author
|
Review (PR-Agent duty). Correct.
Merge order: after bcloud-ae's Direction note (owner, 2026-10-01: zero ROCm): |
bong-water-water-bong
added a commit
that referenced
this pull request
Oct 2, 2026
…mat SwiGLU, Hadamard Q4_0 (#278) * Pin llama.cpp bd5b297: HRX remainder prefill, 32K+ prompts, mixed-format SwiGLU, Hadamard Q4_0 llama.cpp fork commits since 6e42b51 (figures from each PR, Qwen3.8-27B on HRX0, balanced mode): - #61: q8_1 x4 prefill takes the 256-aligned head of a Q5_K/IQ4_XS remainder chunk. UD-Q4_K_XL pp400 67.4 -> 103.4, pp1862 172.1 -> 234.6 tok/s; KLD vs 6e42b51 0.00215, same top token 97.19%; MUL_MAT HRX0 287/287. - #59: V stays row-major past copy_transpose_f16's 32768-row range. pp512 @ d32768 failed before, 227.4 tok/s now; a 34,816-token wikitext chunk gives PPL 6.2150. - #60: K-quant SwiGLU decode stages separate gate/up codebooks. UD-IQ2_S tg128 3.12 -> 8.32; UD-Q4_K_XL unchanged; KLD 0.00013; test-backend-ops HRX0 996/996. - #58: llama loads onebit.hadamard_q4_0 files through llama-hadamard (needed by #277). Q4_0-H32 vs BF16: PPL 6.021, KLD 0.0292, same top token 92.5%. Docs: docs/hrx.md #55 section (remainders now covered for Q5_K/IQ4_XS) and "Our patches". Registry regenerated (tools/registry_build.py; no mapping changes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs/hrx.md: the #61 figures were measured on 6e42b51 + #61 (a36d547) (review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: bong-water-water-bong <bong-water-water-bong@1bit.gg> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Hadamard-rotated Q4_0 files (
tools/hadamard_q4_0.py, stampedonebit.hadamard_q4_0 = 32) now run on--device hrx. Until now they ran on the lean ROCm route only.Merge after the
third_party/llama.cpppin that includes fork #58: the bump tobd5b297(fork #58-#61). Without #58 the HRX build doesn't rotate the activations, and output is garbage (PPL 550,134).Changes
serve: accepts--device hrxfor a rotated file and runs it onHRX0, with neitherGGML_W4A4_TENSORSnor a process-wide Hadamard variable. Our llama.cpp reads the stamp itself (llama-hadamard, fork Lean: ROCmI4 on Vulkan (our ROCmFPX fork); the bump rebases our commit #58).--device autostill picks ROCm for these files. No fast HRX prompt kernel decodes Q4_0 yet: the q8_1 x4 template covers Q4_K, Q5_K and IQ4_XS only, so H32 prompts take HRX's generic path.H32 vs the UD-Q4_K_XL file on HRX: H32 is both less accurate and slower.
HRX0This route keeps existing H32 files working on HRX; for new HRX use the UD file is the better choice. Making H32 fast would take a Q4_0 branch in the wmmai8 prompt template (exact in-kernel scale and min, same 144 bytes per 256 weights as Q4_K). Nobody is working on that now.
Docs:
docs/hrx.mdgets a section anddocs/lean.mda pointer.HRX numbers
Qwen3.8-27B-Q4_0-H32 on
HRX0, measured on fork #58:The speed figures are from a build before #55.
Tests
tests/hadamard_route.sh:--device hrx→HRX0, with neither variable.ctest -LE gpu: 19/19 pass.🤖 Generated with Claude Code