Repository navigation
lanes: shared rounds price plain overhead apart from drafted rows (refs #2605) - #2687
Conversation
|
/atc depends 2777 |
|
This lands after #2777, which lets a learned row cost fall below the table. When I rebase this onto main,
|
|
@ashhart the gfx1151 run of #2605's cell on Aggregate tok/s, both runs of each arm:
So on this GPU the head is level with main inside the run spread (main's own two runs differ by up to 5.6%), and the issue's cell does not close: sampled chat at 4 streams is still faster without drafts, by 4.0% on the head. On main today the same gap is 2.0%, and it was 6.0% when the issue was opened. What the rounds did in the sampled 4-stream window (rounds of four streams, code and chat together, by how long they took; here a plain round takes 24.2 ms, an 8-row round about 38.5 ms and a 16-row round about 59 ms):
The head runs a plain round now and then (11 and 6 of about 710) and settles on drafting in both runs, with a third or more of the round time in the 16-row rounds. Main's two runs settle differently from each other, one mostly on plain and 16-row rounds and the other on 8-row rounds, and land on the same tok/s. With two runs an arm I'd read ±3% as spread. Only D against N on sampled chat at 4 streams has both runs of one arm below both of the other. I can repeat this on the rebased head once #2777 is in, and attach the lane traces, serve logs and summaries if they help. |
|
Thanks @AbrahamCete, this is the run that decides it, and the round histograms are exactly what we needed. Our reading:
Yes please to the lane traces, D1, D2 and N1 if you still have them. The rule's priced round time against the measured one, and each stream's acceptance estimate next to its real accepted count, will show which of the two is off. The serve logs help too. Nothing else is needed from you for now. This waits on #2777, which lets a learned row cost move off the table's value. Once that's on main we'll rebase, correct whichever side the traces point to, and ask you for one more run of this same cell.
|
|
@ashhart the traces and logs: https://gist.github.com/AbrahamCete/ca9edeeb15f6b479ff06d4ea94a620ab
One limit before you read them: the trace holds what ran, not what the rule expected. Its lines are The measured side for the sampled 4-stream window, from the
So chat on the head accepts 0.59 to 0.60 of what it drafts, right at the break-even you worked out, and gains 1.65 to 1.69 tokens a stream-round. For the priced side I can run the cell once more on a build that prints, at each decision, the rule's price for the plain and the drafted options and each stream's acceptance estimate. If you'd rather choose what gets printed, push a debug commit or name the values in |
|
@AbrahamCete thank you, these lined up cleanly. With the windows file, each rep's The traces point at the price, and at its plain side. This head prices a plain round from its own trial rounds. The first comes at a stream count's 64th round, then another whenever the price is 256 rounds old, and each moves the price a fifth of the way. At four sampled streams your first trial landed in the code half and took 28.6 ms (D1) and 29.4 ms (D2). N's plain code rounds at that point took about 24.2 ms. It was the server's first all-plain four-row round, so a one-off cost fits. The later trials, in chat, took 21.8 to 25.0 ms. At a fifth per trial, though, the plain price averaged about 27.0 ms (D1) and 28.1 ms (D2) through chat, against the 23.3 ms N measures. The drafted side looks right. A round in the 8-row bucket took 38.1 ms in both runs, and the rule's price for it should come out within a few percent of that. That part assumes the load-time table matches the token-per-row timings you posted on #2605, and I can't check that from the trace. So the line moved. At 38.1 against 23.3 ms, one draft per stream pays above about 0.63 acceptance. Against the plain price the rule held, it pays above 0.35 to 0.41. Your chat drafts land at 0.59 to 0.60, below the real line and well above the one the rule saw. Acceptance is off only at the start of each request. 97 of the 99 sixteen-row rounds in chat fall in a request's first 30 rounds. Each new stream starts from the default estimates (0.85, 0.75, 0.70) and takes a couple of dozen rounds to come down to about 0.6. That's 16 to 18% of chat's four-stream time, a smaller cost than the plain price. #2777 doesn't change this, since Qwen3.6 on HIP doesn't learn row costs. The fix we have in mind is small. A stream count's first plain trial becomes a warm-up, and each later trial replaces the stale price instead of moving it a fifth. Only how many drafts a round asks for changes, and replies stay the same. When it's up, one more run of this cell (M, D and N at 1 and 4 streams, greedy and sampled) would settle it. And yes please to printing the priced side. We'll push a commit that prints, for each shared round, the trial flag, the rows and draft depths, the rule's plain and per-row prices, and each stream's acceptance estimates, plus the load-time cost table and head step at start. That will check the drafted-side figures above, which I could only infer.
|
|
@AbrahamCete the fix from your traces is on this branch (
Could you rerun #2605's cell on this head when your GPU is free? That's M, D and N as before, at 1 and 4 streams, greedy and sampled, with
|
|
@ashhart the rerun of #2605's cell on Short version: tokens are equal in every cell and the head is level with main. By
Why the two disagree. Without drafts the four streams make a token a round each and all end on the same round. With drafts they drift apart, and the batch's makespan is its slowest stream's. Sampled chat at four streams, when each request of a rep got its last token (seconds after the batch's first):
So with drafts the first two requests finish 0.4 to 0.9 s sooner than without, the third about level, and the fourth 0.2 to 0.5 s later. What the price log shows (the logged D run, four sampled streams, 746 priced rounds):
Which number should decide the cell is your call. If it is The summaries, the per-prompt acceptance table and the price log are here: https://gist.github.com/AbrahamCete/ba0f7b52e29d02e96c78a8a7e31fe6bb |
|
@AbrahamCete thanks, that settles it. In a batch whose requests all start together, By that measure, sampled chat at four streams is 1.0% ahead of The price log also points at the next win: the rounds before the first price (the first 128, three deep at 59.7 ms) and streams that never get a price in a short window. Pricing within the first few rounds would help short requests. That's a follow-up if you want it, not a condition here.
|
|
Thanks. I'll take the early-price follow-up once #2828's PR is up: a price within the first few rounds, and one for the stream counts that only show up at the end of a batch. I'll open an issue for it then and claim it there, unless you'd rather open it yourselves. |
ef572a5 to
84dcf66
Compare
|
Rebased onto main
|
84dcf66 to
1677522
Compare
#2687 made Engine.askDrafts public so shared_round.zig could call it, and proposal_batch_host.zig refuses a public askDrafts at compile time (draft internals must stay private). The engine now passes its private draft call to shared_round.run instead.
A stream count's first all-plain trial pays one-off costs, and blending each later trial a fifth of the way kept that slow sample in the plain price for hundreds of rounds, so near-even drafts kept drafting. The first trial is now a warm-up whose sample is dropped (the existing allocator stays in charge until the next trial, `every` rounds on), and each later trial replaces the plain point. Natural plain rounds still blend as before; `due` is unchanged.
Off unless TF_SHARED_PRICE_LOG=1. A common-scope environment.zig row refuses any other text by name when a server starts, and the lane core reads it through the same parser at an engine's first priced shared round, which then logs the load-time shared forward costs and head steps. Each priced shared round after that logs one line: its trial flag, rows, time, the forward's table time, each stream's verified drafts and next depth, the plain and row prices the depths were chosen by, and each stream's acceptance estimates. Nothing it logs feeds back into a decision.
Keep the measured plain intercept while the row learner owns its signed slope. Exercise both prices, the plain-width floor and all three measuring allocators. Refs #2605.
#2687 made Engine.askDrafts public so shared_round.zig could call it, and proposal_batch_host.zig refuses a public askDrafts at compile time (draft internals must stay private). The engine now passes its private draft call to shared_round.run instead.
1cdcb03 to
36b7827
Compare
#2687 made Engine.askDrafts public so shared_round.zig could call it, and proposal_batch_host.zig refuses a public askDrafts at compile time (draft internals must stay private). The engine now passes its private draft call to shared_round.run instead.
What this changes
The lane core's depth rule prices a shared round (several streams in one forward) from one fitted overhead. A plain round (no drafts) and a drafted round paid the same overhead, so on hosts where drafted rows cost more per row than plain ones, sampled drafted rounds were underpriced. #2605 shows the result on HIP: sampled chat at 4 streams on Qwen3.6-35B-A3B was 6% faster with
--mtp-drafts 0.Shared rounds now measure plain overhead on its own, refresh it with bounded plain rounds, and fit row costs from both plain and drafted widths. Until a plain observation exists, the rule keeps main's depth choices and timing. Verify widths no longer pay twice for held drafts. Families that set a separate shared head price (GLM,
shared_step_ms) keep it on the new paths.Only how many drafts a round asks for changes. Every reply's tokens are unchanged, since acceptance never depends on the price.
Checks
zig build test-lane-api-hostpasses on this head.zig fmt --check, the lean check (no new problems), and files at most 600 lines.Needs
The gain is expected on HIP, where #2605 was measured, and we have no HIP machine. @AbrahamCete, could you run #2605's cell on this head: sampled chat at 4 streams, drafts on against
--mtp-drafts 0and against main? That decides it.Refs #2605.