Skip to content

serve seats: --slot-ctx names one request's context apart from the count, and qwen38 takes --parallel auto - #1011

Merged
juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:dgx-spark-q38-usab-parallel-ctx
Oct 30, 2026
Merged

juliankang4 merged 2 commits into
midagedev:mainfrom
juliankang4:dgx-spark-q38-usab-parallel-ctx

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

--slot-ctx로 슬롯 하나의 컨텍스트를 슬롯 수와 따로 정하고, Qwen3.8에서 --parallel auto로 메모리가 감당하는 슬롯 수를 서버가 고르게 했습니다.

What and why

--ctx-size is the total that the slots share, so asking for four requests of 32,768 positions means doing the arithmetic (--parallel 4 --ctx-size 131072). This PR adds --slot-ctx S, one request's context: --parallel 4 --slot-ctx 32768 serves four slots of 32,768 positions each, and --slot-ctx alone serves one slot of S. Beside --ctx-size it is refused by name, since one flag would name the total and the other a slot's share. Every seat that takes --parallel takes --slot-ctx.

On the Qwen3.8 seat, --parallel auto serves the most slots, up to 8, whose plan holds one request's context (--slot-ctx when set, else the context one slot's default takes). The parallel line reports from=auto. Every other seat refuses --parallel auto by name. When the draft does not fit at the count auto would pick, auto falls back to the existing one-slot draft yield instead of refusing. The one-request hint printed under --slot-ctx names --slot-ctx rather than --ctx-size. README.md, docs/serving.md and docs/BUILD.md describe the flags, and the qwen38 and qwen3 serve gates read the default-context clauses as "the largest step the card holds".

Release notes: Added: --slot-ctx S sets one request's context apart from --parallel, and the Qwen3.8 seat takes --parallel auto to serve as many slots as memory holds at that context.

Code shape

The review reads these first. A box left unticked needs one line of why.

  • No second copy. Logic two models (or two call sites) share has one common owner; I lifted it there instead of
    copying it (AGENTS.md "Common code first", docs/rust-quality.md R14). Where I found an existing copy, I
    named it below.
  • Model code holds only architecture facts. A model's own files carry only what its architecture forces
    (tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
  • Dead code is gone. Nothing I made unused is left behind (functions, flags, gate clauses, docs).
  • No silent failure. Undefined input is a named error or panic, never a defined-looking output.
  • Comments state what is true now. No dates, issue numbers or how a bug was found (tools/check-comments.sh).
  • No relaxed gate. No band, tolerance or lint moved to make a check pass; a re-pin carries PIN(YYYY-MM-DD):
    and its reason.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line): the one-request hint that slots_given (glm, qwen3, tiered) and the qwen38 seat each printed now has one owner, bind::one_request_line in crates/gpu-gates/src/bind.rs.

What I ran

On one DGX Spark, the built bloomery-serve with the Qwen3.8-Flash-Next-FP4-Local files (revision b9ce18a6887e18c089fdea8509a33e63429a3300), eight concurrent /completion requests (n_predict 24, temperature 0) after the server was ready:

bloomery-serve -m "$M" --parallel auto --slot-ctx 32768 --port 18099
ctx rule=set ctx=32768 slots=8 total=262144 limit=262144 (trained)
parallel rule=slots slots=8 slot_ctx=32768 total=262144 from=auto pass=one
req 4 http 200 2.308673s
req 8 http 200 3.280085s
req 1 http 200 3.280147s
req 5 http 200 3.280197s
req 2 http 200 3.641000s
req 3 http 200 3.641093s
req 7 http 200 3.641035s
req 6 http 200 3.641124s
wall 60 s for 8 requests
server rc 0

Gate run on the same card, gate_qwen38_serve on the Qwen3.8 UD-Q4_K_XL GGUF files, the new clause and the context checks this diff reaches:

check ctx_default_is_the_largest_step_held: PASS
check plan_floor_counts_the_engines_state: PASS
check parallel_default_holds_what_its_rule_names: PASS
check ctx_past_the_fit_is_refused_by_name: PASS
check ctx_set_parallel_unset_is_one_slot: PASS
ctx auto: parallel rule=slots slots=8 slot_ctx=4096 total=32768 from=auto pass=one; ctx rule=set ctx=4096 slots=8 total=32768 limit=262144 (trained)
check hw_auto_slots_preserve_the_requested_context: PASS

The gate has 102 checks, 96 pass and 6 fail. The six are in the drafted and paged clauses, which this diff does not touch, and they fail the same way on upstream main.

Host tests for the new auto yield. The first command prints parallel auto slots=1: the default does not hold at one slot (the host room ... is under the NVMe expert tier's floor ...) for the new case where the draft is refused and the plain plan fits:

cargo test -p bloomery-gpu-gates --release --features deepseek41,gemma-embedding2,hf --bin bloomery-serve-qwen38 -- auto_slots_keep_the_fitting_ --nocapture
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 27 filtered out; finished in 0.01s
cargo test -p bloomery-gpu-gates --release --features deepseek41,gemma-embedding2,hf --lib -- context_retry_preserves_the_flag_and_its_units --nocapture
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 307 filtered out; finished in 0.00s

Each test fails without its fix. Putting the old guard back in auto38 (Err(e) if e.is::<FloorShort>()) turns auto_slots_keep_the_fitting_drafted_plan red at its new assertion (the draft yield answers it: Placement(HostRoomFloor { ... }), rc 101). Making the one-request hint ignore the recorded flag (if false { in place of if crate::start::slot_ctx_noted() {) turns the context-retry test red at its flag assertion (rc 101).

Hardware (if the change is for a machine)

One DGX Spark (GB10), driver 595.84, CUDA 13.3.

AI help

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

@github-actions github-actions Bot added documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement serve The HTTP server: crates/serve labels Oct 30, 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 proven behavior or quality defect remains in the changed paths.

Non-blocking

⚠ Complete the GPU evidence: crates/gpu-gates/src/bin/gate_qwen38_serve.rs:3904 has reported PASS output, but no FAIL-first run for its context-sharing mutant. Attach that failure, the nvidia-smi line, both engine commit hashes, and the exact just gate-* commands with output. This lets maintainers verify the new clause before merge.

Checked

Duplicates: 25 new functions, types and constants, plus 2 renames checked; no duplicate found. Dryer reported 0 pairs. The shared slot parser and existing bisection own the common logic.
Complexity: host_room_fits_the_default (34) is a rename; auto38 (17) combines context selection and capacity classification; ctx (59→74) adds a gate clause. run (151→158), parse_args (37→39) and check (26→28) add startup branches, outside the token step.
Silent failure: 7 fallback sites followed. Missing capacity returns to the one-slot refusal or draft yield; context hints require a set context; absent retry capacity offers no retry; the remaining defaults represent omitted options or mutex-poison recovery.
Tests: static mutation review only. Removing the slot-context multiplication, changing bisection bounds, dropping host-capacity classification, removing the draft fallback, changing the fitted default's count, swapping retry units, removing the environment alias, or changing the auto record word is rejected by assertions. The hardware clause rejects passing a slot's context as the total when several slots fit.
Gates: no thresholds relaxed or cases removed; context-clause renames preserve their assertions. The context PIN wording changed without changing its check.
Escape catalog: C1–C4 do not match. Overflow, configuration precedence, one-slot capacity, draft refusal and non-capacity error propagation were traced.

Notes

Dryer did not search crates/gpu-gates; its changed items were checked manually.
Validation was static; no builds or tests were run.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/bloomery_serve.rs, crates/gpu-gates/src/bin/gate_ds41_serve.rs, crates/gpu-gates/src/bin/gate_glm5next_serve.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 a89b7eb into midagedev:main Oct 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app needs-gpu Changes code a card must check, and carries no gate run on a card placement Placement planning: crates/placement serve The HTTP server: crates/serve

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant