Repository navigation
perf(lanes): a stream count whose rounds run over twice the table gets its plain price in its first rounds - #4993
Draft
AbrahamCete wants to merge 2 commits into
Draft
AbrahamCete wants to merge 2 commits into
AbrahamCete wants to merge 2 commits into
Conversation
A count's row price is fitted from its drafted point, and outside fixed blocks that point never expired. Once plain wins, no drafted round comes to correct the fit, so a high row price stays: at 131K on gfx1151 a count's row price stuck at 21 ms against the 16.7 ms its rounds measure, and the count stopped drafting. `price` now ignores a drafted point that no drafted round refreshed for `stale` rounds, as `blockPrice` already does, and `observeHead` replaces such a point instead of blending onto it, for every kind. The `block` parameter it no longer needs is dropped. Two tests that required zero drafted rounds after plain wins now allow at most one re-probe a `stale` window; tokens stay exact against the plain-only oracle. Refs ashhart#3939
…trials next A stream count's plain price comes from all-plain trials: the first on its round 64, dropped as a warm-up, and the kept one on round 128. Until then the allocator prices drafted rows by the load-time table. At long context a row also walks its stream's cache, which the table does not hold: on gfx1151 with Qwen3.6-35B-A3B at 32K to 131K, rounds of 4 to 32 rows take 1.9 to 6.6 times the table's forward, and four streams run at 0.54 to 0.86 of `"draft": false` until the price lands (ashhart#3939). `observeTable` marks a count that has no plain price when one of its rounds takes at least `over_table` (2) times its load-time forward, head steps excluded. A marked count takes its warm-up and its kept trial in its next two rounds, then waits as before. A count whose rounds stay under twice the table keeps the trials on rounds 64 and 128. A selected trial that never completes leaves the count on the `every` spacing. Two tests used fakes whose drafted rows cost 3 and 24 times the table, where the trials now come in the first rounds: - shared_price_test's "cheaper plain wins" case at 9 ms a row now expects the warm-up and kept trial on rounds 3 and 4; its 0.5 ms case keeps rounds 64 and 128. - lone_copy_price_test's shared-rounds pin: the two-stream count is priced within its first rounds, and its copy rows drop from 1,644 to 372. drafted_chances_test passes unchanged. Refs ashhart#3939
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
A stream count's plain price came from trials on its rounds 64 and 128, and until then shared rounds drafted by the load-time table. At long context a drafted row also walks its stream's cache, which the table does not hold, so those rounds ran at 0.63 to 0.87 of
"draft": false. Now a count with no plain price whose round takes at least twice its load-time forward takes its warm-up and kept trial in its next two rounds. Counts that stay under twice the table keep rounds 64 and 128, and a drafted point no drafted round refreshed forstalerounds stops pricing rows."draft": falseuntil the plain price lands (the early-price follow-up of #2687) #3939. This is the conditional shape you suggested there, with your three conditions:price()now ignores a drafted point no drafted round refreshed forstalerounds, asblockPrice()does, andobserveHeadreplaces such a point instead of blending onto it (3ad32188e). Theblockparameter it no longer needs is dropped.drafted_chances_testpasses as it stands, at 1, 4 and 8 streams.atc overlap --json(ATC 0.9.6, 2026-11-25 05:06Z, base 3795e60): no conflicts; one overlap, MiMo-V2.6-Flash on CUDA (2x GB10) with DFlash as the drafter #728, merges clean. The run reports itself incomplete (limits on pull requests, their files and time).Two existing tests changed their expected values, because their fakes run drafted rows over twice the table, which is the case this changes:
shared_price_test"cheaper plain wins": at 9 ms a row against a 10 ms table, the trials now follow the first drafted round (rounds 3 and 4) instead of 64 and 128. Its 0.5 ms case keeps 64 and 128.lone_copy_price_test"shared rounds' copies stay as on main": at 40 ms a row against a ~5.4 ms table, the two-stream count is priced in its first rounds, and its copy rows drop from 1,644 to 372, for both head settings.Checks on this head
shared_price.zig,depth.zig,shared_round.zig,windows.zig,allocate.zigorhip_lanes.zig.python3 tools/pr_check.py --base 3795e6054: 0 errors, 1 advisory warning ("pass --pr NUMBER to check its Unreleased line"; the changelog line is yours).zig testonzig/src/core/lanes/lanes.zig): 519 passed, 1 skipped, 0 failed. The three new tests failed first against an emptyobserveTable(no price at round 3), then passed.zig build test-lane-api-host test-lane-lone-host test-lane-invariance-host test-glm-window-prices-host test-qwen27-shared-allocation-host test-qwen35-shared-host test-qwen35-rules-host test-qwen35-rounds-host test-cuda-host: each passed.zig build test test-golden: 4,377 of 4,428 passed, 50 skipped, 1 failed:fabric/tp/stage_hip_test"every staged call on HIP memory equals the reference, whole and in parts", which fails the same way on main 3795e60 on this machine (zig build test-tp), so it is inherited.zig fmt --check build.zig zigandgit diff --check: clean.Receipt
Your HIP: sampled chat at 4 streams on Qwen3.6-35B-A3B is 6% faster with --mtp-drafts 0, because the depth rule underprices sampled drafted rounds #2605 cell (Qwen3.6-35B-A3B, default drafts against
--mtp-drafts 0, 1 and 4 streams, greedy and sampled, chat and code, 256 tokens): 34 runs, all 24 metrics within noise. The sampled code cell at four streams with drafts: steady 187.12 against 186.38 tok/s (0.996, noise floor 1.10%). At this size the four-stream trials stay at rounds 64 and 128 on both builds.lanes: at long context a stream count's first 128 shared rounds draft by load-time prices; on gfx1151 four streams run at 0.54-0.86x of
"draft": falseuntil the plain price lands (the early-price follow-up of #2687) #3939's long-context cells (Qwen3.6-35B-A3B, four streams, greedy, two mirrored rounds a size). First drafted batch, steady tok/s, base runs against head runs:From 32,768 up the head's four-stream trials are rounds 2 and 3 and it is priced from round 4; the base's are on round 64, priced from 61 to 75.
"draft": falsebatches are level at every size (batch 1 steady 45.41 against 45.49 at 131,072). The second drafted batch is level, since main has its price by then. A drafts-only server gives 1.21 and 1.25 in its first two batches at 32,768, and 1.48, 1.48 and 1.08 in its first three at 65,536, then level.Your lanes: shared rounds price the drafter's fixed work once, not on every verification row #3755 case (Qwen3.8-27B with its DFlash2 drafter, 8 streams, chat and code, greedy and sampled): six of seven metrics within noise. Greedy code read SLOWER in that run (aggregate 0.985, floor 0.57%), so I ran it alone over 33 mirrored rounds (134 runs): aggregate 62.05 against 62.28 and steady 65.21 against 65.46 tok/s (1.004), within noise. Servers of either build land in one of two states (steady about 65 or 67.5 tok/s, the faster with more drafted rows a round): the base in 5 of 67 runs, the head in 11 of 67 (Fisher p = 0.18). Within each state the builds are level (1.0003 normal, 1.0012 fast). The change does not engage in this cell: on every server of both builds the 8-stream count's trials are on rounds 64 and 128 and it is priced from 129.
"draft": falsehere, not ahead (first drafted batch against draft false, aggregate: 0.995 at 32,768, 0.96 at 65,536, 0.98 at 131,072, where main gives 0.87, 0.72 and 0.63). Getting ahead is a separate question: a replay of the allocator on these price logs points at copy windows priced at a fixed 0.94 landing chance on HIP Qwen.plain_guard, on every backend; I ran gfx1151 only.zig/src/core/lanes, called fromdepth.zig'sobserveSharedPricefor everyplain_guardengine; HIP run, CUDA and Metal not run.hip_parityIDENTICAL on 13 of 13 long-context rounds (24 of 24 requests each), 96 of 96 keys in the 27B cell, and 24 of 24 over its 33-round rerun. Same-build repeats give one hash per key, and different prompts give different hashes.tools/bench_concurrent.py(the HIP: sampled chat at 4 streams on Qwen3.6-35B-A3B is 6% faster with --mtp-drafts 0, because the depth rule underprices sampled drafted rounds #2605 and 27B cells) and the issue's long-context script;tools/bench_openai.pywas not run, since one stream is the case this cannot reach (the lone stream reads within noise in the HIP: sampled chat at 4 streams on Qwen3.6-35B-A3B is 6% faster with --mtp-drafts 0, because the depth rule underprices sampled drafted rounds #2605 and long-context cells).Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. On the device I checked default drafts against--mtp-drafts 0(equal on all 60 keys of the HIP: sampled chat at 4 streams on Qwen3.6-35B-A3B is 6% faster with --mtp-drafts 0, because the depth rule underprices sampled drafted rounds #2605 cell) and head against base everywhere; resumed against fresh and concurrent against solo only through the host suites above.--drafter, no slower than without it, greedy and sampled. No slower than main at one and four streams (35B-A3B) and with the drafter at eight (27B); drafter against no drafter not measured.