Skip to content

qwen38: serve paged plans at their requested slot count - #713

Merged
juliankang4 merged 4 commits into
midagedev:mainfrom
juliankang4:fix-q38-paged-slots
Oct 23, 2026
Merged

juliankang4 merged 4 commits into
midagedev:mainfrom
juliankang4:fix-q38-paged-slots

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

Qwen3.8에서 페이지 방식 계획으로 슬롯을 여러 개 요청하면 시작 단계에서 거부되던 결함을 고치고, 네 슬롯 요청이 끝까지 처리되는지 확인하는 검사를 되살립니다.

Part of #565. Tracked in #699.

What and why

bloomery-serve-qwen38 --parallel 4 and generate_qwen3moe with four slots fail on a plan that pages its host experts through the NVMe tier's RAM arena. The placement owner accepts the plan and sizes the arena for four slots, and the load then stops with the one-column rule read another plan.

The placement change that lets a paged plan serve --parallel N in one step (e1a3374) left two older checks in place that still assumed one column. The server's check in the serve seat (shared/serve_seats/qwen38.rs) came in with b787893 and its together(slots) condition with 44c3068. The plain generation load in generate_qwen3moe.rs came in with d9e8bad. Each rejects every paged plan with more than one slot, after the planner has already accepted it.

This PR removes the two stale checks. The planner and ArenaFloor already count each slot's columns, so nothing else in placement changes. The check that a paged plan must not carry an unset draft stays in generate_qwen3moe.rs, since it is a separate contract. There is no new option, public API, kernel or unsafe code.

gate_qwen38_serve's paged clause used to print what the --parallel 2 server did and leave it unjudged (PIN(2026-10-12)). It now starts a four-slot server and judges three things: the server listens with the paged plan served as asked, each of four requests returns the same greedy tokens alone and together, and a round carries all four slots in one step. It also runs generate_qwen3moe with one slot and with four slots (two tokens each) and checks that every slot finishes and no draft loads.

Release notes: Fixed: A paged Qwen3.8 plan now serves the slot count it was asked for, in both the server and generate_qwen3moe, instead of failing at startup.

Code shape

  • No second copy. The slot count reaches the arena floor through the existing plan_with_slots and HostTotals::step_slots; I added no calculation.
  • Model code holds only architecture facts. No model code changes; two stale rejections are removed from the seat and the CLI.
  • Dead code is gone. The two rejections and the clause output they made necessary are gone.
  • No silent failure. The restored clause stops the gate on a server that never listens, a request that errors or returns too few tokens, a token mismatch, or a round that does not carry four slots.
  • Comments state what is true now. The gate's module doc describes the new clauses.
  • No relaxed gate. The paged clause went from printed to judged. The old PIN(2026-10-12) is replaced by a PIN(2026-10-23) with its reason.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up. cargo fmt on the three files and git diff --check are clean; clippy has not been run on this head.

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

What I ran

Model: unsloth/Qwen3.8-Flash-Next-GGUF at revision 766911a6b7369840a91dbcd95f9f997acaab6cd6, UD-Q4_K_XL, four shards. Plan settings: BLOOMERY_DRAFT=off BLOOMERY_RESIDENCY=off BLOOMERY_HOST_ROOM=27G, --place gate. The real-model runs used an earlier revision of this branch with the same code; the branch was later rebased onto newer main, and only a comment in the gate differs.

Hardware: an RTX 5090 machine with no other CUDA process at the start. The nvidia-smi lines:

| NVIDIA-SMI 595.99.02              Driver Version: 595.99.02      CUDA Version: 13.2     |
|   0  NVIDIA GeForce RTX 5090        Off |   00000000:01:00.0 Off |                  N/A |

Both binaries were built with cargo oxide build --arch sm_120 -- -p bloomery-gpu-gates --features deepseek41,gemma-embedding2,hf --release --bin bloomery-serve-qwen38 --bin generate_qwen3moe; the head also built --bin gate_qwen38_serve.

  • FAIL-first, on main: the server with --place gate --ctx-size 1024 --parallel 4 and generate_qwen3moe with BLOOMERY_GEN_SLOTS=4 --place gate --ctx 1024 --tokens 1,2,3,4 -n 2 both exit 1. The server stops with the load's plan pages host experts through the NVMe tier's 22512709632 B RAM arena at 4 slots, the draft off: the one-column rule read another plan; the CLI stops with the same message at 23494107136 B. The planner line before it reads paged rule=served arena=22512709632 asked_slots=4 slots=4.

  • Head, server: it listens and prints paged rule=served arena=22512709632 asked_slots=4 slots=4. Four different prompts were sent one at a time and then together (temperature=0, 16 tokens each, ignore_eos=true, cache_prompt=false). All four token lists are identical alone and together (GREEDY request=0 to request=3, match=True), the rounds show rows=4 passes=1 slots=4, and the check ends PAGED_PARALLEL PASS four requests, 16 greedy tokens each, positive arena, rows=4 passes=1.

  • Head, CLI: generate_qwen3moe finishes four slots with two tokens each in eager and in graph mode, the per-slot tokens agree (CLI eager arena=23494107136 tokens={0: [271, 2], 1: [220, 17], 2: [16, 15], 3: [16412, 1928]}, the same for CLI graph), and it ends PAGED_CLI PASS four slots, two tokens each, eager equals graph.

  • Host unit test for the slot-aware arena floor, cargo test --release -p bloomery-placement the_arena_floor_counts_the_plans_slots -- --nocapture: test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 174 filtered out; finished in 1.66s. It ran on an earlier revision of this branch, and the PR's head differs from it only in a gate comment.

  • Fixture gate on the head:

    BLOOMERY_TIER=fixture just gate-gpu-qwen4exp-e2e
    clauses: 26 ran, 8 left to the real tier
    gpu-gate.sh: gate_qwen4exp_e2e ran 64 s (exit 0)
    

    It includes paths five eager steps vs five graph replays: tokens [157377, 137169, 47835, 32521, 34727] vs [157377, 137169, 47835, 32521, 34727]; every position's logits bit for bit: true.

No kernel, launch, copy or sync changed, so I ran no timing comparison.

Not run: the plain arm of gate_qwen38_serve through just gate-gpu-qwen38-serve. Its harness fixes the plain arm to an RTX 3090, and the machine I had is an RTX 5090, so the paged server and CLI runs above stand in for it. Also not run: clippy and t0. Each real-model run was done once.

Reproduction

cargo oxide build --arch sm_120 -- -p bloomery-gpu-gates --features deepseek41,gemma-embedding2,hf --release --bin bloomery-serve-qwen38 --bin generate_qwen3moe --bin gate_qwen38_serve
BLOOMERY_DRAFT=off BLOOMERY_RESIDENCY=off BLOOMERY_HOST_ROOM=27G target/release/bloomery-serve-qwen38 --place gate --ctx-size 1024 --parallel 4
BLOOMERY_GEN_SLOTS=4 BLOOMERY_DRAFT=off BLOOMERY_RESIDENCY=off BLOOMERY_HOST_ROOM=27G target/release/generate_qwen3moe --place gate --ctx 1024 --tokens 1,2,3,4 -n 2
cargo test --release -p bloomery-placement the_arena_floor_counts_the_plans_slots -- --nocapture
BLOOMERY_TIER=fixture just gate-gpu-qwen4exp-e2e

On main the server and CLI commands stop with the one-column message. On this head the server listens and serves the four requests, and the CLI finishes four slots.

What I ran into

This does not block the PR. gate_qwen38_serve's plain arm is fixed to an RTX 3090, so a paged server on another card is only checked by running it by hand, as above.

AI help

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

@github-actions github-actions Bot added 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 labels Oct 23, 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: CLEAN: No reachable behavior defect or proven quality defect remains in the changed code.

Non-blocking

⚠ Validate the drafted arena change: crates/model/src/arch/qwen35moe/place.rs:3469. The body says no model code changes, but this diff also increases MTP arena floors. The reported bloomery-placement test does not exercise this model regression. Run cargo test --release -p bloomery-model drafted_slot_plans_floor_the_arena_for_every_verify_row and attach its output and tested commit. This checks the additional behavior before callers depend on it.

Checked

Duplicates: 1 new named item checked against existing arena/slot tests; none duplicated. Dryer reported 0 pairs. The gate reuses the existing request, token-comparison and record readers.

Complexity: gate::paged rose from 145 to 171 through added request stages and branches in the CLI loop. These implement separate gate clauses; complexity alone is not a finding.

Silent failure: 6 parse/default sites followed. Invalid arena fields and token lists fail assertions. Display defaults affect diagnostics only.

Tests, by source mutation analysis: both model tests protect place.rs:686; dropping the MTP multiplier makes their column assertions fail. Restoring the startup refusals at shared/serve_seats/qwen38.rs:1772 or generate_qwen3moe.rs:2776 fails the listening or CLI-exit checks. Splitting a round fails the pass-count assertion; shortening or swapping token lists fails length/equality checks. These mutations were not executed.

Gates: the printed parallel clause becomes judged, with a dated PIN and FAIL-first startup evidence. Both removed refusals have dated reasons. No tolerance is relaxed.

Adversarial checks: zero slots are refused; MTP rows are capped at the eight-column port and larger rounds are partitioned between windows; lookup verification runs two rows per slot in turn. Changed code runs during planning/startup or in tools; no decode-loop work is added.

Escape catalog: C1–C4 do not match the diff.

Notes

GPU evidence is incomplete: the reported runs omit the tested base/head commit hashes. The full serve gate was not run. No builds or gates were executed during this static review.

Dryer did not search crates/gpu-gates; those changes were searched manually.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/gate_qwen38_serve.rs, crates/gpu-gates/src/bin/generate_qwen3moe.rs, crates/gpu-gates/src/bin/shared/serve_seats/qwen38.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 3959e25 into midagedev:main Oct 23, 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 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant