Repository navigation
gpu, qwen38, qwen3: the KV cache's unset format is one rule (gpu::kv_format), f16 for a GGUF file and a checkpoint folder alike, and the load names what chose it - #1119
Conversation
…format), f16 for a GGUF file and a checkpoint folder alike, and the load names what chose it
There was a problem hiding this comment.
Verdict: CLEAN: No reachable behavior failure or proven quality defect remains in the changed code.
Non-blocking
⚠ Cover the checkpoint default: crates/gpu-gates/src/bin/gate_qwen38_serve.rs:1059.
The supplied runs use GGUF, and this gate opens the model through Split. Restoring the seat's old folder-only q8_0 default leaves these checks green. Extend the existing coverage to a checkpoint folder and show that mutant failing. This protects the only default that changes.
⚠ Attach the cited timing evidence: docs/serving.md:232.
The docs claim slower q8_0 prefill and no decode gain, but the body supplies functional gates only. Attach the same-lease A/B commands and output, including prompt lengths and decode depths, and PTX equality for the move. This makes the default's performance rationale reviewable.
Checked
Duplicates: 10 added or moved definitions checked; both dryer pairs read. Their enum-to-word matches describe different domains.
Complexity: props_engine 50→56, served 66→70, placement 21→22. Growth adds sequential record checks and error propagation, with no new model-specific branch.
Silent failure: invalid cache words return GpuError::Shape; choose defaults only when both the flag and lever are unset.
Tests, static mutation check: changing kv_format.rs:104 to Q8, reversing precedence at :88, or changing provenance makes the common-rule assertions fail. Removing the preflight validation at serve_seats/qwen38.rs:1632 makes the q4 refusal test fail. The folder-only default mutant survives the supplied coverage, as noted above.
Gates: replacement default cases and the changed Qwen3 clause carry dated PIN reasons; no numeric band or tolerance moved. FAIL-first output is absent from the body.
Escape catalog: no C1–C4 pattern matched. No ledger lessons are in force.
Notes
Static review. GPU gates were not rerun locally; the body includes card gate commands and output.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/src/bin/bloomery_serve_qwen38.rs, crates/gpu-gates/src/bin/gate_clef_hidden.rs, crates/gpu-gates/src/bin/gate_gemma_embedding2_serve.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. |
KV cache 형식을 정하지 않았을 때의 기본값을 한 곳(
gpu::kv_format)의 규칙으로 모으고, GGUF 파일과 checkpoint 폴더 모두 f16이 되게 했으며, load 기록에 그 선택의 출처를 남깁니다.What and why
The Qwen seats chose an unset KV cache format in three places. The qwen38 seat ran q8_0 for a checkpoint folder and f16 for a GGUF file, the qwen3 seat had its own f16 default, and two gate binaries repeated the choice. This PR moves the choice into one owner,
crates/gpu/src/kv_format.rs.KvChoice::choosereads--cache-type-k, thenBLOOMERY_QWEN3_KV, and otherwise picks f16. The container the weights come from is not an input. All four callers (serve_seats/qwen38.rs,serve_seats/qwen3.rs,generate_qwen3moe.rs,gate_qwen4exp_nvfp4.rs) read that rule.The qwen38
setuprecord and the qwen3loadrecord gaincache_from=flag|lever|default, so a log says what chose the format. The checked-in record schema is updated.One default changes: a checkpoint folder of Qwen3.8 (FP4-Local, NVFP4) that ran q8_0 when the format was unset now runs f16. A GGUF file already ran f16 and does not change.
--cache-type-k q8_0still selects q8_0.Release notes: Changed: an unset KV cache format is f16 for every Qwen model whichever file format it loads from, so a checkpoint folder of Qwen3.8 now defaults to f16 instead of q8_0, and the load record names what chose the format.
Code shape
The review reads these first. A box left unticked needs one line of why.
copying it (
AGENTS.md"Common code first",docs/rust-quality.mdR14). Where I found an existing copy, Inamed it below.
(tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
tools/check-comments.sh).cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": the container ruleKvQ8::of(folder.is_some())incrates/gpu-gates/src/bin/shared/serve_seats/qwen38.rs, the separate f16 default incrates/gpu-gates/src/bin/shared/serve_seats/qwen3.rs,KvQ8::chooseincrates/gpu/src/arch/qwen3moe/body.rsandKvQ8::of(path.is_dir())incrates/gpu-gates/src/bin/gate_qwen4exp_nvfp4.rsare replaced byKvChoice::chooseincrates/gpu/src/kv_format.rs.KvQ8moved there frombody.rs.What I ran
The upstream base is
3e31152774d8fe13ec2b97699913a3e0488e1509and the PR head isb3798f236fbef5219ed53a81cd33d38a1a6f454c.Card and driver on the GB10 (raw output):
Card and driver on the RTX 5090 (raw output):
Models and SHA-256 of each file. Qwen3.8 UD-Q4_K_XL,
unsloth/Qwen3.8-Flash-Next-GGUF, revision766911a6b7369840a91dbcd95f9f997acaab6cd6, fileUD-Q4_K_XL/Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf:Qwen3-30B-A3B,
unsloth/Qwen3-30B-A3B-Instruct-2507-GGUF, revisioneea7b2be5805a5f151f8847ede8e5f9a9284bf77:Qwen3.6-35B-A3B,
lmstudio-community/Qwen3.6-35B-A3B-GGUF, revision68a34855558af61cbef0324d31f411be8a506b08:The gate on the RTX 5090 below also loads
Qwen3.8-27B-Q4_K_M.gguf.Gates
On the GB10, the common rule's unit test and the record and host-rule tests for the changed code, on the PR head:
cargo test -p bloomery-gpu-gates --lib record:: just gate-q38-serve-rulesOn the GB10,
gate_qwen38_serveruns the realbloomery-serve-qwen38on UD-Q4_K_XL and checks the server'ssetupcache against the rule:BLOOMERY_MODEL=qwen4exp ./tools/box.sh 'export BLOOMERY_GATE_V41_LOAD=1 && . tools/ref/ref-paths.sh && A=$(bash tools/arch.sh) && cargo oxide build --arch $A -- -p bloomery-gpu-gates --features deepseek41,gemma-embedding2,hf --release --bin bloomery-serve-qwen38 --bin gate_qwen38_serve && cargo oxide build --arch $A -- -p bloomery-gpu-gates --features gpu --release --bin generate_qwen3moe && D=target/q38-serve-gate-kv && mkdir -p $D && T="The capital of France is" && I=$REF_TOKENS && bash tools/gpu-gate.sh generate_qwen3moe --place gate --tokens "$I" -n 16 > $D/gen.log && for arm in drafted lookup; do bash tools/gpu-gate.sh gate_qwen38_serve --arm $arm --gen $D/gen.log --prompt "$T" --ids "$I" --dir $D/$arm; done'On the RTX 5090,
gate_qwen3_serveruns the realbloomery-serveon Qwen3-30B-A3B, Qwen3.6-35B-A3B and Qwen3.8-27B and checks each load record's cache against the rule:BLOOMERY_MODEL=qwen3moe ./tools/box.sh 'A=$(bash tools/arch.sh) && cargo oxide build --arch $A -- -p bloomery-gpu-gates --features glm5next,clef,mimo2,solar2,minimaxm3,flint,vision,gemma-embedding2,hf,checkpoint --release --bin bloomery-serve --bin gate_qwen3_serve && cargo oxide build --arch $A -- -p bloomery-gpu-gates --features gpu --release --bin generate_qwen3moe && D=target/qwen3-serve-gate-kv && mkdir -p $D && BLOOMERY_GATE_CARD=any bash tools/gpu-gate.sh gate_qwen3_serve --model "${MODEL_Q3}" --model "${MODEL_Q36}" --model "${MODEL_Q38_27B}" --dir $D'The clippy ratchet on the PR head (
cargo clippy --workspace --all-targetswith the workspace feature set):Hardware (if the change is for a machine)
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.