Repository navigation
XPU Qwen27 DFlash2 through the core Drafter and Drafted (#2460 item 5) - #2672
Conversation
|
@jschmied thanks, and thanks @Mirrdhyn for the B70 runs: tokens equal to main at greedy and seeded, 4 streams equal to solo, and the conformance set passing. The move reads faithfully:
We'll write the CHANGELOG line. |
|
Happy to take the device cells on the B70 once the head carries your follow-ups. Point taken on |
|
@ashhart thanks for the review. Four commits on top, no rebase:
The twin test and its four planted faults are unchanged: green as committed, red when planted. CI set 654/654 on the Spark and 641/641 on x86, @Mirrdhyn thanks for taking the cells. The follow-ups are all on
|
|
Device cells on the head Equality. Every request gives one
Accepted drafts per round. One stream: identical on main and head, 528 accepted over 149 rounds greedy and 520 over 145 sampled (3.54 and 3.59 a round). Four streams sharing rounds: head 2.34 greedy / 2.37 sampled against main 2.30 / 2.23 (head 471 of 1,043 over 201 rounds and 466 of 1,047 over 197; main 469 of 1,091 over 204 and 458 of 1,008 over 205); p3 on four seeds, 2.32 against 2.30. Shared-round counts move a little between runs of one binary (the same mixed cell replayed on main proposed 351 then 353 drafts for p3), so I read this as no loss of acceptance on the head rather than a measured gain. Resumed against fresh ( Structured output. No difference anywhere. Speed was not measured in this pass. |
|
@Mirrdhyn thank you, that covers every cell ashhart asked for on |
|
@jschmied thanks: the four refusals each have an |
draftFn kept &q of a by-value loop capture, so every stream of a shared round read the last request's sampling and position for its tree noise. Iterate by pointer. Drafts only; the target's verify keeps tokens exact. The draft-sources host test now references the lane backend, so its operations compile on hosts without Level Zero.
…item 5) native/xpu_dflash2.zig puts the private xpu/drafter.zig Drafter behind core/lanes/drafter.zig's VTable (as minimax_m3/dflash2.zig does), with the chain/tree switch (TREE_MIN) moved unchanged. lanes.drafted.Drafted now sits in front of the XPU lane target, which no longer drafts: it hands Drafted the taps through features (the last verify's window) and prefill_features (each prompt chunk as it runs). main's drafter arithmetic is kept: the prompt's last row is absorbed with its chunk when the target says the chunk holds it (the drafter's projections switch kernels at 16 rows), and a round's kept rows go in one batched absorb in request order. The round facts are main's (Drafted.facts with the target's own shared-row rule). The lone driver still drives the drafter itself; a stream it hands back to the lane core is registered with Drafted.adopt (new, core). Host test: a recorded script through main's private path (ported) and through Drafted + the adapter makes the same drafter calls, rows, tree noise and drafts; the facts through Drafted equal the target's own.
… DraftNotAttached FeaturesGone and DraftNotAttached run on the real lane target (another slot's prompt tail, a depth > 0 request); the gap and held-fewer refusals through Drafted on the recorded host.
A missing stream is opened, a present one reset without a second open, and the next draft absorbs and holds (a prompt restored whole holds instead of fillers).
…fted reads the prompt's last row Lanes.draft_step_ms (0.6) is used by both facts; the round-facts test already compares them deep. The first draft's features(last, 1) is kept: the drafter holds that row only when it shared a chunk, and core Drafted cannot ask.
A depth-3 request also passed with the check moved to depth > 1.
3ddfac5 to
463413f
Compare
|
Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
xpu_dflash2_depth_test.zig runs lanes.drafter_depth_sweep on the XPU DFlash2 adapter from ashhart#2672 over its recorded drafter, with main's private drafting path (the Private copy in xpu_dflash2_test.zig) on a second drafter as the reference: depths 1..7 and a zig-zag run, prompts 6, 40 and 2100 (rows past WIN skipped), greedy and sampled. Chain depths (below TREE_MIN) and tree depths both meet it; trees are not a deeper chain's prefix, so the reference is the family's own path, not a deeper twin. The sweep's holds now carry the stream's sampling as Drafted's do; without it the sampled XPU trees were drawn greedy and differed from the reference at depth 5. Only wiring is in the XPU test: the fixture stays in core. Co-authored-by: EugeneClaw <[email protected]>
|
Thanks @jschmied! This is in TensorFold 1.2.6, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.6
|
xpu_dflash2_depth_test.zig runs lanes.drafter_depth_sweep on the XPU DFlash2 adapter from ashhart#2672 over its recorded drafter, with main's private drafting path (the Private copy in xpu_dflash2_test.zig) on a second drafter as the reference: depths 1..7 and a zig-zag run, prompts 6, 40 and 2100 (rows past WIN skipped), greedy and sampled. Chain depths (below TREE_MIN) and tree depths both meet it; trees are not a deeper chain's prefix, so the reference is the family's own path, not a deeper twin. The sweep's holds now carry the stream's sampling as Drafted's do; without it the sampled XPU trees were drawn greedy and differed from the reference at depth 5. Only wiring is in the XPU test: the fixture stays in core. Co-authored-by: EugeneClaw <[email protected]>
xpu_dflash2_depth_test.zig runs lanes.drafter_depth_sweep on the XPU DFlash2 adapter from #2672 over its recorded drafter, with main's private drafting path (the Private copy in xpu_dflash2_test.zig) on a second drafter as the reference: depths 1..7 and a zig-zag run, prompts 6, 40 and 2100 (rows past WIN skipped), greedy and sampled. Chain depths (below TREE_MIN) and tree depths both meet it; trees are not a deeper chain's prefix, so the reference is the family's own path, not a deeper twin. The sweep's holds now carry the stream's sampling as Drafted's do; without it the sampled XPU trees were drawn greedy and differed from the reference at depth 5. Only wiring is in the XPU test: the fixture stays in core. Co-authored-by: EugeneClaw <[email protected]>
What this changes
This is the first drafting block of #2460 item 5 (P2 in the survey). On main, the XPU Qwen3.8-27B lane target drafts on
its own.
native/xpu_lanes.zigcalls the privatexpu/drafter.zigDrafter from itsdraft,keepandtree. Prompttaps are pushed into the drafter by a runner callback. The chain/tree switch (
TREE_MIN) also lives in the target.After this PR:
native/xpu_dflash2.zigputs that drafter behindcore/lanes/drafter.zig's VTable, asminimax_m3/dflash2.zigdoes. It covers taps, facts, open, absorb, hold, held, release and tree. The chain/tree switch moves here, unchanged.
lanes.drafted.Draftedsits in front of the lane target. The target no longer drafts. Instead, it hands Drafted thetaps through
features(the last verify's window) andprefill_features(each prompt chunk as it runs).Drafted.facts, with the target's own shared-row rule kept(
allocate_shared_draftsfalse, as on main).Two places keep main's arithmetic, and so main's drafts:
absorbs it with the first token. The adapter instead takes it with its chunk when the target says the chunk holds it,
because the drafter's projections switch kernels at 16 rows, so a separate 1-row pass would round differently.
draftFn.The lone driver (
Lanes.lone, DFlash2 trees for a single stream) still drives the drafter directly. When it hands astream back to the lane core, it registers the stream with Drafted through a new
Drafted.adopt, which is 8 lines incore.
A separate first commit fixes a bug: main's
draftFnstored&qof a by-value loop capture. Every stream in a sharedround therefore keyed its tree noise with the last request's sampling and position, and a greedy last request left
sampled streams without noise. The loop now iterates by pointer. This changes drafts only, since verification keeps
tokens exact.
Checks
draft sources: XPU DFlash2 through Drafted makes main's drafter calls, rows and drafts. It runs a recordedscript through main's private path (ported as it was, against a recording fake drafter) and through Drafted plus the
adapter. The script covers 3 prompts: one longer than the window, so rows are skipped; one whose last row sits inside
its last chunk; one whose last row is alone in its chunk. It then runs a shared round (drafts before keep: a tree path,
an absorb-only stream, a whole window), a lone round (keep before draft, a chain), and an all-kept round with a
sampled and a greedy stream. Every drafter call (skip, addTaps, absorbMulti rows, lattice blocks, take, tree noise
bits), the held drafts and the context ends must be equal.
expectEqualSlicesmismatch, not atcompile time: the last prompt row absorbed alone dropped (
tail), the chain/tree switch moved by one (treemin;849e24a0eadds a round of exactlyTREE_MINdrafts for it), tree noise keyed one position off (noise), a kepttree path absorbed as a prefix (
rows).zig build test test-goldenplus the CI set on849e24a0e: 654/654 steps, 8205 passed, 66 skipped. Commit 1 alone passes thehost tests too.
tools/pr_check.py: 0 errors (one advisory: no--prnumber yet). Lean 116 vs 116, 0 new. fmtand
git diff --checkare clean.xpu-nativefor bmg (ocloc + nGEN) builds on main and on this branch.test-draft-xpu-hostpasses 4/4 onthis branch (main 2/2), including both new Drafted tests. The tgllp build with
-Dxpu-dpas=falsebuilds as well.ba21da223against006820408(
849e24a0eafter it adds only a host-test round). Setup:Qwen3.8-27B GPTQ 4/128 with
z-lab/Qwen3.8-27B-DFlash2, 4 prompts, 256 tokens, greedy and T=0.8 with seed 7.Equality means the reply's
tensorfold.token_sha256matches.--no-drafts: 8/8. Main == branch, drafted: 8/8. 4 at once == one at a time: 8/8 on each arm.263.1 / 259.7 / 255.1 / 255.2. Within noise.
DraftContextGap,FeaturesGone,BadDraftPosition,NotDraftingorDraftNotAttachedin the branch'slogs.
tools/conformance.pywith an XPU profile gives the same result on both binaries: drafted ==plain 10/10, repeat 10/10, concurrent == solo 44/44, refusals 4/4, and resumed 6/6 with a 600-item chat.
Not in this PR
Backend.draft, and the lanes Engine accepts(
native/xpu_lane.zigdraftFn →draftKept/draftFirst).nemotron/xpu_mtp.zig runSpec, with its own acceptcounter, is used only by the device test
zig/tests/xpu/nem_mtp.zig. Moving tolanes.mtp_policywould change thedepth rule, so it is not a move.