Repository navigation
XPU Qwen3.8-27B: a lone DFlash2 stream draws its tree's width from the lane rule's lone pricing - #3052
XPU Qwen3.8-27B: a lone DFlash2 stream draws its tree's width from the lane rule's lone pricing#3052Mirrdhyn wants to merge 27 commits into
Conversation
|
Thanks @Mirrdhyn. This is what #2897 asked for: the lone tree's width now comes from We also checked who else the core change reaches. Before it can land
|
|
Measurements for items 1, 3 and 4, and where item 1 stands. Nothing is pushed yet. I don't have a fix for item 1 (details below), and the 34-token figure in the changelog waits on it. The rest does not: the rebase after #3051 (the All runs: one Arc Pro B70, this branch's parent Item 1: the 34-token cellGreedy, 5 fresh servers a side, 4 timed requests each after one warmup.
The receipt's −3.6 % (136.14 against 141.23) is the same card at
So I don't have a rule that meets #2897's bar yet. Forcing 15 removes the served loss at 34 tokens, and 15 sits on that plateau (0.4 % under the derived best), but it is far from the best at 7,588, and nothing is measured between those two depths. Sampled, the simulation puts the rule above the cap at 34 tokens (161.7 against 159.2, best fixed 160.2 at 14 nodes) while the served item 3 cell is 0.991, so a cutoff would need its own sampled cells too. Would you review a cutoff in Item 3: sampledTemperature 1.0,
Item 4: requests the lone driver refuses, and more streamsThe lone driver refuses
At both batch sizes each request's hash equals the parent's and equals the same request sent alone. |
|
Thanks @Mirrdhyn. The new runs isolate the overhead, add sampled and engine-round coverage, and keep the hashes equal. The short-prompt gate is still open. These items remain:
|
|
@ashhart, where this stands, and why I'm holding the width tuning. Profiling the verify round at 58,543 tokens (details on #2543): of the 205 ms of profiled GPU time in a 16-row round (15 drafted nodes plus the pending token), 146 ms is The short-prompt gate does not depend on those kernels. Local changes, not pushed, bring the 34-token cell to 0.999 of main timed and 1.005 on the first request; 7,588 tokens is still under the best fixed tree (0.958 timed, 0.906 on the first request). Unless you prefer otherwise, I'll do the non-kernel items from your 14 Nov list now, and finish item 1 once #2595 is in, measured on top of it. For that item I'd also change the approach: our forced-width rounds fit A + B·L + (c + k·L)·R with a 0.7 ms mean absolute error on the averages (2.7 ms at the worst point), which is enough to price widths without trials at long context; on the flat short-prompt band 1 ms is several nodes, so that gate keeps its own check. |
|
Thanks @Mirrdhyn, that plan works for us. Please go ahead with items 2 to 5 now; item 4 still waits on #3051. Item 1 can follow #2595 and be measured on top of it. For item 1, pricing widths from the fitted cost model is fine at long context. The gate itself stays measured: the 34-token and 7,588-token cells against the best fixed tree, timed and on the first request, at or above it in both. The 7,588-token cell is still under (0.958 timed, 0.906 on the first request), so it needs to close too, not only the short prompt.
|
|
@ashhart, items 2, 3, 5 and 7 are in, one commit each on top of
Lean stays at 386 and The branch still conflicts with main, as |
|
Thanks @Mirrdhyn. The four commits cover items 2, 3, 5 and 7 as we asked. With one calibration table per clock, and Two items don't wait on #3051 or #2595:
Item 1 stays as agreed: after #2595, the 34-token and 7,588-token cells at or above the best fixed tree, timed and on the first request of a fresh server, with equal hashes. For the rebase after #3051, one note on
|
|
On The logprob prerequisite (#3051) is now on main through #3722 ( Igor Lessio - AIFLOW LABS |
695278b to
25015ad
Compare
|
Rebased onto main Item 4
Two changes you have not reviewed yet
Checks
No GPU cell was rerun for the rebase. Items 6 and 1 still need the B70. |
|
Item 6, measured on card 0 (PCIe 5.0 x16), with two changes it led to. Token hashes are equal in every cell, side against side and server against server. What item 6 found. The six cells (tool call with The two changes, pushed as two commits on top of
Engine cells, main (M) against the new head (G), five servers a side alternating, median decode tok/s:
Lone-driver cells (greedy,
Still open: the first request of a fresh server at 34 tokens is below main in every variant (G 0.937, H 0.959, three samples each): it pays the width trials. The ~8K wins of the engine-round pricing are given up with change 2; I would rather keep the engine rounds at main than ship the short-reply losses. Change 1 sits in Checks on the new head: |
…ce in the scatter patch
…ne and file a stream's samples when it changes clock
…ine and the XPU backend
…hs, not by one timing
957e383 to
a2ed926
Compare
|
Hello, Main has changed how a stream served alone is priced. It no longer keeps separate copy-pricing tables for a lone stream, so that part of your change could not be carried over. What does carry over is the tree width: a lone stream is still marked as lone, its own measured round times still price the width, and a width is still fitted from a line over the sampled widths. Shared rounds and engine rounds keep main's pricing, unchanged. The numbers in your receipt were measured on an older base and with a local, uncommitted VRAM-guard patch. They no longer describe this rebased result. Please re-measure on current main: the widths chosen at 34, 28,946, 58,543 and 121,022 prompt tokens, the exact reply tokens at each width (greedy and seeded), and decode tokens per second against the fixed 15, 7 and 3 node trees. Then tell us whether the shortfall at 34 tokens and the gains at long prompts still hold.
|
|
The trial merge of I switched those fixture lookups to zig build test-shared-lane-regressions-host test-draft-xpu-host \
test-qwen27-config-xpu-host test-qwen27-prompt-tail-xpu-host \
-Dcpu=apple_m1 -j4 --summary allAll three XPU host targets pass with the fixture edit. The remaining failures need a decision about the intended width and recovery policy before adjusting those assertions. This check used host fixtures. Igor Lessio - AIFLOW LABS |
… engine keeps main's per-width pricing
… next request starts priced
…the retain fix, no local patch
|
Re-measured on current main ( A fix first. On the rebased head, the lone stream lost its calibration at the end of every request. Two more commits on the branch:
Numbers. Decode tok/s, the median of 3 requests after a warm-up, with a fresh server for each pass. Main runs the fixed
The spread between the 3 requests is under 1 % in main's cells and up to 5 % in the head's. Second passes of main's 3 and 15 reproduce them within 0.1 %. So, on current main:
The first request of each context band is still cold, as designed (48.3 tok/s at 28,946 and 24.3 at 121,022). The receipt in |
# Conflicts: # CHANGELOG.md
|
Merged main ( |
# Conflicts: # zig/src/core/lanes/lone_costs.zig
|
Merged main ( |
|
Thanks @Mirrdhyn for restoring calibration retention, narrowing the fitted-line change, and publishing the raw request records. The fresh first-request acceptance cells are still open. The receipt's first 34-token request is 121.457 tok/s with adaptive widths versus 127.125 tok/s with the fixed 15-node tree, about 4.5% slower, although their token hashes match. The warmed median does not answer the separate first-request criterion. The receipt also has no 7,588-token request. Please adjust the cold-probing policy so the first request meets the agreed bar, or call out the cold-start tradeoff explicitly for a decision. Then provide 34-token and 7,588-token results against the fixed 15/7/3-node trees, with at least three fresh alternating servers per side and no preceding warm-up. Equal token hashes and adaptive speed at or above the best fixed tree are still the acceptance criteria. The current merged head needs a fresh run too.
|
|
Cold first request, as asked: fresh servers, the first request measured with no warm-up, three servers per arm in alternating order (ABCD/DCBA/ABCD), against the fixed 15-, 7- and 3-node trees. The 34- and 7,588-token prompts are joined by 28,946 and 121,022. Everything ran on one B70 (card 0). The head is Policy change: a band with no retained calibration now draws a fixed prior through its first request, with no probes:
Those rounds are retained, and the next request probes and adapts as before. A
Median tok/s of three fresh servers. Each prompt gives one Where it falls short: the bar is "at or above the best fixed tree", and the adaptive median sits 0.1 to 0.5 % below it at every depth. With identical trees, that gap is the lone path's per-round work: choosing the width, measuring and pricing the round. I have not isolated it. At 28,946 it is outside the spread between servers (50.08-50.09 against 50.31-50.33). Why the prior: without it, the first request probed widths 1, 5, 9 and 13 one round each. At depth those rounds are expensive. The first series in the receipt, run on Limits: the prior values (15/7/3) and the edges (2,048/8,192) come from this card and these four depths. Where the 7-node tree stops beating the 3-node tree, somewhere between 8,192 and 28,946, is not measured. Host tests on the head: |
|
Thanks @Mirrdhyn. The fresh-server series answers the missing 7,588-token and cold-start measurements, and the measured runtime matches this head. The prior now keeps the first request at the best fixed width, with equal token hashes. The remaining gate is throughput: all four medians are still below the best fixed tree. At 28,946 tokens, 50.08–50.09 versus 50.31–50.33 tok/s has no overlap in the reported runs. Please isolate and remove that remaining overhead, or leave the documented tradeoff for an explicit maintainer decision. The 2,048/8,192 boundaries and mixed prompt lengths within one calibration band also need coverage before generalizing the prior. The shared pricing and retention fixes remain intact.
|
Refs #2897.
A stream served alone with the DFlash2 drafter (
--parallel 1) went throughLaneHost.lonetoXpuLanes.alone, whichverified a fixed 15-node tree every round. At long context 16 verified rows each read the whole context, so a smaller
tree is faster with the same tokens (#2897). This takes that choice through
lone_costs, as CUDA's lone round does:alonegrows the tree tocap = min(XPU_TREE, 15)on the host (drafter_tree.grow: lattice, noise, best-firsttree, now also each draft's own log-chance), prices it with
lone_costs.choose(prices,allocateDrafts, thenprobe/trial), the one copy of the sequence thatwindows.zigalso calls for an engine lone window, exceptleast_rows2 wherewindows.ziguses 0, and verifies only the first w drafts (settle). A tree of w nodes is thefirst w pops of the 15-node tree and a child pops after its parent, so the prefix keeps every parent and the accepted
path is the wide path cut at w.
Landing.chance(sampled, own) x parent, ascuda_draft.zigdoes (xpu_dflash2.chances), updatedwith
observeTreeon the verified prefix. They are not on the Drafter vtable:Draftedreadsvtable.chancesonly whenfacts.chancesortree_nodes > 0, and XPU sets neither.stream's
depth.msthroughRule.observeCost, thenlone_costs.observe(dflash2.measured). The first round(prefill-to-decode switch) and the first round after a cold drafter-context restart in
resumeLoneare not samples.Engine.lone_keptwhen its lone loop ends, at the end or at the hand-over to theengine (
dflash2.retain, deferred inXpuLanes.alone), andseedstarts the next stream of the band from it.XPU_TREEis a cap. Below 2 nodes the width is fixed and nothing is learned (as before).lone_cost_tile = 4; probes every 4 rows from row 2 (1, 5, 9, 13, 15 drafts).What the core lacked, and what this extends (small, and CUDA's behaviour is unchanged):
Rule.costswrote the stream's own table only underplain_guard. XPU leavesplain_guardfalse so that a sharedround is not held at 0 drafts. A
Who.lonemark (set bylone_costs.marked) now makesRule.costsuse thestream's own table for a lone round priced by
lone_costs, which XPU's lone driver does (xpu_dflash2.zig).lone_costs.enabledstill requiresplain_guard, as on main, so engine rounds keep main's pricing on every backendand shared rounds do not change.
probestarted at 1 row, i.e. a draft-less window. Withoutplain_guardno round is drafted with nothing, so itstarts at 2 rows (CUDA's schedule with
plain_guard, tile 16, is unchanged:lone_costs_test.zigstill passes).lanes.lone_costsis exported so a native backend can call it.priceOfprices every width from a least-squares line over the sampled widths' excess on the startup model oncethree widths are sampled; with fewer it copies the nearest sample, as before. One round's timing varies by more than
an extra draft row costs, so a single sample no longer prices a whole group of widths. Only the lone XPU tree asks
for the line (
line = trueinxpu_dflash2.width); the engine's lone window passesfalseand keepsestimate'sper-width pricing, so main's shared-lane tests are unchanged.
windows.allocatecallslone_costs.choosefor a lone window; the shared rounds' counts moved unchanged into asharedCountshelper, to stay within the line budget.Engine rounds: an engine round of a single live stream (a hand-over from the driver, or a request the lone driver
refuses through
lane_host_lone.takes) is priced as on main and writes no lone table. An earlier head of this PRdropped
plain_guardfromenabledand priced those rounds too; item 6 in the discussion shows what that won and lost,and why it was put back.
Exactness: the width only sets how many drafts are verified; the walk keeps the target's own pick (greedy ties to the
lower id, sampled picks keyed by
(seed, position, id)).Measured on one Arc Pro B70 (PCIe 5.0 x16), main
7fb9fc661and the headc36b7391e(the head's binary differs fromthat tree by the wording of one doc comment), with no local patch:
zig/src/xpu/rt.zigis main's in both binaries.Receipt:
docs/receipts/xpu-qwen27-lone-tree-width, with every request. The sametoken_sha256in each cell acrossmain's fixed trees of 15, 7 and 3 nodes and the head (greedy 34 to 121,022 tokens, and seeded at 34 and 121,022). Decode
tok/s, the median of 3 requests after a warm-up, a fresh server for each pass; main with
XPU_TREE15 / 7 / 3, the headwith no
XPU_TREE:The spread between the 3 requests is 0.1 % or less in main's cells and 2 to 5 % in the head's. Repeat passes of main's 3
and 15 reproduce the first by 0.1 % or less.
the head is +0.3 %, +1.9 % and +7.2 % over it at 28,946, 58,543 and 121,022 tokens, and 1.46, 1.74 and 2.22 times
main's default of 15 nodes.
24.3 at 121,022, against 53.0 and 29.5 afterwards), since the band's prices are not sampled yet; the next request of
the band starts from the calibration the previous one filed.
Tests:
zig build test-shared-lane-regressions-hostpasses 449 with 1 skip andzig build test-draft-xpu-hostpasses 21on the head. New host tests: the width follows the band's measured rounds;
XPU_TREEcaps; a w-node tree is the prefixof the 15-node one and the tokens are equal at widths 1 to 15, greedy and seeded; the lone test files its calibration
through
dflash2.retain, as the driver does; with enough widths sampled one noisy timing does not move its neighbours'prices; lone pricing without
plain_guard. The host tests drivewidth/measureddirectly: none callsXpuLanes.alone, so the loop's wiring is covered by the device runs and the tables above only. The receipt's devicetests and kernel contract were not rerun on this head; no kernel file changed.