Repository navigation
qwen38: the seat takes -ub/--ubatch-size over BLOOMERY_QWEN3_UBATCH, one size for its plans and its load - #881
Conversation
…one size for its plans and its load The qwen38 seat refused -ub and --ubatch-size as unknown arguments, so LLAMA_ARG_UBATCH, which the launcher passes as --ubatch-size, was refused too, and the ubatch size could only come from BLOOMERY_QWEN3_UBATCH. The seat now reads the flag through ubatch_rule, the flag over the variable, once with its flags; every plan it asks and the load's arena take that one size, each clipped to its context. A size outside 1..=4096 is refused by name before the model opens. ubatch_rule moves from qwen3moe_place to its own shared file, which the qwen3 seat's dense loads, the decide seat's backbone probe and the qwen38 seat include; the decide seat's copy of it is gone.
There was a problem hiding this comment.
Verdict: CLEAN: the Qwen3.8 seat reads one ubatch size and every former ubatch_for site now takes it; I found no unrefuted failure path.
Non-blocking
⚠ The unit test does not pin the plan/load wiring: qwen38.rs:3192. The test covers parse_args and ubatch_rule. Two mutants stay green: ubatch_rule(a.ubatch) at line 1362 changed to ubatch_rule(None), and a.ubatch.min(a.ctx) at line 2231 changed to UBATCH.min(a.ctx). Either one makes the plan and the load disagree. Only the manual GB10 runs in the PR body catch this. The direction of a fix is a hw_ gate that compares the need line and the load line's ubatch= at -ub 48. This is its own piece of work.
⚠ The test's refusal half repeats a rule that Rule::of owns: qwen38.rs:3205. The 0 and UBATCH + 1 cases pin the range of ubatch_pick.rs:60, which a test in ubatch_pick.rs already refuses at 0 and at 8192. Keep the -ub and --ubatch-size parse cases and the 4k case. Drop the rest if the maintainers want one test per contract.
⚠ Question: sizes below 9 were not run. The body ran -ub 48 only. The seat's prompt path walks the GEMM route from 9 rows (qwen38.rs:315). -ub 1 is accepted by Rule::of and was already accepted through the env lever. Please run one prompt at -ub 1 or -ub 8, or state the lowest size that is supported.
Checked
- Duplicates: 3 new items checked (
ubatch_rulefile,Args::ubatch,Plans::ubatch), none duplicated. The movedubatch_ruleand the two repeated lines indecide.rsare removed. dryer did not searchcrates/gpu-gates; I greppedubatch_rule,ubatch_for,ubatch_sizeandubatch_askedby hand. The remainingubatch_forcallers are qwen4exp gates androuted_legs/qwen38.rs, not this seat. - Complexity:
parse_args32 → 34, one match arm and one default field, even growth. No finding. - Silent failure: 4 sites followed. Flag
0and4097end inRule::of's named error.4kends inserve::flag::number. An invalid env value ends inubatch_asked. With neither set, the seat takesUBATCH, which equals the oldubatch_size()default. - Tests: the new test fails when the flag arm is removed or the range edge moves. It passes on the two wiring mutants listed above.
- Gates: no band, tolerance or lint moved. The
tools/model-tax.tsvPIN row is dated and gives its reason. - Performance: host-side flag handling at load. No hot path touched.
- Escape catalog: no pattern matched (no shell or tool script changed).
Notes
- The GPU runs in the PR body used earlier heads. The body says the head itself was not rerun on a card. The unit and compile checks ran on a different machine (RTX 5090) than the
nvidia-smiline (GB10). - crapper ran; dryer did not search
crates/gpu-gates.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/bin/shared/qwen3moe_place.rs, crates/gpu-gates/src/bin/shared/serve_seats/decide.rs, crates/gpu-gates/src/bin/shared/serve_seats/qwen38.rs … and carries a gate run on the author's card, which counts as verified.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
Qwen3.8 서버가
-ub/--ubatch-size와LLAMA_ARG_UBATCH를 받아서, 카드 메모리를 줄이려고 ubatch 크기를 낮출 수 있게 합니다. 이 값을 주지 않으면 동작은 그대로입니다.Part of #565.
What and why
On upstream main,
bloomery-serverefuses-uband--ubatch-sizefor a Qwen3.8 checkpoint withunknown argument "--ubatch-size", andLLAMA_ARG_UBATCHends in the same refusal. The seat reads its prompt ubatch only fromBLOOMERY_QWEN3_UBATCH. A user who wants to lower the ubatch to free card memory has to know that lever.This change makes the Qwen3.8 seat take
-ub/--ubatch-size(andLLAMA_ARG_UBATCH, which the launcher already maps to--ubatch-size). The flag wins overBLOOMERY_QWEN3_UBATCH; with neither set, the size stays 4096. The seat resolves the size once, right after the flags, and hands it to its plans, the placement offer, the vision cost plan and the engine thread's load, so the plan and the load always use the same size. A value that is not a number, 0 or above 4096 is refused by name before the model opens, with the same text as the Qwen3 seat.The rule "flag over
BLOOMERY_QWEN3_UBATCH" now lives in one shared function,ubatch_ruleincrates/gpu-gates/src/bin/shared/ubatch_rule.rs. It moved out ofqwen3moe_place.rs, and the copy of the same two lines inserve_seats/decide.rscalls it. TheBLOOMERY_QWEN3_UBATCHregistry doc and the-ubparagraph indocs/serving.mdnow name the Qwen3.8 seat.Release notes: Added:
bloomery-servetakes-ub/--ubatch-size(andLLAMA_ARG_UBATCH) for a Qwen3.8 checkpoint, so the prompt ubatch can be lowered to free card memory.Code shape
ubatch_rulehas one owner. The Qwen3 placement file defined it andserve_seats/decide.rsrepeated its two lines; both now call the shared file, and the Qwen3.8 seat calls it too.cargo fmtandcargo clippyon what I touched:cargo clippyonbloomery-gpu-gatesandbloomery-leversfinished with no warnings. I did not runcargo fmtseparately.Duplication found or removed (
path:line): the copy incrates/gpu-gates/src/bin/shared/serve_seats/decide.rsof the flag-over-lever rule, now a call toubatch_rule.What I ran
Head
2718786cb7f3e5f7bdcf626f04e1eea90a79f9a3, base7908410cc846333bbbbf6a521257aaab0652e74a. The change is host-side flag handling, so I ran the plan and the load, not a timed measurement. The GB10 runs below used the same code before the later rebases and beforeubatch_rulemoved to its own file; the body and the values its callers pass are the same. The RTX 5090 checks ran on5d961f208e442c33e031fee7f4d62d56e4cd2255, an earlier base. The head adds thetools/model-tax.tsvrows for the moved rule and a rebase, andpython3 tools/model_tax.py checkis ok on it. I did not rerun the GPU and compile checks on the head itself.Model:
nvidia/Qwen3.8-Flash-Next-FP4-Localat revisionb9ce18a6887e18c089fdea8509a33e63429a3300. The MTP arms usedmtp-Qwen3.8-Flash-Next-shared-Q8_0.gguffromunsloth/Qwen3.8-Flash-Next-GGUFat766911a6. Each arm isbloomery-serve -m <folder> --host 127.0.0.1 --port <port>plus the arguments named below.Plan (
--plan), card bytes from theneedline:The lever alone is read, the flag beats the lever (the last plan equals the flag alone), and
LLAMA_ARG_UBATCHreaches the seat.Refusals, each before the model opens:
Load, one slot, default against
-ub 48; theloadline names the size the arena was opened with:The plan's card bytes fall from 87079362176 to 83680187760 and the loaded resident bytes from 87953641128 to 84650035808, so the plan and the load follow the same size. Every serve arm loaded.
Greedy output, default against ubatch 48,
temperature0, every request returned its ids: identical in all seven requests. They were a single 4200-token prompt; a 4097-token prompt followed by a 4300-token continuation with the prompt cache on; and, with the MTP draft, 4 slots,--ctx-size 16896, two 4150-token prompts sent together and two 3600-token windows sent staggered whose decode crosses position 4097.Unit and compile checks on
5d961f208e442c33e031fee7f4d62d56e4cd2255, on an RTX 5090 machine:just check(workspace, all targets, all features),just gate-q38-serve-rulesandjust gate-gpu-gates-lib:The new test reads
-ub 48and refuses sizes at 4096 plus one, so removing the flag arm or moving the range edge turns it red.Not run: a timed A/B (the change adds no work at a given size) and any measurement of how much prefill time a small
-ubcosts.Hardware
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.