Skip to content

qwen3moe: Qwen3-30B's placed card leg reads Qwen3.6's arms - #640

Merged
midagedev merged 2 commits into
mainfrom
q30leg
Oct 22, 2026
Merged

midagedev merged 2 commits into
mainfrom
q30leg

Conversation

@midagedev

@midagedev midagedev commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

What

Qwen3-30B-A3B (Program::Qwen3moeBody: Instruct-2507, Coder-30B and their fine-tunes) reads the same placed card-leg
arms as Qwen3.6 (prompt_leg_gate_up / prompt_leg_down), from one place in crates/placement/src/accepts.rs. Its
Q8_0 and Q6_K expert stacks now go to the card leg. Before this change, the plan put 0 card experts on either file.

  • crates/gpu/src/arch/qwen3moe/placed.rs owns card_leg, common_forms and stack_ty. body.rs and body35.rs
    both read them, and body35.rs drops its own copies.
  • New Placed::within: a load refuses card bytes above what the plan counted. Both bodies call it.
  • crates/model/src/arch/coverage.rs ROW_PINS re-pinned (PIN(2026-10-22)) for the new arms.
  • New clause (z) in gate_qwen3moe_e2e. A Q8_0 or Q6_K file places card experts on common layers and decodes the
    whole-host run's greedy ids within the gate's band.

Prediction and measurement

Card docs/cards/q30leg-decode.card [derived]. One RTX 3090, serving defaults, ctx 131072. Plan: Q8_0
card_experts=1746 (f 0.284), Q6_K card_experts=2306 (f 0.375).

file predicted [derived] measured: base → q30leg (tg tok/s) difference, 95 % interval
Q8_0 45.4 → 56.3, +16..+26 % 49.62 → 59.08 +19.06 % ± 1.32 %
Q6_K 53.7 → 70.2, +20..+34 % 59.89 → 67.47 +12.67 % ± 6.62 %

Measurement: just depth-serve on one RTX 3090 (250 W cap), base main a0d5dec (this branch's parent). Four rounds,
D 6, N 128, ctx 131072. Lead hold up; 0 of 16 rows [cpu-busy] or [other-busy]. Prefill at D 6 also rose: Q8_0
81.40 → 108.22 tok/s, Q6_K 92.55 → 130.93.

Q8_0 is inside its band. Q6_K is under it. The base ran faster than the model said (59.89 against 53.7 tok/s), so
the host leg costs less than the model's 128 GB/s term assumed, and taking a share of it off the card saves less. The
q30leg arm's rows on Q6_K scatter by 4.6 %. The gain is positive on both files. The host-leg bandwidth term goes to
the triage for a re-fit.

Gates

Real tier, from the round (tools/gate-batch.sh --tier real, DONE total=6 red=0):

  • gate-placement, gate-qwen3moe-meta, gate-gpu-qwen3moe-types
  • gate-gpu-qwen3moe-e2e with (z)
  • gate-gpu-qwen35moe-leg, gate-gpu-qwen35moe-e2e

Also green:

  • gate-gpu-lib, run alone.
  • The serving smoke on the Q8_0 file: it opens with card_experts=1746.

FAIL-first:

  • The old arms back on Qwen3moeBody turn (z) red with card_experts=0.
  • header_common_forms returning NONE makes the load refuse by within.
  • Swapping gate and up in common_stacks turns the logits and greedy-ids checks red.

just affected selects 198 of 222 recipes, because placement is a common owner. They run in the 0.3.8 release batch
(fixture tier, the union).

🤖 Generated with Claude Code

Qwen3moeBody's leg_arms and routed_rule are Qwen35Body's prompt_leg
pair, so a Qwen3-30B file with Q8_0, Q6_K or IQ4_XS experts places
card experts on common layers. placed.rs owns card_leg, common_forms
and stack_ty for both bodies; placed_bytes and placed_scratch take the
forms, and Placed::within refuses a load holding more card bytes than
its plan counted. gate_qwen3moe_e2e's clause (z) runs a Q8_0 file's
common layers against its whole-host run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@midagedev midagedev added enhancement New feature or request gpu The card engine: crates/gpu*, crates/app model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja placement Placement planning: crates/placement needs-gpu Changes code a card must check, and carries no gate run on a card labels Oct 22, 2026
@github-actions github-actions Bot added the tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo label Oct 22, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MUST_FIX: the shared budget search duplicates the search still used by the Qwen3.6 gate.

Must fix

1. Use the shared budget search in both gates

shared/qwen3moe_place.rs:419 copies the bisection and budget-floor error handling in gate_qwen35moe_e2e.rs:3516. This is a kind B duplicate under R14. Removing the local copy prevents later planner changes from requiring two edits.

Delete the local budget_for_card_experts definition and its doc block. Retarget the doc link at line 3632 to PlaceQ3::budget_for_card_experts. Replace the call at line 3687 with:

let budget = q.budget_for_card_experts(CTX, want, top)?;

Replace the closure at line 3995 with:

|q| q.budget_for_card_experts(CTX, 0, placed_budget()),

Both gates then use the shared owner, with fewer definitions and lines.

Non-blocking

⚠ Complete the GPU and timing evidence: docs/cards/q30leg-decode.card:30 requires quiet rows and reruns of busy rows. The card models moving 28.4%/37.5% of Q8_0/Q6_K experts off the host, but the PR supplies busy Q8_0 timing and gate summaries. Supply quiet decode and prefill A/B output for both files, owning gate commands with output, the card/driver line and both commit hashes.

Checked

  • Duplication: both budget searches read and confirmed equivalent apart from parameters and diagnostic wording. Dryer reported no pairs and excluded GPU/gate crates.
  • Complexity: diagnostics flag z_load, common_leg_file, run, Body::load and Body35::build; complexity alone yields no finding.
  • Silent failure: invalid stack dimensions and failed conversions reach shape errors; the budget search ignores only floor refusals.
  • Tests: clause (z) rejects zero card placement and checks logits. The PR reports swapped-stack FAIL-first evidence. GPU gates were not run during validation.
  • Gates: routed coverage pins and the new logits band have dated PIN reasons; no numeric band was relaxed.
  • Escape catalog: C1–C4 have no matches in the changes reviewed.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_qwen3moe_e2e.rs, crates/gpu-gates/src/bin/shared/qwen3moe_place.rs, crates/gpu/src/arch/qwen3moe/body.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the last review:

Must-fix 1 is fixed: both Qwen3.6 callers now use the shared budget search.

Verdict: CLEAN: the incremental changes remove the duplicate search and preserve both callers' behavior.

Checked

  • Duplication: no new definitions. One budget-search definition remains, with three callers.
  • Complexity: the changed callers gain no branches.
  • Silent failure: 1 budget-floor filter followed. Only that refusal becomes None; other errors reach both callers through ?, as before.
  • Tests: no assertions or test contracts changed. The shared search matches the removed body after parameter substitution and diagnostic wording. GPU gates were not run during validation.
  • Gates: no pins, bands, assertions or cases moved or removed. The deleted function was a duplicate planning helper.
  • Escape catalog: C1–C4 have no matches in this increment.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_qwen35moe_e2e.rs, crates/gpu-gates/src/bin/gate_qwen3moe_e2e.rs, crates/gpu-gates/src/bin/shared/qwen3moe_place.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gpu The card engine: crates/gpu*, crates/app model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant