Skip to content

qwen_moe: declare the q8 next-RMSNorm producer's writes in the manifest (engine #449) - #110

Merged
bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/qwen3moe-small-batch-fix
Oct 19, 2026
Merged

bong-water-water-bong merged 1 commit into
1bit/hrx-vulkan-patchedfrom
1bit/qwen3moe-small-batch-fix

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

qwen3_moe_routed_down_weighted_reduce_next_rmsnorm_q8_1_x4 stores the updated residual into hidden_state and the Q8_1 x4 row into next_projection_input. Its manifest entry, though, declared all five bindings read.

The command program learns who writes a transient only from the manifest. It therefore saw no writer for the q8 transient and rejected every graph that selects this kernel:

command 16 ... binding next_projection_input value=3723 origin=Transient access=Read range=[0, 4608) reads transient value 3723 before write

The matcher picks the q8 form only when a q8-reading projection consumes the normalized row. On Qwen3-Coder-30B-A3B and Qwen3-30B-A3B Q4_K_M that happens at 2–5-token batches: a cached prefix with a short tail, concurrent requests, and the 2-token load warmup. That is why llama-bench and test-backend-ops never reached it, and why it blocks moving the engine's coder service to HRX.

The fix declares hidden_state as read_write and next_projection_input as write, matching the f32 variant. hrx-backend-test now checks both accesses; with the old manifest that check fails.

Measured on Strix Halo (gfx1151), Qwen3-Coder-30B-A3B Q4_K_M, before = 0d3ed9e and after = this commit, same build with the private HIP kernels:

check before after
server cached tails of 0–12 tokens, --parallel 1 and 4 4/13 HTTP 500 (2–5 tokens) 0/13
4 concurrent requests, --parallel 4 4/4 HTTP 500 4/4 200
llama-perplexity -c 128, ub 2/3/4/5 decode fails PPL 6.1303
-c 512 × 10 chunks, -b 512 PPL 10.6893 10.6893, KLD 0.000000
llama-bench pp512 / tg128 (medians of 3 interleaved rounds) 2081.15 / 91.60 2084.97 / 91.58
test-backend-ops HRX0: MUL_MAT_ID / RMS_NORM / ADD / MUL_MAT 132/132, 6/6, 22/22, 350/350 same
  • The engine's tools/kat.py --repeat 3 passes at --parallel 1 and 4.
  • Qwen3-30B-A3B-Instruct-2507 shows the same 4/13 → 0/13 on its cached tails.
  • The f32 m=1 n=1 k=2048 MUL_MAT case fails about 1 run in 7 on both builds, so it is unrelated to this change.

🤖 Generated with Claude Code

…st (engine #449)

qwen3_moe_routed_down_weighted_reduce_next_rmsnorm_q8_1_x4 stores the updated
residual into hidden_state and the Q8_1 x4 row into next_projection_input, but
its manifest entry declared all five bindings "read". The command program
therefore saw no writer for the q8 transient and rejected every graph that
selects this kernel:

  command 16 ... binding next_projection_input value=3723 origin=Transient
  access=Read range=[0, 4608) reads transient value 3723 before write

The matcher selects the q8 form only when a q8-reading projection consumes the
normalized row, which on Qwen3-Coder-30B-A3B / Qwen3-30B-A3B Q4_K_M happens at
2..5-token batches (cached prefix + short tail, 4 concurrent requests, the
2-token load warmup). Declare hidden_state read_write and next_projection_input
write, as in the f32 variant. hrx-backend-test now checks both accesses; with
the old manifest that check fails.

Measured on strixhalo (gfx1151, performance mode), Qwen3-Coder-30B-A3B
Q4_K_M, before = 0d3ed9e, after = this commit, same build config:
- llama-perplexity -c 128 one chunk, ub 2/3/4/5: before decode fails,
  after PPL 6.1303; ub 1/8/16 unchanged (6.2033 / 6.0813 / 6.0670)
- server cached tails of 0..12 tokens, --parallel 1 and 4: before 4/13 HTTP
  500 (2..5 tokens), after 0/13; 4 concurrent requests --parallel 4: before
  4/4 HTTP 500, after 4/4 200
- tools/kat.py --repeat 3: PASS at --parallel 1 and 4
- -c 512 10 chunks, -b 512: PPL 10.6893 both, KLD 0.000000, top-1 100%;
  -b 4 -ub 4 after: KLD 0.001954 (two runs identical), -b 1 reference 0.002129
- llama-bench -fa 1, 3 interleaved rounds, medians: pp512 2081.15 -> 2084.97,
  tg128 91.60 -> 91.58; pp4 fails warmup before, 115.73 t/s after
- test-backend-ops -b HRX0 MUL_MAT_ID 132/132, RMS_NORM 6/6, ADD 22/22,
  MUL_MAT 350/350 (x2; the f32 m=1 n=1 k=2048 case fails 1 in 7 runs on
  both builds)
- Qwen3-30B-A3B-Instruct-2507 Q4_K_M: tails 2..5 HTTP 500 before, 0/13
  failures after at --parallel 1 and 4

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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