Repository navigation
serve, app, gates: a drafted pass whose pick reads only a row's best logits takes each verified row from the card's best read - #1067
Conversation
…alue read from its verified row by the request's own pick
…through the kept ids it picks from their verified rows
…with each row's first NaN, in place of the whole rows The warp tournament takes its list length as a parameter, and the selector head's top-k launches take their lists by it in place of warp_top16. A retired entry now drops its id too, so a warp with fewer finite entries than the list ends it with -inf slots that name no id twice.
…logits takes each verified row from the card's best read
There was a problem hiding this comment.
Verdict: CLEAN: No reachable behavior failure or proven quality defect survived review.
Non-blocking
⚠ Complete the performance evidence: crates/gpu/src/model.rs:1549 adds two launches per row read under PerRow, versus two per pass under One [derived].
The launch-count/geometry class needs the owning gates and timed A/B evidence. Attach the runner commands and output for the current head, including the PerRow path; the supplied Qwen3.8 table names an earlier head. This establishes a reproducible baseline now.
⚠ Show FAIL-first for the new gate: crates/gpu/src/best.rs:549 has green output but no failing run in the PR body.
Plant a wrong-id or reversed-tie mutant in warp_best, show the list assertion fail, then restore it and show green. This confirms the regression guard before later kernel changes.
Optimization headroom
- E. Less work: crates/gpu/src/best.rs:482 copies all eight output rows even when only
mwere written. Limit the existing readback to the valid prefix:516 × (8 − m)fewer bytes per read; atm=1, 3,612 fewer bytes per row read onPerRow[derived].
Checked
Duplicates: 75 new named declarations searched; no proven duplicate. Both dryer pairs read: the builders set different facts. The selector reuses the shared tournament.
Complexity: pass_best is new at 16, combining validation, scratch initialization and layout-specific readback. pass_slots and Gen::pump each grow by two through existing state decisions; no defect established.
Silent failure: six sites followed through their consumers; unsupported best reads use full rows, and invalid rows or picks reach named errors.
Tests: static mutation analysis only. crates/gpu/src/best.rs:125 retirement removal breaks list equality; crates/app/src/lib.rs:424 reset removal breaks stale-row equality; crates/gpu-gates/src/bin/shared/serve_seats/drafted.rs:77 changing <= to < breaks the boundary assertion; crates/serve/src/sampling.rs:118 removing zero equality breaks the zero test.
Tests: crates/serve/src/genloop.rs:2282 bypassing the pick breaks drafted walk/schema and probability assertions; crates/serve/src/engine.rs:1328 dropping the penalty-window allowance breaks best/plain sampling equivalence; crates/serve/src/genloop.rs:2273 disabling asking passes breaks the asking-pass count assertions.
Gates: no tolerance moved; the unsafe ratchet increase has a dated PIN and reason. New spill entries retain zero allowances.
Escape catalog: C1–C4 match no changed executable code. Boundary sizes, NaN propagation, mixed full/best reads and held-program handoff checked.
Notes
Gates were not rerun. The PR supplies a hardware table but no nvidia-smi output; GPU evidence is recorded as false.
Card check: needs-gpu. This pull request changes crates/app/src/lib.rs, crates/app/src/mtp.rs, crates/gpu-gates/src/bin/shared/serve_seats/drafted.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. |
확률이나 structured output을 요청한 요청도 MTP draft pass를 타게 하고, 샘플링 pass는 행마다 카드에서 읽은 best 64개 logit만 받게 합니다.
What and why
A request that asks for probabilities, or for structured output (
json_schema,json_object, a forced tool call), stepped one token at a time even when the MTP draft was on. Both now ride the draft pass. The request's own pick (sampler, bias, program walk, probability collector) is lent to the pass, and each kept row feeds it exactly once, so ids and probability values match the one-token path. A program's walk moves only through kept ids, so nothing needs rolling back.A sampled pass also read every verified row in full (248,320 f32 logits, 993,280 B per row for Qwen3.8). When the request's pick reads only each row's best logits (
top_kup to 64, a penalty that only lowers, a bias that only lowers, greedy), the card now returns 64 best logits and ids per row plus the row's first NaN, 516 B per row, in two launches (crates/gpu/src/best.rs). The pass hands the sampler a row with everything outside those 64 set to-inf. Requests that need the whole row (probabilities,top_k0, a penalty or bias that can raise a logit) still read it.The best read and the drafting live in the shared owners:
GpuModel(both head layouts), the slots round,serveand the common seat code. Model files only pass the best-read count through.Release notes: Added: requests that ask for probabilities or structured output now use the MTP draft pass, and sampled MTP passes read each row's 64 best logits from the card instead of the whole row.
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):crates/gpu/src/dspark/selector.rscarried its own top-16 warp tournament (warp_top16). It is removed; the selector's three calls now usewarp_best<PER, K>incrates/gpu/src/best.rs, which takes the list length as a parameter. The selector hardware tests pass on the shared version (below).What I ran
All runs used the repository's own gate and check commands on an NVIDIA GB10 and an RTX 5090. The card and driver lines are in Hardware.
Kernel test on GB10 and RTX 5090. The card's best lists equal the host's lists bit for bit (V = 248,320 x 8 rows, 151,936 x 5 rows, a short vocab, NaN rows, equal values, +-0, +-inf):
PTX spill gate. The two new kernels,
best_partandbest_merge, spill nothing, and every pinned entry passes:Selector and best-read tests on GB10, after the selector moved onto the shared tournament:
Real server on GB10.
bloomery-servebuilt in release with the release feature set, Qwen3.8-Flash-Next-FP4-Local, MTP draft on by default:The requests go to
/completionwithtemperature0.7,top_k20 and a fixed seed (b, c); a request that asks for probabilities (d); and ajson_schemarequest (e). The pairs are(drafted tokens, accepted). Each request gives the same ids and probability values alone and next to another slot. Check c adds a+1e-30bias so the same request reads the whole row, and the ids equal the best-read ids. The asking request returned 96 tokens, 64 of them accepted from draft passes. The schema request returned{"name": "user", "year": 2024, "kind": "book", "ok": true, "note": "ok"}with 6 of 9 drafted tokens accepted.Two-slot decode, base against head on GB10, same model,
fp4l-mtp-c2sarm (two slots, temperature 0.7, seed 42,top_kunset so the default 40 takes the best-read path), a warm-up and then 3 rounds each. Base is27533de28, head is3be1cbff:Prefill and TTFT p95 are within 0.4% on both prompts. The change makes no speed claim; this shows no decode regression on the path it touches.
Clippy on the touched crates, no warning in a changed file:
Hardware (if the change is for a machine)
AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.