Skip to content

qwen: make rmsnorm q8 publication consumer-driven again (engine #449) - #108

Merged
bong-water-water-bong merged 2 commits into
1bit/hrx-vulkan-patchedfrom
1bit/t449-qwen-rmsnorm-qual
Oct 18, 2026
Merged

bong-water-water-bong merged 2 commits into
1bit/hrx-vulkan-patchedfrom
1bit/t449-qwen-rmsnorm-qual

Conversation

@bong-water-water-bong

@bong-water-water-bong bong-water-water-bong commented Oct 18, 2026 •

Copy link
Copy Markdown

Engine #449 item 2. Stacked on #107 (base 1bit/t449-qwen-q8); merge after it.

The regression

has_decode_q8_consumer() in dispatch-qwen-rmsnorm.cpp accepted any MUL_MAT or MUL_MAT_ID consumer, so qwen3_moe:qwen3_moe_rmsnorm_f32_quantize_q8_1_x4 published a q8_1 x4 alternate for a BF16 projection, and for a 2048x63 projection, where no q8-consuming kernel exists. The quantize work and its buffer were done for a value nobody reads. This is the part of the f2099e9b publication loss that came back as a behaviour change rather than a rename.

The fix

The check is the shared consumer qualification introduced in #107:

  • dense: the value feeds a projection that reads Q8_1 x4 (decode Q4_K, or Q6_K with a live output; prefill Q5_K / IQ4_XS), as its activation operand, with the geometry the q8 kernels serve, directly or through a full-range layout alias;
  • routed: the fused MoE chain, i.e. the same route ids feed the down projection through the GLU with the profile geometry (768 / 128 experts / 8 routes).

Everything else keeps the f32 path and does no quantization, which is what the guard asserts per consumer case: Direct, Alias, Routed, RoutedQ6, AliasedDense publish; UnsupportedWeight, WrongOperand, IncompatibleGeometry, RoutedShape, RoutedRoute do not.

Device gate (HRX0, strixhalo)

HRX0 in use, not the CPU path: every CSV row carries devices=HRX0 and gpu_info=AMD Radeon 8060S Graphics (Node 1) (gfx1151), and test-backend-ops reports Testing 2 devices / Backend 1/2: HRX0. HRX attaches only with IREE_HAL_AMDGPU_LIBHSA_PATH pointing at TheRock's libhsa (~/therock100/.../_rocm_sdk_core/lib/libhsa-runtime64.so.1); with the distro lib it registers no device and everything silently runs on CPU. Every run through ~/lb/thermal-run.sh, one process at a time, cooling below 70 C between runs, Tctl <= 65 C.

test-backend-ops -b HRX0: Backend 1/2: HRX0, 1141/1141 tests passed.

llama-bench -p 512 -n 128 -r 2 -dev HRX0 -ngl 99 -t 4, arm A = 953b639, arm B = this branch (items 1+2):

model test A (953b639) B (items 1+2)
Qwen3-Coder-30B-A3B-Instruct-Q4_K_M pp512 2041.3 +-21.6 t/s 2035.8 +-17.6 t/s
Qwen3-Coder-30B-A3B-Instruct-Q4_K_M tg128 91.317 +-0.013 t/s 91.864 +-0.069 t/s
Qwen3-8B-Q4_K_M pp512 2266.98 +-38.80 t/s 2342.10 +-3.98 t/s
Qwen3-8B-Q4_K_M tg128 42.6466 +-0.0274 t/s 42.7026 +-0.0080 t/s

needle 7341 @4732 (Qwen3-8B, arm B): 3/3 OK, answer 7341, prompt 4732 tokens, identical sha on all three reps.

Dispatches per token: not counted. The backend has no per-graph dispatch counter and I did not add instrumentation for this run. Structurally this change removes work rather than adding it: for an unqualified consumer the q8 quantize and its alternate disappear and the f32 path runs, which is the pre-regression behaviour for those shapes.

Host suite, stacked on #107 (CPU, ryzen)

before: 45 passed, 13 failed, 7 known-fail, 1 unexpected-pass, 66 total
now:    48 passed, 12 failed, 6 known-fail, 0 unexpected-pass, 66 total

qwen_decode_publication_consumer_qualification passes (marker retired in this PR), and one real failure went green as well: schedule_qwen_terminal_q6k_q8_command.tokens1, whose decode graph was seeing the unqualified publication. The remaining 12 real failures are the unchanged class A/B rows plus qwen_router_top8_dispatch.

Refs engine #449, engine #445.

🤖 Generated with Claude Code

@bong-water-water-bong
bong-water-water-bong force-pushed the 1bit/t449-qwen-rmsnorm-qual branch from 7dc31a1 to fbffcbb Compare October 18, 2026 18:20
@bong-water-water-bong
bong-water-water-bong changed the base branch from 1bit/t449-qwen-q8 to 1bit/hrx-vulkan-patched October 18, 2026 18:22
@bong-water-water-bong
bong-water-water-bong force-pushed the 1bit/t449-qwen-rmsnorm-qual branch from fbffcbb to 204bc5b Compare October 18, 2026 18:23
bong-water-water-bong and others added 2 commits October 18, 2026 15:41
has_decode_q8_consumer() accepted any MUL_MAT or MUL_MAT_ID consumer, so the decode
rmsnorm+quantize kernel published a q8_1 x4 alternate for a BF16 projection and for a
63-output projection, i.e. it quantized a value nobody reads. That is the part of the
f2099e9 publication loss that survived as a behaviour change rather than a rename.

The check is now the shared consumer qualification from #107: a qualified dense q8
projection (decode Q4_K, or Q6_K with a live output; prefill Q5_K / IQ4_XS), directly or
through a full-range layout alias, or the fused routed-MoE chain where the same route ids
feed the down projection through the GLU with the profile geometry. Anything else keeps
the f32 path and does no quantization.

Host suite, stacked on #107 (CPU, ryzen):
  before: 45 passed, 13 failed, 7 known-fail, 1 unexpected-pass, 66 total
  now:    46 passed, 12 failed, 6 known-fail, 2 unexpected-pass, 66 total

The second unexpected pass is qwen_decode_publication_consumer_qualification. One real
failure also went green: schedule_qwen_terminal_q6k_q8_command.tokens1, whose decode graph
was seeing the unqualified publication. Both #449 markers are retired after the device gate
for this PR, not before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… (device gate passed)

Same gate as the parent commit: test-backend-ops -b HRX0 1141/1141 passed, tok/s level on the
MoE and dense arms, needle 7341 @4732 3/3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bong-water-water-bong
bong-water-water-bong force-pushed the 1bit/t449-qwen-rmsnorm-qual branch from 204bc5b to b3f70ee Compare October 18, 2026 18:42
@bong-water-water-bong
bong-water-water-bong merged commit 0d3ed9e into 1bit/hrx-vulkan-patched Oct 18, 2026
@bong-water-water-bong
bong-water-water-bong deleted the 1bit/t449-qwen-rmsnorm-qual branch November 12, 2026 21:16
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