Repository navigation
serve: /metrics splits decode rounds by width, the engine's waits by phase and the draft's counts by depth - #1007
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: The new metrics test accepts removal of two required metric families.
Must fix
1. Assert that both round-time families exist
crates/serve/src/api.rs:10943.
Kind B: the test never reads round_seconds_total; its PLE all() assertion accepts no rows. Removing either family from labelled_metrics leaves this test green. Pin both required families while adding the metrics contract so later deletions cannot pass this test.
Insert before the PLE assertion:
assert_eq!(rows("round_seconds_total").len(), rounds.len(), "one round-time row per width: {m}");
assert_eq!(rows("round_ple_wait_seconds_total").len(), rounds.len(), "one PLE-wait row per width: {m}");Non-blocking
⚠ Attach the move-class proof: crates/serve/src/worker.rs:1081.
call_round extracts decode dispatch. AGENTS' move/split/rename class requires identical covering PTX scans; the body supplies gates but no scan comparison.
Attach just narrow fb43427d12d4ad05b11327ad5be8611ebaed2f2c faf091f029b47bc4bb9f885ee9e105b9effbb74b output to establish that proof before merge.
Checked
Duplicates: 43 new definitions checked; no duplicated owner found. The one dryer pair, Waits::add_assign and Depth::add_assign, adds different quantities.
Complexity: crapper reports Worker::call_round at 22. This extracts the existing dispatch branches from step; it adds no dispatch decisions.
Silent failure: 3 new candidates followed. An absent optional draft kind yields the explicit unknown label; both test parse failures reach named panics.
Tests, static mutation review: crates/serve/src/engine.rs:647,651 changed to saturation loses the required panic; crates/serve/src/genloop.rs:284 changed from < to <= breaks the exact depth counts; removing label escaping at crates/serve/src/api.rs:2951 breaks the API test. Removing the additions at crates/gpu/src/watchdog.rs:235 and crates/gpu/src/arch/qwen3moe/body38.rs:746 breaks their wait assertions in isolation. Missing-family mutants pass as described above.
Gates: no existing pin, threshold or test clause was removed or relaxed.
Escape catalog: no C1–C4 pattern matched.
Hot paths: decode/prefill instrumentation adds one atomic add per recorded wait and one extra stats lock per worker-loop iteration; no launch, transfer or reduction-order change.
Adversarial checks: zero-width rounds return before indexing; zero drafts preserve both totals; cache-only actions publish waits before replying. No unsafe block was added.
Notes
Rust tests and GPU gates were not rerun locally. Review used source inspection and the supplied diagnostics.
GPU evidence is incomplete for this head: the body names 4069f68e, while the reviewed head is faf091f0; the build/model commands also contain placeholders.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bind.rs, crates/gpu/src/arch/qwen3moe/body38.rs, crates/gpu/src/host/mod.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)
…phase and the draft's counts by depth /metrics gains labelled counters. rounds_total, round_seconds_total, round_card_wait_seconds_total and round_ple_wait_seconds_total carry a width label, the slots one decode round stepped or passed: a round's wall time on the engine thread, the part the engine waited for the card's work and the part it waited for PLE table rows, the rest being host time. card_wait_seconds_total and ple_wait_seconds_total count the same waits over every call. spec_decode_num_draft_tokens_by_depth_total and spec_decode_num_accepted_tokens_by_depth_total count a drafted pass's ids by depth under the drafter's kind (source); they sum to the existing draft totals and are booked when a request ends, as those are. The engine reports its waits through Engine::waits (zero by default). The CUDA engine counts each finished wait of a guarded engine call as card wait, and each wait of a Qwen3.8 fill for PLE table rows read off the NVMe tier as PLE wait; the server reads the totals around each round and counts from its own start.
faf091f to
7b7f61d
Compare
There was a problem hiding this comment.
Since the last review:
- Must-fix 1: fixed. The test now requires rows for both metric families at crates/serve/src/api.rs:10943.
- PTX proof request: still open at crates/serve/src/worker.rs:1081.
Verdict: CLEAN: The added assertions close the reported test gap; the interdiff introduces no new defect.
Non-blocking
⚠ Attach the move-class proof: crates/serve/src/worker.rs:1081.
AGENTS requires identical covering PTX scans for the dispatch extraction. The body supplies no comparison.
Attach just narrow fb43427d12d4ad05b11327ad5be8611ebaed2f2c 7b7f61dd0873ccd7e9967fb0d1c8432bcd67ab47 output to verify this before merge.
Checked
Duplicates: 0 new definitions in the interdiff. The dryer pair was read: Waits::add_assign and Depth::add_assign aggregate different quantities.
Complexity: crapper flags Worker::call_round at 22, an extraction of existing dispatch branches. The interdiff changes no dispatch decisions.
Silent failure: 0 new sites; both additions fail explicitly on a missing metric family.
Tests, static mutation review: deleting the family at crates/serve/src/api.rs:2980 or :2992 fails the corresponding new assertion. The positive width-2 round assertion prevents zero-row comparisons from passing. Both comparisons use the same captured scrape.
Gates: two assertions added; no gate relaxed or pin moved.
Escape catalog: no C1–C4 pattern matched.
Notes
Rust tests and GPU gates were not rerun locally; validation was static.
GPU evidence remains incomplete: the body names head 4069f68e, provides no literal nvidia-smi output, and leaves build/model placeholders.
Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bind.rs, crates/gpu/src/arch/qwen3moe/body38.rs, crates/gpu/src/host/mod.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. |
서버 /metrics가 decode round를 동시 slot 수별로 나누고, 엔진이 card와 PLE를 기다린 시간과 draft의 depth별 제안과 수락 수를 함께 내도록 했습니다.
What and why
/metricsshowed one decode total, so a reader could not tell how long a round took at each batch width, how much of that time the engine spent waiting for the card or for PLE rows from NVMe, or at which depth a drafter's ids were accepted. This change adds those counters:rounds_total,round_seconds_total,round_card_wait_seconds_totalandround_ple_wait_seconds_total, each labelled bywidth(the slots one round stepped or passed).card_wait_seconds_totalandple_wait_seconds_total, the same waits over every engine call.spec_decode_num_draft_tokens_by_depth_totalandspec_decode_num_accepted_tokens_by_depth_total, labelled bysource(the drafter kind from/props) anddepth. They sum to the existing draft and accepted totals.The
sourcelabel is escaped for the Prometheus text format. A wait total that goes down is a named panic instead of a silent zero.docs/serving.mddescribes the new rows.Release notes: Added:
/metricssplits decode rounds by batch width and reports card and PLE wait time and per-depth draft proposals and acceptances.Code shape
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).PIN(YYYY-MM-DD):and its reason.
cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed (
path:line), or "none": none.What I ran
Base
fb43427d12d4ad05b11327ad5be8611ebaed2f2c(upstream/main), head4069f68eaaa88d8e2604de702f0100895065e75f.Serve gate set (the commands behind
gate-serve: thebloomery-servelib and its ten integration targets), every target0 failed:The two tests that cover this change, run on the head. Each of the three mutations below fails its test first, then the restored code passes:
GPU gate clauses for the two engine wait counters, in the GPU lib build on the card (
BLOOMERY_BOX_LOCAL=1):Real server on the card. Build and start
bloomery-serve, then send one sampled request alone and two sampled requests at once (n_predict128, temperature 0.7):The drafter is MTP (
slots=2 ctx=8448 cache=q8_0). The seven checks on the scrape all pass (CARDRUN PASS):The wait counters are not a speed change and no throughput number is claimed.
Hardware (if the change is for a machine)
NVIDIA GB10 (DGX Spark), driver 595.84, CUDA 13.3.1.
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.