Repository navigation
bloomery-serve: the seat's flags and levers are checked before the driver is asked and the model fetched - #912
Conversation
…iver is asked and the model fetched A start with --model reads the seat's own levers and parser on the arguments as the seat will see them, so --help, a flag the seat does not take, a value it refuses and a refused lever end the start before --hf downloads anything; the qwen38 and decide seats hold the ubatch size to the engine's there too. A --head selects the decision seat before these checks. Without --model or --head, every seat checks them and one taking them is enough, since the model file picks the seat; the refusal of an argument every seat refuses names each seat's text once. The decision candidate applies the same embedding restriction as a named decision seat. Head/seat conflicts are checked by the same owner as the final head selection. Output-only handlers distinguish option words from values, including the device list and each seat's record schema. The ds41 seat chooses its placement in run, so its parser reads no card; its --ctx is held to the fewest slots the start serves, and the qwen3 seat's --cache-type-k word to its formats. The decide seat, named or picked by the file, reads the arguments as its own start does, without llama-server's placement variables, so a split mode the generative seats refuse does not end a decision start. Checks that need the model stay after the fetch, the glm seat's image token limit with no --mmproj among them, since the --hf repo may hold a projector to bound. A key file is read once per process, so the check and the seat take the same keys, a pipe's included.
There was a problem hiding this comment.
Verdict: CLEAN: I built no failure path that the diff leaves open, and I found no proven duplicate or unneeded element. Three ⚠ items remain.
Non-blocking
⚠ Check, then unreachable! (R37): glm.rs:427 and qwen38.rs:988. draft_of and draft38 call check_draft_word and then match the same word with an unreachable! arm. check calls check_draft_word too, so the word is checked twice per start. Direction: let check_draft_word return the validated word as an enum, and have draft_of and draft38 match on it. The panic arm and the second call then go away.
⚠ Two trait items for one model: tiered.rs:211 and tiered.rs:232. Tiered::UNHOSTED_POOL and Tiered::prefill_steps are overridden only by Mimo (mimo2.rs:485, mimo2.rs:525). The PR text does not name the architecture fact that forces them. Name it in the doc comment (the body's pool support), or keep the check in Mimo's own check.
⚠ CheckedSeat::run can panic: bind.rs:540. expect("the run reads its levers") holds only if the caller passed read_levers = true. Every call today does. The type does not say it. Also minor: residency_pick parses the residency word a second time through check_residency_feed (tiered.rs:393).
Checked
- Duplicates: about 30 new items checked (
checkentries,check_draft_word,check_slot_ctx,refuse_plain_width,check_residency_feed,serve_optionand thetake_*helpers). No proven duplicate. Therefuse_plain_widthandcheck_residency_feedowners remove more copies than they add. dryer searched onlycrates/leversandcrates/serveand found 0 pairs;crates/gpu-gatesI checked by Grep. - Complexity:
early(27),qwen38::check(24) andds41::check(18) are new functions. Each is a flat chain of refusals, one concern per function. The rises inqwen3::parse_args,SeatFlags::parse,glm::parse_args,qwen38::parse_argsandFlags::takeare one line each, harmless. - Silent failure: 12 sites followed (
early'sreference,seat_viewerrors,file_snapshotcaching a failed read,refuse_unbounded_cache,take_with_envvalue skipping,one_sequence,parse_one_sequence). None turns a bad input into a default. A cached read failure keeps its error on purpose, anddocs/serving.mdsays so. - Failure scenarios built and refuted: a value-less switch before
--help(every seat parser takes a value for each flag except--help,--planand--no-mmproj, whichserve_takes_valuelists);LLAMA_ARG_MODELas the only model source (model_from_envruns beforeearly);--leverswith placement flags (deferred to the seat, documented); a--ctxsplit when the draft word raises the slot count (the sameslots_givenandslots_ofowners decide, andrunstill refuses later). - Tests: the FAIL-first run in the PR body shows 42 red with
earlydisabled. Mutants I planted in words: droppingcheck_head's--head-configbranch turnsa_start_checks_its_arguments_before_the_fetchred. A flippedfrom_repoinmay_pickturnsa_repository_can_supply_limits_only_in_a_vision_buildred. Removing the--aliasvalue skip inserve_argsturnsserve_options_skip_values_and_keep_switchesred. - Gates: no pin moved and no gate removed. Hot path: none (start-up only), so no performance finding.
- Escape catalog: no match (no shell script changed).
Notes
- The PR body has the
nvidia-smiquery line and the gate output, but not both commit hashes. I setgpu.jsonevidence to false for that reason.
Card check: needs-gpu. This pull request changes crates/gpu-gates/Cargo.toml, crates/gpu-gates/src/bin/bloomery_serve.rs, crates/gpu-gates/src/bin/bloomery_serve_ds41.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)
|
The review is done and the contribution check passed, so I'm merging this. |
bloomery-serve가 모르는 flag, 잘못된 값, 모델 출처 누락,--help와--levers를--hf다운로드와 GPU 확인보다 먼저 처리하도록 고칩니다.Supersedes #908.
Part of #565.
What and why
bloomery-serveread a seat's flags and levers only after it had asked the driver and fetched the model with--hf. A typo such as--ctx-size abc, an unknown flag, a bad lever value, or--model qwen38 --helptherefore ended after a large download, and without a model file the seat's help never appeared.Now the launcher checks the arguments as far as that needs no model, card or network.
bloomery-serve --model qwen38 --hf o/r --ctx-size abcends with the argument error before the driver check and the download. With--modelor--head, the selected seat's--help,--leverstable and refusals of flags, values and levers come first. Without either flag the model file picks the seat, so every seat checks the arguments and the start ends only when all of them refuse; the message lists each refusal once with the seats that give it. The picked seat reads the arguments again after the download, as before.Each seat's
checkis one entry intobind::check_seat, which runs the same levers read andparse_argsthat the seat'srunuses and hands the typed result torun, so the early check and the real start share one owner. What needs the model (architecture, a context bound by the file, a draft the file supports) is still checked after the fetch. A generative start with llama-server placement flags resolves its overrides after device discovery, so its levers,--leversincluded, are read there.Also in this change:
--ctx-sizewith--parallelfor at least one position per slot,-ubfor its range in the Qwen3.8 and decide seats, draft, feed, steps and residency combinations (GLM and the tiered seats sharetiered::check_residency_feed), a missing model source, an explicit tier larger than the card, and--parallelabove one on the seats whose body holds one sequence (Nemotron, Raon1, Muse Spark).--mmprojwith--no-mmproj, image token limits on a build without vision or with no projector to bound, and zero or inverted limits are refused in one place,vision_seat::Flags. Limits with a repository that can supply the projector are accepted.--headand--head-configare checked against the seat word indecide::check_head, whichpickalso calls.--aliasvalue that spells a switch (--levers,--list-devices,--version,--cpu_moe) is read as a value. Every launcher scan reads values throughllama_launch::serve_option. The qwen3 and decide seats do not take--alias, anddocs/serving.mdsays so.--api-key-fileand--chat-template-fileare read once per path at start, throughserve::flag::file_snapshot, so a pipe such as/dev/stdinserves after the early check has parsed the flags.docs/serving.mdsays so.Release notes: Fixed:
bloomery-serverefuses a bad flag, value or lever, and answers--helpand--levers, before it asks the driver or downloads the model.Code shape
bind::check_seatwith its ownparse_args; there is no second parser. The placement view the launcher builds isllama_launch::seat_view, whichLauncher::placeduses too. Source words go throughhf::source, head checks throughdecide::check_head, image limits throughvision_seat::Flags. The refusal of a draft width without a draft has one owner,bind::refuse_plain_width, which every seat calls, and so has the refusal of--parallelabove one on a body that holds one sequence,SeatFlags::one_sequence.checkthat calls their existing parser, and their model-specific refusals stay in their own files. No common owner gained a per-model branch.pickcarried moved intodecide::check_head, the image-flag refusals intovision_seat::Flags, and the GLM and tiered steps and residency refusals intotiered::check_residency_feed. Nothing this change made unused is left.cargo fmtandcargo clippyare clean on what I touched:cargo clippy --workspace --all-targetswith the GPU,visionand model features reports no warning in a file this change touches.Duplication found or removed (
path:line), or "none": the head-flag refusal inpickand the image-flag refusals in the seat parsers now live incrates/serve/src/decide.rs(check_head) andcrates/gpu-gates/src/vision_seat.rs(Flags). GLM's and the tiered seats' steps and residency refusals are one function,crates/gpu-gates/src/bin/shared/serve_seats/tiered.rs(check_residency_feed). The sixteen candidates the duplicate scan reported are the seats'checkentries, which callbind::check_seatwith their own parser, or refusals that differ by model.What I ran
Everything below ran on a DGX Spark (see Hardware). The change touches no device code and no decode or prefill path, and no speed claim is made.
The recipe runs the
bloomery-serveandbloomery-serve-ds41unit tests and the newtests/serve_preflight.rson builds without and with thevisionfeature (the two result lines above). The test file starts the binary with an empty model cache and checks that each refusal comes with the argument error and no driver or download output. I added bothserve_preflightruns to that recipe, and added the two hardware caseshw_preflight_normal_inputs_reach_the_fetchandhw_a_device_list_alias_reaches_the_selected_seat(both#[ignore], they need a CUDA 13 driver) to the GLM serve-start recipe. Both pass on the DGX Spark:FAIL-first: with the
early(...)call inbloomery_serve.rsdisabled, so the start reaches the driver check and the fetch before the arguments are read as before this change, the same test file fails:The refusals are named errors on stderr that say which flag, value or lever was refused, so no separate probe or state record is added. To reproduce the ordering, start a seat with an empty model cache:
just contrib-check --tier t0:Not run:
Hardware
DGX Spark,
nvidia-smiquery: NVIDIA GB10, 595.84, CUDA 13.3 (nvccrelease 13.3).AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.