Repository navigation
serve: send plain steps before the round's drafted passes - #731
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: No behavior or proven quality defect remains in the changed code.
Non-blocking
⚠ Refresh the gate evidence: crates/serve/tests/slots/mod.rs:1177 adds a second regression test, but the PR's run logs name head 81b4d9a, not the reviewed head 1d2c67f.
Run bash tools/gate.sh -p bloomery-serve --lib --test serve -- --include-ignored --nocapture on this head and attach the output.
Also attach FAIL-first evidence for the reasoning-round test. This verifies the final ordering guard before merge.
⚠ Supply the dispatch timing comparison: crates/serve/src/worker.rs:881 adds a pump traversal in each mixed round, and line 891 adds a scan visiting at most N active entries per round, where N is the active request count.
Engine calls and result-buffer counts stay unchanged. This is a host dispatch reorder; AGENTS.md's dispatch rule asks for a same-lease A/B.
Attach a base/head comparison that exercises mixed plain and drafted requests, so the host work before drafted calls is measured.
Checked
Duplicates: 3 new functions/methods checked; no duplicated owner. Dryer reported 0 pairs.
Complexity: crapper flagged Worker::step, 26 → 30; branches added to an existing function for early delivery and result handling. Pending calls reuse Active.need.
Silent failure: 2 engine-result guards followed to die; errors remain visible to running requests.
Tests: static mutation check—dropping worker.rs:881 fails the first delivery assertion; admitting newly eligible advances at worker.rs:889 fails the second test's call-order assertions.
Gates: two ignored hw_ tests added; no pins, thresholds or existing cases moved.
Adversarial checks: removal of a finishing plain request preserves advance mapping; saved Fill needs survive pumping; resumed reasoning waits until the next round; stop skips the pending advances; draft errors reach the remaining requests.
Performance: decode dispatch; the additional traversals are quantified above. Engine calls and result-buffer counts remain unchanged.
Escape catalog: C1–C4 do not match.
Notes
Static review only; tests were not executed here. The PR carries no qualifying GPU evidence.
🔨 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. |
여러 요청이 함께 돌 때, 일반 step을 마친 요청의 토큰과 최종 응답이 다른 요청의 draft 호출을 기다리지 않고 바로 클라이언트에 전달되도록 고치는 수정입니다.
Part of #565. Tracked in #699.
What and why
When a round mixes plain steps with drafted advances, a plain request's new token did not reach its client until every drafted advance of the round had finished. A plain request that finished in that step had its final frame held for the same time. The plain slot's answer was already computed, so the wait was pure delay for that client.
Worker::runbuilt the step rows and the advance rows together, called the engine for the steps, then for the drafted rows, and only after both calls applied the results (Gen::stepped,Gen::advanced) and pumped them out. This order came in with 3c5a133. Nothing in the drafted advance depends on the step's delivery, so the order was not needed.This PR applies and delivers the step results right after the step call, and then calls the drafted advances:
Gen::steppedand the existingpump_readybefore the advance call. A pendingAdvanceis kept in the request's existingActive.need, so the next call a Fill saved withhold_needis untouched.If a drafted request errors after a plain request has already sent its final frame, that final frame stays sent. The requests still running end through the existing fatal path.
No public type, function signature, GPU code, kernel, launch or checkpoint policy changes. The change is in the request loop, above any rank split, so the rank count is not involved.
Release notes: Fixed: a plain request in a round that also drafts gets its token and final response without waiting for the other slots' drafted advances.
Code shape
Worker::steppath aroundpump_ready; it adds no helper. The new test reusesDraftGated,EntryLog,read_streamandstart_n.Result,.ok()or fallback. Engine call errors still go to the existingdiepath.cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.cargo fmt --check -p bloomery-serveis clean. Clippy has not been run on this head.Duplication found or removed (
path:line), or "none": none; the duplicate scan found no candidate.What I ran
Hardware: a Linux host without a GPU. The new test and the serve tests use the in-process
DraftMockengine (4,096 positions), so no model file and no GPU are involved. The change does not touch GPU code, so there is nonvidia-smioutput to show.FAIL-first: the new test
hw_plain_steps_reach_clients_before_drafted_passes(crates/serve/tests/slots/mod.rs) against the baseworker.rs, with the new test file kept:On the base, at
N = 2, finish = false, the plain request's token waited behind the held draft advance, which is the delivery assertion the test makes.With the fix, the serve library and integration tests, including ignored ones:
The new test covers four cases: two and four slots, each with a plain request that continues and one that finishes. Half the requests are plain and half draft. The draft advance is held once every prompt has entered the round. A continuing plain request must report its new
predicted_n, and a finishing one must send its final stream frame, before the advance is released. After the release, every request's final tokens and its joined stream content must equal those of the same request run alone on a fresh server.Both runs were on the same head and base: head
81b4d9a397ea62ab43293dc546cfadc0d60c44f9one14cd4643fcd210fb55c33e1c1984ae9af9be4dc.On the Mac:
cargo fmt --check -p bloomery-serveandgit diff --check upstream/main...HEADreturned 0, and the working tree was clean.Not run:
just gate-*recipes beyond the serve gate above, clippy, and the other static checks.Reproduction
To see the base behaviour, run the first command with
crates/serve/src/worker.rstaken from the base commit.What I ran into
This does not block the PR.
Workeralready deliver before the next slot's call: the start and the last prompt call pump before the next slot call, and a Fill saves its next call withhold_needafter each call. The single-slot and turns paths deliver after one call. Those paths needed no change.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.