Skip to content

bloomery-serve: the qwen3 seat holds its stage card before it reads the room, so its plan is the CLI's split - #952

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-fix-qwen3-serve-cli-split
Oct 29, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-fix-qwen3-serve-cli-split

Conversation

@juliankang4

@juliankang4 juliankang4 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

bloomery-serve의 qwen3 좌석이 카드를 먼저 잡은 뒤 빈 메모리를 읽게 해서, 서버의 expert 배치가 CLI와 같아집니다.

What and why

bloomery-serve --model qwen3 and generate_qwen3moe plan the same load but read the card's free bytes in different states. The CLI opens the stage card (its context and the device bundle) before it plans. The qwen3 seat of bloomery-serve read the room before it opened any card, so it saw 4 MiB more free memory. At ctx 262144 that is two more card experts for the server (card_experts=1538 against the CLI's 1536), which is why completion_ids_are_the_cli_ids fails.

The seat now resolves its stage card from the census and calls Gpu::hold_card before every plan, --plan included, as the qwen38 seat already does. No record or schema changes.

Release notes: Fixed: the qwen3 server plans the same expert split as the CLI at the same context.

Code shape

  • No second copy. The seat calls the existing Gpu::hold_card, the call the qwen38 seat makes.
  • Model code holds only architecture facts. The change is in the qwen3 seat and adds nothing to a common owner.
  • Dead code is gone. Nothing was made unused.
  • No silent failure. A census or card-spec failure returns its error through ?.
  • Comments state what is true now.
  • No relaxed gate. No band, tolerance or lint moved.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line), or "none": none.

What I ran

Base 822b3f1, head 50c6e89, on an RTX 5090 machine, at ctx 262144 with --place a. Models: Qwen3-30B-A3B Q4_K_M and Qwen3.6-35B-A3B Q4_K_M.

bloomery-serve --model qwen3 --port 0 --parallel 1 -m <model> --ctx 262144 --place a --plan
generate_qwen3moe --arm 785,2326,6028/2 --ctx 262144 --place a --last-step

The plan line of each:

Qwen3-30B-A3B
base  bloomery-serve     host_experts=4606 card_experts=1538
base  generate_qwen3moe  host_experts=4608 card_experts=1536
head  bloomery-serve     host_experts=4608 card_experts=1536 card_free=33134673920
head  generate_qwen3moe  host_experts=4608 card_experts=1536 card_free=33134673920
Qwen3.6-35B-A3B
head  bloomery-serve     host_experts=0 card_experts=10240 card_free=33134673920
head  generate_qwen3moe  host_experts=0 card_experts=10240 card_free=33134673920

On the head, both processes plan the same split and read the same free bytes for both models.

Hardware (if the change is for a machine)

NVIDIA GeForce RTX 5090, driver 595.99.02.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

@github-actions github-actions Bot added gpu The card engine: crates/gpu*, crates/app needs-gpu Changes code a card must check, and carries no gate run on a card labels Oct 29, 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 change is right, but --plan now opens a card and a comment 160 lines below still says it does not.

Must fix

1. The --plan comment says no card was opened

qwen3.rs:2447 says "nothing was opened on a card". This PR adds Gpu::hold_card at line 2282, before every plan, and it runs for --plan too (the new comment says so). hold_card opens the device, so its context and the bundle stay loaded for the process. A reader who trusts the old comment will think --plan is free of a card open. It is not, and a host with no usable card now fails --plan at the hold.
Fix: replace lines 2447 to 2448 with:

        // The records the load would print first are out; no model was
        // opened on a card (the stage card was held above, and dropped).

Non-blocking

⚠ The hold also runs for the qwen35 and qwen35moe families: qwen3.rs:2282. It sits before the family branch, so it changes the room those plans read. The qwen35 CLI path plans first and opens the card after (qwen35_open.rs:111-113). If so, the qwen35 server may now plan 4 MiB differently from its CLI, the reverse of this fix. The PR body measures qwen3moe only. Question: did you compare a qwen35 server plan with its CLI plan? If not, name the family in the PR body, or run that pair.

Checked

  • Duplicates: 0 new functions or types. The new lines repeat the 3-line stage-card hold of qwen38.rs:1617-1618, each from its own seat's place flag. A shared helper would add an element for 2 lines, so no finding. dryer did not run (no changed file under crates/, per diagnostics).
  • Complexity: qwen3::run 77 to 81 (crapper), straight-line growth from one hold, harmless.
  • Silent failure: 4 sites followed (census()?, on()?, card_specs()?, hold_card()?). All return errors through ?; none defaults.
  • Ordering: no mem_info or alloc_room read before line 2282 in run (draft_of, check, Split::open read no room), so the hold is first.
  • Tests: none added. completion_ids_are_the_cli_ids is the existing gate and fails on the base by the PR's account, so it turns red if the hold is removed.
  • Gates: no pins moved. Escape catalog: no pattern matched (Rust only, no shell).

Notes

  • Evidence: the PR body has both hashes, the model, the commands and the plan lines, but no nvidia-smi line and no just gate-* output.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/shared/serve_seats/qwen3.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)

@juliankang4
juliankang4 force-pushed the dgx-spark-q38-fix-qwen3-serve-cli-split branch from 22a4754 to 50c6e89 Compare October 29, 2026 07:32

@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: CLEAN: the qwen3 seat now holds its stage card through the existing Gpu::hold_card before any plan reads the room, and I found no failure path.

Non-blocking

⚠ Gate not run: the PR body names no just gate-* command and no gate_qwen3_serve output, so completion_ids_are_the_cli_ids (the clause this PR says was failing, gate_qwen3_serve.rs:4567) is not shown green after the change. The --plan lines are good evidence for the split. Please add the gate run and the nvidia-smi line (the body has a model name and driver, not the nvidia-smi line CONTRIBUTING.md asks for).

Checked

  • Duplicates: 1 new item (the hold block) checked. It matches the qwen38 seat's call to the existing Gpu::hold_card. It is a reuse, not a new owner. dryer did not run (no changed file under crates/).
  • Complexity: qwen3::run 77 → 81, straight-line growth (one ? chain and one call). It is a seat entry point, and splitting it is its own work.
  • Silent failure: 4 fallible calls followed (census, on, card_specs, hold_card). Each returns through ?. a.place.unwrap_or(Place::A) is the seat's existing default; the same expression is used at lines 2307 and 2325.
  • Failure paths built and refuted: (1) unset --place holds a different card than the one planned. PlaceQ3::unplaced_on is Place::A.on(census) and q3place::choose returns the same card, so hold, plan and load use one card. (2) --plan on a host with no card. The census error is returned by name, as q3place::choose below it already does. (3) The hold ordering against vision_of. The PR's --plan lines show an equal split at ctx 262144 for the 30B and 35B files; I could not check a --mmproj run.
  • Tests: no test added. The existing hw gate completion_ids_are_the_cli_ids compares same_split of server and CLI. Mutant: delete the new hold_card call. The planned card_experts goes back to 1538 against 1536 and that clause turns red, but only on a card at a large ctx.
  • Gates: no pins moved.
  • Escape catalog: no pattern matched (no shell, no tools, no comment history).

Notes

gpu.json says evidence: false: the body has no nvidia-smi line and no just gate-* output.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/shared/serve_seats/qwen3.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)

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit e85f0c8 into midagedev:main Oct 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gpu The card engine: crates/gpu*, crates/app needs-gpu Changes code a card must check, and carries no gate run on a card

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant