Repository navigation
runtime::width: a slow start no longer fixes the width chooser's costs - #1095
Conversation
The chooser's first readings of every width come from the rotation at the start, and the first requests after a server start can run slower than the rest: on a DGX Spark, a start whose first two requests ran slow (prompt 2.14 and 2.00 s against 1.53 to 1.65 after) read every width's cost 16 to 22 % high (costs=[38.48,47.10,57.08,66.64] against [33.18,39.34,47.50,54.78] in a start that was not slow). The held width reads every pass and recovered within the next request, but a width the gate does not hold reads once a probe, three probe periods apart, and its median kept the start's readings for about 950 passes: widths 0 to 2 kept them for the whole run, and the next eight requests' windows verified 1 or 2 ids in 3 passes against 30 in the run whose start was not slow. Each width's median as the rotation left it is now kept until the width's median rests on readings taken since, most of its ring. One that does and has left the close band around the rotation's starts the rotation over: every width is read again, its own median too. The check runs once and ends without a restart once no median rests on the first rotation's readings. A start that was not slow keeps its costs; a restart costs min_timings passes of each width, once. A cost that moves for another reason before the check ends, a longer context for one, restarts the rotation the same way; that is intended, since the rotation's readings no longer price the widths either. a_slow_start_is_read_again_once_it_ends: every wall 6/5 over the rotation and the 74 passes after it, then 1; every cost is its wall 21 passes after the slow passes end, for a draft and a chain draft (951 before). A start at 1 and passes at 6/5 after it leave the band the other way and take the same 21 passes.
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix defect found in the recalibration state transitions.
Non-blocking
⚠ Validate decode timing: crates/runtime/src/width.rs:1453 restarts all widths when startup timing drift is detected. With full proposals, this adds one rotation of min_timings × (D::WIDTH + 1) calibration passes [derived]. Attach the dispatch path's same-lease just ab-decode comparison and just gate-runtime output for the reviewed commits. The supplied mock-clock test logs cite different commits.
Checked
Duplicates: 4 new items checked; no duplicate owner found. Dryer reported 0 pairs.
Complexity: Choosing::land rose 20 → 21 through the warm-up snapshot branch; no separate correctness defect found.
Silent failure: 2 new state/median guards followed; unavailable medians cannot decide the gate during refilling.
Tests: static mutation check: removing self.settle(k) at line 1298 leaves probe-only refresh, which the new 21-pass bound guards against. Both drift directions and both draft types are asserted.
Gates: no existing pin, threshold or test changed; FAIL-first output is supplied for the new regression.
Escape catalog: no pattern matched.
Notes
Static review; tests were not rerun. The PR contains no just gate-* run output, so GPU evidence is false.
🔨 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. |
MTP 폭 선택기가 서버 시작 직후 느린 구간에서 읽은 비용을 실행 끝까지 들고 가던 결함을 고쳤습니다.
What and why
The width chooser (
runtime::width::Choosing) starts by reading every width's cost in a rotation, and those readings stay in each width's ring of recent costs. The first passes after a start can run slower than the rest. A width the gate does not hold is read only once per probe, so its median kept the slow start's readings for about 950 passes.The chooser now keeps each width's median as the rotation left it. Once a width's median rests mostly on readings taken after the rotation and has left the
margin_closeband around the rotation's value, the rotation runs again, with every width started over as a probe does. The check runs once. All drafting seats shareChoosing, so the fix applies to each of them. The change touches onlycrates/runtime/src/width.rsand adds no per-model or per-device code.Release notes: Fixed: the MTP width chooser no longer keeps the costs it read during a slow server start.
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).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
Upstream base
b8a8dcc4de75239bcca63563fdc7931c8750f336, PR head679e181bcb190bdd70dc83ea5faad07d671c87a3.Card and driver of the machine the tests ran on:
Before the fix. The new test
a_slow_start_is_read_again_once_it_endscounts the passes after a slow start until every width's cost equals its wall time, for a draft and a chain draft. Run against the unfixed chooser, it fails:After the fix. On the PR head, the whole runtime library suite passes, including the new test:
The new test also covers a start that is faster than the passes after it (the median leaves the band the other way), and it passes with a draft and with a chain draft.
Hardware (if the change is for a machine)
NVIDIA GB10, driver 595.84, CUDA 13.3. The change is host-side logic in
crates/runtime; the tests above ran on this machine.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.