Skip to content

fix(qwen3_5): integrated GPUs run the MTP head eagerly and draft one token by default (commits for #11) - #18

Open
BlivionIaG wants to merge 2 commits into
qwen35-enginefrom
qwen35-apu
Open

BlivionIaG wants to merge 2 commits into
qwen35-enginefrom
qwen35-apu

Conversation

@BlivionIaG

Copy link
Copy Markdown
Owner

Commits for #11 (mirror of ashhart#631): based on qwen35-engine (7f5fd5b), so the diff is only the two commits below. They change what an integrated GPU (an APU) runs and nothing on a discrete GPU.

What this changes

  1. fix(qwen3_5): the MTP head runs eagerly on integrated GPUs, where its first graph launch faults (gfx1033): on a Steam Deck the head's first replayed graph faults. The engine reads the HIP integrated attribute it already has, and on an APU the head's chains run eagerly; the rounds keep their graphs.
  2. perf(hip): an integrated GPU drafts one MTP token by default: without --mtp-drafts, the HIP server drafts one token on an integrated GPU (Device.integrated, the HIP attribute) and keeps three on a discrete one. On the Deck a verify of four rows costs much more than one of two, so three drafts a round decode slower than one on every text measured. --mtp-drafts still sets any depth from 0 to 3.

Receipt

  • Environment: base qwen35-engine 7f5fd5b, head 317338f. Zig 0.17.0, HIP 7.14 (TheRock), Linux 7.1.7. GPUs: Radeon PRO W7800 (gfx1100), Radeon PRO V620 (gfx1030), Steam Deck LCD (gfx1033, 12 GiB GTT, 15 W).

  • Discrete GPUs unchanged:

    • W7800, tf-qwen35-test logits byte-identical to the base for Qwen3.5-9B 4-bit MTP (decode 300 rounds, prefill 300 and 53 rows) and Qwen3.6-35B-A3B 4-bit MTP (decode 300 rounds, prefill 300 rows).
    • The W7800 server still logs mtp drafts 3.
  • Steam Deck (gfx1033), 9B MLX 4-bit MTP, greedy, 256 tokens. Measured on the fork's Deck branch, which also carries the tile changes of perf(hip): the stream tile stages x in LDS and sizes its waves by compute units; RDNA2 64-row prompt tile (stacks on #7) #17. Each request starts at or below 70 C, because under minutes of load the APU drops to 200 MHz near 90 C.

    text 3 drafts 1 draft
    story, 266-token prompt 18.7 tok/s 19.4 tok/s
    story, 2,046-token prompt 14.6 tok/s 16.3 tok/s
    code 19.1 tok/s 20.3 tok/s
    explain 19.1 tok/s 20.1 tok/s
  • Break check: a default of three drafts on an integrated GPU fails the new policy test (expected 1, found 3).

  • Tests run:

    • W7800 and V620: hip-kernel-test 62/62, hip-gpu-test 38/38, hip-affine-test 30/30.
    • macOS zig build test test-golden -Dcpu=apple_m1: 171/173 steps, 0 unexpected golden differences. The one failing step is core.checkpoint_metal's split-checkpoint test, which fails the same way on the base.
    • Linux zig build test from the pushed head: 57/57 steps, 692/699 tests (7 skipped).
    • zig fmt --check clean. lean_check.py 539, the same as the base.
  • Not run, and why: other APUs (RDNA3.5 Strix Halo and the like: none here); the Deck's numbers come from its own branch, not from this head alone, because this head has no Deck build without perf(hip): the stream tile stages x in LDS and sizes its waves by compute units; RDNA2 64-row prompt tile (stacks on #7) #17's tiles.

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Model check on the Deck; logits unchanged on a discrete GPU.)
  • No precision traded for speed. Draft depth never changes a reply's tokens.
  • Prompt processing is no slower than the last release.
  • The description says which platforms I ran and which I could not.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

On the Steam Deck (gfx1033) a verify round of four rows costs much more than one of two, so three drafts a round
decode slower than one on every text measured. Without --mtp-drafts the HIP engine now drafts one token on an
integrated GPU (the HIP attribute) and keeps three on a discrete one; --mtp-drafts still sets any depth.
Drafts never change a reply's tokens: drafted == serial holds at every depth.
BlivionIaG pushed a commit that referenced this pull request Oct 20, 2026
…d CUDA

- #65's prompt-end entry follows kept message starts, and the decoder's entries view their rows; the 27B's tests
  expect entries one token early.
- Ternary Bonsai 2 27B (prism-ml's 2-bit pack) as a lane family: Prism rotations, 2-bit lanes, exact widening before
  M5, with Qwen3.8-27B's DFlash2 drafts. Recipe: docs/recipes/ternary-bonsai-2.md.
- --vision: up to four images a request (data URLs, or HTTPS links with --vision-urls) on the lane engine, MLX and
  CUDA. Image replies keep drafting and equal "draft": false ones; an image prompt keeps no prompt-end entry.
- The --vision checks and options move to serve_options.py.

Fixes #18, fixes #81.

This branch has not been deployed

No deployments
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