Repository navigation
hrx: fuse ZAYA residual scale into one dispatch per side - #35
Merged
bong-water-water-bong merged 1 commit intoSep 29, 2026
Merged
Conversation
ZAYA scales both residual branches, (x + bx) * sx + (r + br) * sr, twice per layer: up to nine ADD / MUL dispatches per layer at decode, each ~1.3 us of work plus a ~1.8 us gap. The graph computes the r side long before x exists, so each side becomes (a + b) * s where it starts, and the later side also takes the final ADD with the other side as an addend (ops/res_scale_pair_f32.loom, dispatch-res-scale-pair.cpp; hookups: manifest, dispatch-common, CMake). Same add, mul, add order per element: bitwise the same output. ZAYA1-8B Q4_K_M, HRX0 (gfx1151): 3,366 -> 3,165 dispatches per token; greedy 6 prompts x 48 tokens identical, max |dlogprob| 0.0000; decode 67.0 -> 68.6-70.2 tok/s (+4%, 3 interleaved rounds); pp512 2109 -> 2183. Qwen3 does not match the pattern. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong
merged commit Sep 29, 2026
45c1770
into
1bit/hrx-vulkan-patched
10 of 24 checks passed
This was referenced Sep 29, 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.
ZAYA scales both residual branches twice per layer,
(x + bx)·sx + (r + br)·sr. At decode that is up to nine ADD / MUL dispatches per layer, each about 1.3 µs of work plus a 1.8 µs gap. This is part of RFC 1bit-MONSTER/engine#213 gate 1: HRX decode vs Vulkan on ZAYA1-8B.How it works. The graph computes the r side long before
xexists, so one dispatch cannot cover both sides. Each side becomes(a + b)·swhere it starts. The side that comes last also takes the final ADD, reading the other side's result as an addend. The matcher is in our own files:ops/res_scale_pair_f32.loomdispatch-res-scale-pair.{h,cpp}Hookups are minimal: the manifest entry, 2 lines in
dispatch-common.cpp, and 2 in CMake. A bias ADD already taken by the output projection's bias fusion stays there. Every removed intermediate has exactly one consumer. The output may reuse an input's storage only exactly in place.Checked on strixhalo (gfx1151), ZAYA1-8B Q4_K_M, HRX0:
GGML_HRX_DISABLE_DISPATCH=res_scale_pair: 288/288 tokens identical, max |Δlogprob| 0.0000.Not covered:
test-backend-opscannot express this fused pattern. Correctness rests on the bit-exact A/B above.🤖 Generated with Claude Code