Repository navigation
EXL3 Flash Next: DeltaNet head split, opt-in (7/7) - #1447
Closed
BlivionIaG wants to merge 7 commits into
Closed
BlivionIaG wants to merge 7 commits into
BlivionIaG wants to merge 7 commits into
Conversation
BlivionIaG
force-pushed
the
pr/exl3-s7-gdn-split
branch
4 times, most recently
from
October 27, 2026 12:48
555b4ca to
14c3d37
Compare
…inned host RAM, sm_120 gate
BlivionIaG
force-pushed
the
pr/exl3-s7-gdn-split
branch
from
October 27, 2026 14:46
14c3d37 to
9a2994d
Compare
Owner
|
Thanks for keeping this opt-in, and for reporting the divergence plainly. We can't take the head split as designed,
Two more things we noticed:
A split that gathers whole heads' gated rows, then runs the full out projection with TP=1's plan on each rank, would |
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.
Draft, slice 7 of 7 in the chain of #1419 (opt-in, off by default). Stacked on slice 6: this branch contains the earlier slices, review only the last commit. Numbers marked "pending" are being measured and will be filled in before this leaves draft.
What
TF_FLASHNEXT_GDN_SPLIT=1splits the 48 DeltaNet value heads (and 16 key heads) of every linear-attention layer across the two TP=2 ranks for decode rows (rounds and windows under 64 rows). Rank r runs key heads 8r..8r+7 and value heads 24r..24r+23: its q, k, v and z projections read half of the replicated EXL3 weights through column views (a pointer offset and a shorter extent, no copy), the recurrence updates half of the state in the whole-layer layouts, and the out projection, cut by input rows, gives a partial sum that one fp32 all-reduce adds. Prompt passes keep running every head, so weights, conv windows and states keep their sizes and layouts.Files:
cuda_exl3_gdn_split.zig(views), head-subset variantsfn_gdn_front_h,fn_gdn_rows_h,fn_gdn_rows_to_h,fn_gdn_norm_hinflashnext_batch.cu, and the hooks incuda_batch.zig/cuda_prompt_load.zig.Why it is opt-in
Notes on the measurements
The split is off by default, so the receipt tables below are the default path and match slice 6 within noise. A table with the split enabled (TTFT, prefill, decode, ITL): pending; prefill is unchanged by design, the split applies to decode rows only. Extending the split to prompt passes was tried and rejected (TTFT +18%).
Tests run
On this tree:
zig build native -Dnvcc=nvcc -Dsm=120,test-flashnext-exl3-host(294 pass),compile-cuda-tests,test-kernel-contracton sm_120;zig fmt --check;python3 tools/zig/lean_check.pyat 428 problems, the same set as upstream main; Linuxzig build test(4899 pass, 18 skipped, 0 failed), HIP build and test as on main;zig build dev-tools -Dcpu=apple_m1; a mutation of the draft guard is caught by its unit test. Not run: other architectures,test-goldenon a Mac for this slice (run on slice 1), the FP64 references.Contract
The four
_hkernels have geometry-only pending records (flashnext_gdn_split_pending.zig; launch bounds 256/128/128/128, resource usage unmeasured, so every architecture including sm_120 stays pending until measured).Not done in this PR
_hkernels.Receipts (2x RTX 5060 Ti 16 GB sm_120, PCIe 4.0 x8, EPYC 7452, 251 GB RAM, driver 615.71, CUDA 13.4, Zig 0.17.0)
Measured on this slice's tree before the rebase onto current main (same code); a smoke run on the rebased heads of slices 1, 2 and 7 reproduces every output hash above and drafted equals plain, with plain timings within 5%. Open item: with drafts on, cold TTFT was higher on that run (slice 7 Zig 19.2 s against 10.9 s plain, docs 21.0 s against 10.7 s); the earlier run above shows 11.5 s and 11.2 s, so it is being re-checked. 192 output tokens, temperature 0; cold is the first request after server start, warm the identical repeat; the bench has no prompt cache. Peak memory and the prompt-cache check are in the receipt files.
bench2.py: three prompts (short = 40 tokens, zig = 16,022 tokens of source files, docs = 12,780 tokens of docs), 192 new tokens, temperature 0,ignore_eos, thinking off, streamed over the OpenAI chat API, two repetitions each. Cold = the first request of that prompt after server start (includes first-touch and graph capture), warm = the identical repeat. The prompt cache is off (--prompt-cache-gib 0or none), so the warm repeat prefills again from scratch. Prefill tok/s = prompt tokens / TTFT; decode tok/s = (gen-1) / (last-first chunk span); mean ITL = that span / (gen-1).Plain decode (no drafts)
Drafted decode (MTP head loaded, drafts enabled)
Repeat of the drafted session (second server start, same binary and settings, run after all slices to check run-to-run variance):
drafted == plain
bench_openai 256-token greedy token hashes, plain vs drafted: fibonacci-raw: plain ['97f8951316ab'] drafted ['97f8951316ab'] -> equal; gpu-chat-no-think: plain ['de2cc2940523'] drafted ['de2cc2940523'] -> equal
Repo-client receipts
bench_openai decode, 256 tokens x3 greedy (plain)
bench_cache cold prefill, exact token-id prompts,
--require-cold(plain)bench_openai decode, 256 tokens x3 greedy (drafted)
bench_cache cold prefill, exact token-id prompts,
--require-cold(drafted)bench_concurrent, 1 and 2 streams,
--alone --serial(PARALLEL=2 server)FP64 receipt (reduction order)
What changes. With TF_FLASHNEXT_GDN_SPLIT=1, decode-sized rows (under 64) of the DeltaNet layers run half of the value heads on each rank; the out projection's K = 6144 reduction becomes two K = 3072 reductions whose fp32 partials are added across ranks, instead of one rank reducing all of K.
Method. Real weights (the 3.05 bpw pack) and real activations: the 12,780-token docs prompt (every 64th position, 200 rows) and a 31-token prompt, each followed by 40 greedy tokens, run through the real server with a read-only capture of each op's input and of the fp32 value it produced. The reference recomputes the op in float64 from the pack's dequantized weights (W = diag(suh) H Wq H diag(svh), Wq = the fp16 trellis values; its bitstream and codebook decoding reproduces the repo's numpy-oracle fixture bit for bit) on the captured input; the router's picks and weights are the device's own. Error = device value minus float64 value, relative L2 per row; the ratio is regrouped / current, paired on the same (layer, position). The 95% interval is a bootstrap over pairs of the geometric mean of the per-pair ratio.
Slices 3 to 6 reorder nothing on these paths. Slice 7's tree with the split off produces the same bytes as slice 2 on every sampled row (rank 0's records, 2 prompts):
and the shipped slice-7 configuration (deep prefill, BF16 KV paging, CUDA graphs, expert-parallel) gives the same greedy replies as slice 2 on every prompt tried: 8 of 8 replies identical. For scale, slice 1 and slice 2, which do differ in grouping, give identical replies on only 2 of 8 of the same prompts.
gpu: 2 NVIDIA GeForce RTX 5060 Ti, 615.71.09, 12.0
nvcc: Build cuda_13.4.r13.4/compiler.38855100_0
zig: 0.17.0
python: Python 3.12.3 numpy 1.26.4
cpu: AMD EPYC 7452 32-Core Processor, 1 threads
kernel: Linux 6.8.0-147-generic
nccl: NCCL version 2.32.3+cuda13.4