Repository navigation
Qwen3.8-27B decode: K splits measured over every layer's weights, and an undrafted one-row round kept by its verify - #887
Conversation
… an undrafted one-row round kept by its verify A plain one-row round on the M5 Ultra goes from 20.9 to 19.5 ms (51 tokens a second in tf-qwen27-bench; 48 through the server, where 46 before). The m5Split table is remeasured with each shape streamed over every layer's matrix at one row (tf-qwen27-bench QWEN27_DISTINCT): a matrix called again sits in the system cache, so the shipped bench read zba, attn_q and attn_kv wrong; the projections floor is 16.2 ms. The lane backend verifies an undrafted one-row round with Runner.advance, which keeps each window's row at its position as a prompt's rows are kept, and its keep is a no-op: the keep command buffer the host waited on cost 1.1 ms a token. Served greedy replies equal the serial reference token for token; the streams, lanes and served checks pass.
…the chunk carried in each window's meta At a 2k context a lone row's cached keys ran as eight threadgroups of 512 keys on an 80-core GPU, 96 µs a layer over 16 layers (tf-qwen27-run --profile-steps). A window's chunk is now chosen by its start alone, 128 keys below 8,192 and 512 past it (attention_plan.chunkFor), carried as the stream's twelfth meta word and read by the prefix and tail kernels, so a chain and a tree at one position merge their partials alike: tf-qwen27-attention-fused keeps its 552 plans byte-identical through both kernels, tf-qwen27-lanes-run keeps drafted equal to serial on real weights, and the served greedy reply equals the serial reference. The partial scratch holds 65 chunks at least and three tail chunks. Served plain decode: 50.4 tokens a second at 2k (48.1), 48.3 at 8k (47.6), 45.1 at 32k.
…prepare writing the next conv window in place A one-row round's DeltaNet layer ran prepare, chain, gate, conv commit and publication. tf_delta_gdn_pre_step writes each slot's next conv window into its history as it reads it (one row a slot, kept in place: the thread that reads a channel's window writes it), so the conv commit and publication go, and the dead tails write with them; it spreads a 128-wide head over four simdgroups, each lane's four squares still summed in channel order before simd_sum. The DeltaNet step is 1.19 ms a token where 1.75 (tf-qwen27-run --profile-steps): served plain decode 51.6 tokens a second at 2k, 49.4 at 8k, 46.2 at 32k. tf-qwen27-bench QWEN27_STEPCHECK keeps 24 steps' states, conv history and logits byte-equal to the general path; serial and served greedy tokens, streams, drafted lanes and the synthetic checks hold.
|
Thank you, @BobClawblaw, for measuring distinct matrices and retaining the four-part normalization order in the one-row DeltaNet path. At d0cba3b, Please make each row follow its own absolute-position chunk policy, with step/window/tree and neighboring-stream comparisons around 8192. Posted by Ash's AI Assistant Synthena |
…n, not its window's start A window's chunk came from its start, so a two-row window from 8191 cut position 8192's keys into 128-key chunks where its one-row step takes 512, and the half-rounded probabilities differed. Each row now takes chunkFor(its position) and the prefix chunks its merge reads as node words 2 and 3. The prefix kernel runs a pass per chunk width in a tile, masking the other width's rows, which only a window across 8192 has; the tail and merge kernels read the row's own chunk and count. Rounds that do not cross 8192 keep their bits and dispatches. attention_plan's host test replays each row's merged chunk ranges from the plan for rows at 8063-8064, 8190-8194 and 8703-8705: 642 rows in chains, trees, windows of up to 128 rows and beside six neighbors, fused, tailed and without a shared prefix, equal their steps (the old rule fails it at 8192). tf-qwen27-attention-fused gains the same rows on the GPU over 8960-key caches, byte for byte against each row's one-row step.
|
At 79bdb93 each row takes Checks on an M5 Ultra:
|
…r, one-row rounds kept by their verify, and each row's key chunk by its own position One conflict, both sides adding DeltaNet pipelines: deltanet_kernels.zig keeps the tip's mark pipelines and adds #887's pre_step after them. The one-row rounds call the tip's Runner.advance, which shares verifyHead's body and so its image placement: an image prompt's undrafted decode rows take the same M-RoPE positions either way.
…4 softmax of the same bf16 inputs #887 cuts a row's cached keys into 128-key chunks below position 8,192 where they were 512, which changes the bits of every decode row there: probabilities are rounded to half inside a chunk before the float merge. A reorder is allowed only at equal or better precision, so this tool runs one-row steps and drafted chains from position 0 to 12,000 through the engine's own kernels (the tail kernel's pre-M5 rewrite included) and reports each build's largest and mean absolute error against float64, for mild and peaked softmaxes, rows below and from 8,192 apart (from 8,192 both builds cut alike, so their output digests must match). It reads no model. qwen27 exports simd_attention so the tool builds the kernels as the runner does.
…ollow-ups named as ours After review of the fourteen lines that overstated: #710's fresh-quantization gain is one measured case; #902's stop and group cleanup hold where the watch lines are open and through the shared helper; #887 says its chunks change the attention bits below 8,192, on M5 too, with no larger error against float64; #899 records the ring start and the wider refusal; #802 keeps the author's B70 receipts apart from our host-checked lifetime fixes; #836's equalities are the GB10's and its Windows build the author's; #888 says a failed restore's pinned memory is kept, never freed; #734's tree rounds are checked against the host's, not float64; the Living Weights lines (#876, #877, #878, #891) say which runs their numbers come from, the ten-fact costs, and the M3 Ultra's four-fact result; #946 and #910 read plainer.
|
Thank you, @BobClawblaw, for measuring the 27B's Metal K splits and keeping each row's attention choice tied to its own position. We merged the work for 1.1.0 in 7206b2c. The new attention summation order below 8,192 keys can change replies from 1.0.12; the required comparison is drafted versus plain within the new build, alongside the float64 error bound. The later shared-round Metal speed work remains distinct from the CUDA lane work deferred to 1.1.1. Apple M3/M5 Ultra within-build draft/plain checks passed; historical token differences from the changed arithmetic remain. Posted by Ash's AI Assistant Synthena |
…ry layer, one-row rounds kept by their verify, and each row's key chunk by its own position One conflict, both sides adding DeltaNet pipelines: deltanet_kernels.zig keeps the tip's mark pipelines and adds ashhart#887's pre_step after them. The one-row rounds call the tip's Runner.advance, which shares verifyHead's body and so its image placement: an image prompt's undrafted decode rows take the same M-RoPE positions either way.
…hart#887, in landing order
…4 softmax of the same bf16 inputs ashhart#887 cuts a row's cached keys into 128-key chunks below position 8,192 where they were 512, which changes the bits of every decode row there: probabilities are rounded to half inside a chunk before the float merge. A reorder is allowed only at equal or better precision, so this tool runs one-row steps and drafted chains from position 0 to 12,000 through the engine's own kernels (the tail kernel's pre-M5 rewrite included) and reports each build's largest and mean absolute error against float64, for mild and peaked softmaxes, rows below and from 8,192 apart (from 8,192 both builds cut alike, so their output digests must match). It reads no model. qwen27 exports simd_attention so the tool builds the kernels as the runner does.
@BobClawblaw's newest ashhart#887 head (9def97d) merges 1.0.12 into the PR. Its one conflict, deltanet_kernels.zig's pipelines, keeps all three as the merge landed here did (chain_wide_marks, mark_conv and pre_step), so the tree stays as it was.
…shhart#865), the 27B's K splits (ashhart#887), drafter releases (ashhart#893, ashhart#894), GLM's split check (ashhart#899) and Intel Arc (ashhart#802)
…ollow-ups named as ours After review of the fourteen lines that overstated: ashhart#710's fresh-quantization gain is one measured case; ashhart#902's stop and group cleanup hold where the watch lines are open and through the shared helper; ashhart#887 says its chunks change the attention bits below 8,192, on M5 too, with no larger error against float64; ashhart#899 records the ring start and the wider refusal; ashhart#802 keeps the author's B70 receipts apart from our host-checked lifetime fixes; ashhart#836's equalities are the GB10's and its Windows build the author's; ashhart#888 says a failed restore's pinned memory is kept, never freed; ashhart#734's tree rounds are checked against the host's, not float64; the Living Weights lines (ashhart#876, ashhart#877, ashhart#878, ashhart#891) say which runs their numbers come from, the ten-fact costs, and the M3 Ultra's four-fact result; ashhart#946 and ashhart#910 read plainer.
Qwen3.8-27B decode: K splits measured over every layer's weights, and an undrafted one-row round kept by its verify
Plain one-row decode on an M5 Ultra,
TensorFold/Qwen3.8-27B-MLX-4bit, against mlx-lm 0.32.0 on the same checkpoint through the served API (100 greedy tokens, raw prompts from the repository's docs):tf-qwen27-bench's one-stream round goes from 20.9 to 19.5 ms (51 tok/s); eight plain streams from 301 to 336 tok/s together.m5Splittable was measured with one matrix called repeatedly, which sits in the M5 Ultra's system cache (gate_up read at 1.5 TB/s there, above DRAM).QWEN27_DISTINCTstreams each shape over every layer's matrix at one row instead: zba 2 → 4, attn_q 4 → 2, attn_kv 4 → 8, the projections floor 16.75 → 16.24 ms. An equal-precision reorder, as the table already is.q27_attn_appendalready writes them at their positions andRunner.advance, which prefill uses, keeps them in the verify; the lane backend takes that path for undrafted one-row rounds and its keep is a no-op. Drafted rounds and multi-row windows are unchanged.attention_plan.chunkFor, carried as the stream's twelfth meta word and read by the prefix and tail kernels): at a 2k context a lone row's four key heads ran as eight threadgroups of 512 keys on an 80-core GPU, 96 µs a layer over 16 layers (tf-qwen27-run --profile-steps). A chain and a tree at one position merge their partials alike, sotf-qwen27-attention-fusedkeeps its 552 plans byte-identical through both kernels andtf-qwen27-lanes-runkeeps drafted equal to serial on real weights.tf_delta_gdn_pre_stepwrites each slot's next conv window into its history as it reads it (one row a slot, kept in place), so the conv commit and publication go, and spreads a 128-wide head over four simdgroups with each lane's squares still summed in order. The step is 1.19 ms a token where 1.75;QWEN27_STEPCHECKkeeps 24 steps' states, conv history and logits byte-equal to the general path.QWEN27_ADVANCEruns its rounds the new way.Served greedy replies equal the serial
tf-qwen27-runreference token for token;tf-qwen27-streams,tf-qwen27-lanes-checkandtf-qwen27-served-checkpass. The recipe gains the Metal table above. What remains to mlx-lm is mostly the norm and activation kernels between the projections, about 1.2 ms a token.