Repository navigation
qwen27 metal dflash2: opt-in batched drafter absorb across streams - #4629
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/q27-absorb-batch
branch
from
November 22, 2026 15:57
63cb170 to
c2ffaf3
Compare
Open
1 task done
ashhart
force-pushed
the
lead/q27-absorb-batch
branch
from
November 22, 2026 18:44
c2ffaf3 to
839daee
Compare
This was referenced Nov 22, 2026
A shared round absorbed each stream's new taps in its own pass, so N streams read the absorb weights N times. TF_Q27_DFLASH_ABSORB_BATCH=1 (default off) stacks up to 128 rows from 2 or more streams into one pass. Each row keeps its own position and each stream's keys and values go to its own caches. A larger round, a lone stream and other families sharing this drafter keep the per-stream absorb. Host cells compare the caches byte for byte at 1, 2 and 4 streams with uneven rows and planted NaN and Inf.
ashhart
force-pushed
the
lead/q27-absorb-batch
branch
from
November 22, 2026 21:56
839daee to
7d83d49
Compare
4 tasks done
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
On Metal, a shared Qwen3.8-27B DFlash2 round already shares one drafter frame, but each stream still runs its own absorb pass, re-reading the drafter's
fc, hidden norm and every layer's K/V projections per stream.TF_Q27_DFLASH_ABSORB_BATCH=1(default off) absorbs up to 128 rows from 2 to 8 streams in one pass, so those weights are read once a round. The second commit passes "no stacked absorb" from the GLM Metal caller of the sharedabsorbBlocks.Exactness
Absorb fills the drafter's own cache; each stream's rows keep their arithmetic and order, and the target verifies every row as before, so replies stay token-equal to main. With the switch off nothing changes.
Measured
Two M3 Ultras, Qwen3.8-27B MLX 4-bit with its DFlash2 drafter, base = this branch with the switch off, new = on, aggregate tok/s:
A small, steady gain at 2 streams; at 4 streams 7 of 8 cells gain, and the one dip has its mirror on the other Mac.
Tests
Host tests on the batch's routing, byte-equal against per-stream absorbs on host arithmetic (
test-qwen27-draft-tree-host), and on the switch's registration (test-environment-host);zig fmt,ast-checkand the lean check.