Skip to content

glm cuda: DFlash2 reads complete prompt taps at TP>1 - #1623

Merged
ashhart merged 4 commits into
ashhart:mainfrom
BadAd84:pr-dflash-prompt-taps
Nov 4, 2026
Merged

ashhart merged 4 commits into
ashhart:mainfrom
BadAd84:pr-dflash-prompt-taps

Conversation

@BadAd84

@BadAd84 BadAd84 commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

DFlash2 reads stale prompt taps at TP>1

With TF_GLM_PREFILL_REDUCE=split (the default), a prompt piece's glue is split across ranks - each rank applies the post for its own rows, then shares b.normed (b.hidden after the last layer) and never b.x. So a rank's residual is only current for its own rows, which is fine for the target as every layer just reads the shared b.normed.

But the DFlash2 tap after layers 5/14/24/33/42 reads f.ranks[0].b.x for every row of the pass, so each rank's drafter ends up ingesting a stale residual for the other ranks' rows - half its prompt context at TP=2, 2/3 at TP=3. (Verify windows aren't pieced, so their taps were always current.) Replies never change, as the verify only accepts the target's tokens - what suffers is draft acceptance after every prompt.

The fix

The glue stays split. Each rank taps its own rows of a split piece (tapPieces), then after the pass shareTaps hands the tap rows to every rank via the same relay that shares normed (relay.glued / splitGlued), at the taps' width (5 x 4096). Every rank runs the drafter's passes, so every rank needs every row. Unsplit pieces tap as before, and with .local exchange the owners' residual rows are copied in before the tap instead.

A chunk that ends before the drafter's window (dflash.promptRun's keep_from) carries no taps at all, so a long prompt only taps and shares its last window. Nothing read those taps before either.

No host test, as the defect needs split glue (i.e. more than one rank on separate GPUs). The check is the receipts below: acceptance comes up to exactly what TF_GLM_PREFILL_REDUCE=gather (no split glue, so complete taps) gives on the same build, and replies don't change at all. A first version that glued the drafter's window whole got the same acceptance but cost 0.35 s of TTFT at 7.9k tokens - this one costs nothing measurable.

Measured

3x GB10, TP=3, Mia-AiLab/GLM-5.3-Flash-EXL3-4bpw-TensorFold @ 078455ffe6472f9a52fbc1139f58b9db2881b25c, --drafter DFlash2 at 4 bits, --kv-cache fp8, --prompt-cache-gib 0, 8 slots, 196,608 context, a fresh boot per cell, main 7c0688951 against this change on it, in ABBA order. Since rebased onto d33dcfc76 - none of the 21 commits in between touch these four files.

tools/bench_concurrent.py --levels 1,2,4,6,8 --temperatures 0 --reps 3 --tokens 256 --alone --serial, aggregate tok/s, two boots each:

prompt streams main this PR change tokens a chunk
chat 1 44.9 / 44.8 45.6 / 45.6 +1.7% 2.37 -> 2.42
chat 2 74.4 / 74.2 75.6 / 75.5 +1.7% 2.17 -> 2.21
chat 4 118.8 / 118.8 121.4 / 120.9 +2.0% 2.17 -> 2.21
chat 6 135.6 / 135.6 138.3 / 138.5 +2.1% 2.15 -> 2.19
chat 8 169.4 / 169.1 172.5 / 172.3 +1.9% 2.12 -> 2.15
code 1 54.9 / 54.6 55.5 / 55.6 +1.5% 3.05 -> 3.08
code 2 93.0 / 92.6 93.9 / 93.7 +1.1% 2.84 -> 2.88
code 4 150.5 / 148.8 151.4 / 151.0 +1.0% 2.84 -> 2.88
code 6 167.4 / 166.4 168.7 / 167.3 +0.7% 2.72 -> 2.75
code 8 208.6 / 207.7 207.7 / 208.5 -0.0% 2.67 -> 2.69

Long prompts, cold, 300 tokens greedy, accepted drafts a round from /metrics:

prompt main tok/s this PR tok/s change accepted a round cold TTFT
7.9k tokens, copy 51.14 / 50.77 56.38 / 56.66 +10.9% 2.02 -> 2.398 6.50 -> 6.52 s
7.9k tokens, prose 34.27 / 34.27 37.07 / 36.98 +8.0% 0.78 -> 0.974 6.51 -> 6.51 s
31k tokens, copy 52.99 / 52.79 58.86 / 58.83 +11.3% 2.147 -> 2.56 25.00 -> 25.01 s
31k tokens, prose 34.59 / 34.30 35.88 / 35.93 +4.2% 0.765 -> 0.899 25.03 -> 25.03 s

Every --alone --serial check is equal and every reply digest is identical between the 2 builds. Short prompts gain less as the drafter's prompt context is short - the long-prompt rows are where the stale taps showed.

Gates on this branch (d33dcfc76 + 1): zig build check-native-cuda-host, compile-cuda-tests, test-cuda-host all green, zig fmt --check clean, tools/zig/lean_new.py against d33dcfc76: 0 new.

@ashhart

ashhart commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thanks @BadAd84, the change is coherent and applies cleanly to main. Two things before it lands:

  1. Can you add a recording CUDA/NCCL regression that fails before this patch and covers poisoned non-owner rows, nonzero/uneven piece offsets, split/ring and local copies, plus the keep_from boundary? Separate GPUs are needed for final qualification, but not to check these dispatch offsets and ownership. Existing host tests miss the new functions, despite the “No host test” rationale (inputs/S146-pr1623.md:13).
  2. Can you attach raw exact-head TP2 hashes/logs, pin the drafter revision and run GB10 ×2 / GLM EXL3 4bpw / DFlash2 4-bit / FP8 KV? Use the supplied model revision, cache disabled, equal admitted settings and fresh-boot ABBA main/candidate. Exercise split plus ring and gather controls at prompt lengths 2,047/2,048/2,049 and about 8k/31k, prose/copy, one/four streams, greedy and fixed-seed sampled. Compare each rank's retained tap rows with complete gather taps; require candidate/base replies equal, drafted/plain equal and concurrent/solo equal. Record acceptance, cold TTFT, throughput and peak memory. This cell remains lead-owned and unchecked here.

@BadAd84

BadAd84 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. Item 1 and the per rank tap comparison are in, the ABBA matrix is running now.

  1. 8f2b157 - adds zig/src/families/glm/cuda_taps_tp_test.zig, which gets run by test-cuda-host via a new test-glm-prompt-taps-host step. It drives the real tapPieces, shareTaps and Taps.at at TP=2 and TP=3 over a recording cuda driver + an emulated nccl that records the split exchange and replays it. On every rank it checks the tap buffer holds the complete gathered taps (with the non-owner residual rows poisoned beforehand) over nonzero uneven piece offsets, the split and ring paths and the local copies, with a gather control. It checks the keep_from boundary, 1 row each side, against dflash.promptRun. On main it doesn't build as the functions it drives are new, so it also has a case that taps the whole chunk from one ranks residual (the old way) and shows the non-owner rows stay poisoned.

  2. For the hardware comparison - b2c6cda adds tf-cuda-test glm-tap-split-check. Every rank loads the model and the DFlash2 drafter, prefills prompts of 2047 / 2048 / 2049 / 8000 rows (the 8k one in uneven pieces) under gather, split and ring, and compares its own retained tap rows under split and ring with gathers, byte for byte, all 5 tap slots. On GB10 x2 at TP=2:

    • main (37a4a84 + just this check, its 1 use of taps.hidden written as 4096): fails on both ranks for split and ring at every length, rank 1 from its first retained row
    • this head (b2c6cda): passes on both ranks

The matrix you listed (main vs this head, fresh boot ABBA, split / ring / gather, 2047 / 2048 / 2049 / ~8k / ~31k, prose / copy, 1 and 4 streams, greedy / fixed seed sampled, cache off, pinned model and drafter revisions) is running on the same 2 GB10s. I will post the hashes, logs and the acceptance / TTFT / throughput / memory tables when its all done

Also merged main again (1ddac96); the only conflict was the test command list in tests/cuda/main.zig.

@ashhart

ashhart commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Thanks @BadAd84. The code is right, and ask 1 is fully answered: the recording CUDA and NCCL test of the real tapPieces/shareTaps/Taps.at at TP=2 and TP=3 shows the old whole-chunk tap leaving poison, and your device check is byte-equal to the gather at 2,047, 2,048, 2,049 and 8,000 rows on two GB10s, failing on main and passing at the head. What's still owed is ask 2's served TP=2 ABBA matrix. That's a pinned model and drafter, cache off, at 2,047/2,048/2,049/~8K/~31K rows, prose and copy, 1 and 4 streams, greedy with a fixed seed, with raw hashes and logs, candidate = base, drafted = plain and concurrent = solo, and acceptance, cold TTFT, throughput and peak memory. If you'd rather, we can run it on our pair and post it. Say which.

@BadAd84

BadAd84 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

The matrix is done: GB10 x2 at TP=2, 12 fresh boots in ABBA order (main, cand, cand, main for each of split, ring, gather), GLM-5.3-Flash-EXL3 4bpw with the DFlash2 4-bit drafter, FP8 KV, prompt cache off, main = 37a4a84 (ai-engine:upm37, build label 623cb3da762fc92e), candidate = b2c6cda. The prompts are natural text: prefixes of upstream's own docs at 1ddac96 (the eight prose-heavy files, 28,627 words, doc sha256 233b26ffe0b3946f), under a continue-the-document head (prose) or a repeat-verbatim head (copy), at 2047 / 2048 / 2049 exactly (straddling prefill_rows and dflash.WIN) and 8192 / 31744. Full tables: report below.

Exactness. Candidate and base solo replies are identical at every prompt, greedy (temp 0) and fixed-seed sampled (temp 1.0, seed 1234): the tap write is a pure side output. bench_concurrent's own checks pass with zero failures on both arms: concurrent == solo (40/40 equal a prompt) and drafted == plain (20/20).

Draft acceptance, the runtime view of the taps (the direct proof stays glm-tap-split-check from the comment above):

control base candidate base - gather candidate - gather
split 0.5927 0.6073 -0.0150 -0.0007
ring 0.5926 0.6080 -0.0152 -0.0000
gather 0.6078 0.6080 0 0

Base loses about 1.5 points under split and ring; the candidate recovers the gather level on both.

Performance (each arm's geometric mean over the 20 prompt x sampling cells; a cell repeats within an arm to about 1 percent, so an arm difference is the drafts each tap set produces on that prompt, with identical replies):

control, arm cold TTFT s (1) prefill tok/s (1) decode tok/s (1) aggregate tok/s (4) peak dev mem
split, main 1.889 1084.9 39.22 31.68 85.0 GiB
split, cand 1.891 1083.7 39.91 31.49 85.0 GiB
ring, main 1.889 1084.8 39.18 31.70 85.0 GiB
ring, cand 1.894 1081.7 39.88 31.60 85.0 GiB
gather, main 1.960 1045.6 39.84 31.03 85.0 GiB
gather, cand 1.959 1045.7 39.90 30.95 85.0 GiB

One stream: 15 of 20 cells faster on the candidate (up to +7.3 percent), geomean +1.8 percent, and the candidate's split and ring sit at gather's level, which is what complete taps should do. Four streams: 12 of 20 cells faster, geomean -0.6 percent, and the whole of that is one cell (len2047_prose, greedy, -16.2 percent): with complete taps the drafter is more confident, it drafts 15 percent more tokens and accepts more of them, but the wider shared verify window at 4 streams costs more than the extra accepted tokens return on that prompt. Both gather arms (whose taps are complete by construction, on main as well) land at the candidate's value on that cell, 47.4 and 47.6 against the candidate's 48.0: the base's 57.2 is the outlier, a lucky draft sequence from the stale taps. The replies are identical; this is the confidence cut interacting with concurrency, not the taps. Section 4b of the report lists every cell.

Peak device memory is identical at 85.0 GiB in all six (control, arm) pairs. Provenance (model revision, drafter sha256s, image labels) and the exact-head reply hashes are in the report.

Full report (all tables: provenance, per-prompt lengths, exactness, acceptance, every performance cell, hashes)

PR #1623 TP=2 prompt-tap qualification receipt

Run folder: q2-20261102-0108 Boots: 12 Controls: split, ring, gather

Two DGX Spark GB10 (rank 0 + rank 1, ConnectX-7 direct cable), TP=2, GLM-5.3-Flash-EXL3 4bpw, DFlash2 4-bit drafter, FP8 KV, prompt cache disabled, fresh-boot ABBA (main,cand,cand,main) per control. Hostnames and IPs are redacted; raw server logs stay in the run folder, not here.

1. Provenance

  • Model snapshot revision: 078455ffe6472f9a52fbc1139f58b9db2881b25c
  • Drafter config.json: sha256 c4aeac0101196a6e26705b34c45230bcd0c7c68ee2d2d1efdb242087f3712573 (1273 bytes)
  • Drafter dl.log: sha256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 (0 bytes)
  • Drafter kda-pad0.bin: sha256 1855bfe414d271f497916d5a8e7d91a671bde5be00ce4151b6ec8e1c5af11776 (87260 bytes)
  • Drafter kda-pad1.bin: sha256 24cdc2c108b96ba9594809d6aa8b4ae2377d44bedffd75b64b63f40f5594cd4c (87280 bytes)
  • Drafter model.safetensors: sha256 b038e1d9d1e7833fa3880c2c0135ba9b673013f03da1b29fb831931584759dac (2342169800 bytes)
  • Drafter ready: sha256 8221ac66be71558c921fb44cfb66f7997699aea754d917763882d6d9eddc836e (5 bytes)
  • Rank-0 image + build label: ai-engine:upm37 623cb3da762fc92e
  • Server /v1/models: ["GLM-5.3-Flash-EXL3"]

1b. Prompt lengths (server-verified)

Prompts are prefixes of upstream's own docs at 1ddac9620083 (docs/living-weights.md, docs/kernel-contract.md, docs/vision.md, docs/quantization.md, docs/recipes/adding-a-zig-family.md, docs/recipes/adding-living-weights-to-a-family.md, docs/recipes/exl3.md, docs/recipes/glm-5.3-flash.md; 28627 words, sha256 233b26ffe0b3946f), under a continue-the-document head (prose) or a repeat-verbatim head (copy).

prompt target tokens actual tokens mode
len2047_prose 2047 2047 exact
len2047_copy 2047 2047 exact
len2048_prose 2048 2048 exact
len2048_copy 2048 2048 exact
len2049_prose 2049 2049 exact
len2049_copy 2049 2049 exact
len8192_prose 8192 8192 approx
len8192_copy 8192 8192 approx
len31744_prose 31744 31744 approx
len31744_copy 31744 31744 approx

2. Exactness (within each control)

Replies equal = candidate vs base solo reply digests match (same control); the tap write is a pure side output, so within a control the main forward is byte-identical and replies MUST match. concurrent==solo and drafted==plain are bench_concurrent's own equality counts (equal / not equal), summed over that arm's boots, base then candidate.

control prompt cand==base (per temp) concurrent==solo (equal/not) drafted==plain (equal/not)
split len2047_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
split len2047_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
split len2048_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
split len2048_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
split len2049_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
split len2049_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
split len8192_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
split len8192_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
split len31744_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
split len31744_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len2047_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len2047_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len2048_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len2048_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len2049_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len2049_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len8192_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len8192_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len31744_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
ring len31744_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len2047_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len2047_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len2048_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len2048_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len2049_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len2049_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len8192_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len8192_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len31744_copy EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0
gather len31744_prose EQUAL,EQUAL base 40/0, cand 40/0 base 20/0, cand 20/0

3. Draft acceptance by arm and control (runtime evidence for the taps)

The direct proof is tf-cuda-test glm-tap-split-check: every rank's retained tap rows under split and ring equal gather's byte for byte on this head and differ on main. Acceptance is how that shows at run time: if a rank's prompt taps are incomplete, the DFlash2 drafter reads wrong hidden states, proposes worse tokens and the target rejects them, so acceptance falls (replies are unaffected: the target verifies every token). The candidate's split/ring acceptance should match its gather control.

control base accept cand accept base - base.gather cand - cand.gather
split 0.5927 0.6073 -0.015 -0.0007
ring 0.5926 0.608 -0.0152 -0.0
gather 0.6078 0.608 0.0 0.0

Expected: base split/ring show a negative base - base.gather deficit; cand split/ring sit at about 0 vs cand.gather. gather rows are the reference (0 by construction).

4. Performance (cold cache; ABBA)

Each (prompt, temperature) cell repeats within an arm to about 1% (the same replies and the same drafts every boot), so a difference between the arms is the drafts each tap set produces on that prompt. The table gives each arm's geometric mean over the 20 cells, TTFT and prefill as medians; 4b lists every cell.

control arm cold TTFT s (1, median) prefill tok/s (1, median) decode tok/s (1, geomean) aggregate tok/s (4, geomean) peak dev mem
split main 1.889 1084.876 39.221 31.682 85.0 GiB
split cand 1.891 1083.732 39.911 31.488 85.0 GiB
ring main 1.889 1084.838 39.18 31.699 85.0 GiB
ring cand 1.894 1081.694 39.883 31.6 85.0 GiB
gather main 1.96 1045.621 39.836 31.029 85.0 GiB
gather cand 1.959 1045.745 39.901 30.949 85.0 GiB

4b. Every cell: base -> candidate

control prompt temp decode tok/s, 1 stream aggregate tok/s, 4 streams
split len2047_copy 0.0 54.5 -> 58.5 (+7.3%) 58.1 -> 56.6 (-2.6%)
split len2047_copy 1.0 33.6 -> 34.3 (+2.0%) 43.4 -> 42.3 (-2.3%)
split len2047_prose 0.0 42.2 -> 41.2 (-2.4%) 57.2 -> 48.0 (-16.2%)
split len2047_prose 1.0 34.9 -> 35.5 (+1.7%) 43.3 -> 44.0 (+1.7%)
split len2048_copy 0.0 39.1 -> 40.8 (+4.5%) 54.2 -> 59.9 (+10.5%)
split len2048_copy 1.0 31.8 -> 31.8 (+0.3%) 43.5 -> 42.7 (-2.0%)
split len2048_prose 0.0 47.7 -> 47.8 (+0.2%) 61.8 -> 58.5 (-5.3%)
split len2048_prose 1.0 33.1 -> 33.7 (+1.7%) 43.2 -> 41.9 (-3.1%)
split len2049_copy 0.0 45.7 -> 47.4 (+3.7%) 53.8 -> 56.7 (+5.4%)
split len2049_copy 1.0 34.0 -> 34.2 (+0.5%) 43.7 -> 44.0 (+0.7%)
split len2049_prose 0.0 42.1 -> 41.9 (-0.4%) 49.5 -> 48.8 (-1.5%)
split len2049_prose 1.0 32.3 -> 33.1 (+2.4%) 42.9 -> 43.5 (+1.3%)
split len8192_copy 0.0 41.4 -> 41.5 (+0.1%) 25.8 -> 25.5 (-1.2%)
split len8192_copy 1.0 33.7 -> 33.8 (+0.5%) 23.9 -> 24.2 (+1.3%)
split len8192_prose 0.0 41.4 -> 41.4 (-0.1%) 26.1 -> 26.5 (+1.3%)
split len8192_prose 1.0 36.1 -> 35.8 (-0.9%) 24.2 -> 24.6 (+1.2%)
split len31744_copy 0.0 58.4 -> 60.3 (+3.2%) 11.2 -> 11.2 (+0.0%)
split len31744_copy 1.0 33.5 -> 34.6 (+3.2%) 10.4 -> 10.4 (+0.5%)
split len31744_prose 0.0 52.5 -> 55.0 (+4.8%) 11.1 -> 11.1 (+0.5%)
split len31744_prose 1.0 31.0 -> 32.0 (+3.3%) 10.5 -> 10.5 (+0.0%)
ring len2047_copy 0.0 54.6 -> 58.4 (+6.9%) 58.3 -> 59.1 (+1.4%)
ring len2047_copy 1.0 33.6 -> 34.4 (+2.6%) 43.3 -> 42.7 (-1.4%)
ring len2047_prose 0.0 42.0 -> 41.2 (-2.0%) 57.3 -> 48.0 (-16.1%)
ring len2047_prose 1.0 35.0 -> 35.5 (+1.2%) 43.5 -> 44.1 (+1.3%)
ring len2048_copy 0.0 39.0 -> 40.8 (+4.6%) 54.3 -> 59.8 (+10.2%)
ring len2048_copy 1.0 31.7 -> 31.9 (+0.4%) 43.5 -> 42.7 (-1.7%)
ring len2048_prose 0.0 47.4 -> 47.7 (+0.6%) 61.9 -> 58.5 (-5.6%)
ring len2048_prose 1.0 33.2 -> 33.7 (+1.4%) 43.2 -> 41.9 (-3.1%)
ring len2049_copy 0.0 45.6 -> 47.3 (+3.7%) 53.8 -> 56.6 (+5.3%)
ring len2049_copy 1.0 33.9 -> 34.2 (+0.8%) 43.7 -> 44.0 (+0.8%)
ring len2049_prose 0.0 42.1 -> 41.9 (-0.4%) 49.5 -> 49.0 (-1.2%)
ring len2049_prose 1.0 32.2 -> 33.0 (+2.5%) 42.5 -> 43.7 (+2.9%)
ring len8192_copy 0.0 41.3 -> 41.4 (+0.1%) 25.8 -> 25.5 (-1.2%)
ring len8192_copy 1.0 33.7 -> 33.7 (+0.1%) 24.1 -> 24.2 (+0.8%)
ring len8192_prose 0.0 41.4 -> 41.3 (-0.1%) 26.2 -> 26.5 (+1.1%)
ring len8192_prose 1.0 36.0 -> 35.7 (-0.6%) 24.4 -> 24.7 (+1.2%)
ring len31744_copy 0.0 58.3 -> 60.1 (+3.1%) 11.1 -> 11.2 (+0.9%)
ring len31744_copy 1.0 33.5 -> 34.6 (+3.1%) 10.4 -> 10.5 (+1.0%)
ring len31744_prose 0.0 52.6 -> 55.0 (+4.6%) 11.1 -> 11.1 (-0.5%)
ring len31744_prose 1.0 31.0 -> 32.2 (+3.7%) 10.5 -> 10.5 (+0.0%)
gather len2047_copy 0.0 58.2 -> 58.2 (+0.1%) 58.6 -> 57.6 (-1.6%)
gather len2047_copy 1.0 34.4 -> 34.4 (+0.0%) 42.5 -> 42.3 (-0.4%)
gather len2047_prose 0.0 41.1 -> 41.2 (+0.4%) 47.5 -> 47.6 (+0.2%)
gather len2047_prose 1.0 35.5 -> 35.5 (+0.2%) 43.8 -> 43.7 (-0.1%)
gather len2048_copy 0.0 40.6 -> 40.8 (+0.6%) 59.1 -> 59.2 (+0.0%)
gather len2048_copy 1.0 31.9 -> 31.9 (-0.1%) 42.4 -> 42.3 (-0.1%)
gather len2048_prose 0.0 47.9 -> 48.0 (+0.2%) 55.7 -> 53.7 (-3.6%)
gather len2048_prose 1.0 33.6 -> 33.7 (+0.1%) 41.7 -> 41.5 (-0.5%)
gather len2049_copy 0.0 47.2 -> 47.3 (+0.2%) 56.0 -> 56.0 (-0.2%)
gather len2049_copy 1.0 34.1 -> 34.1 (-0.0%) 43.7 -> 43.6 (-0.2%)
gather len2049_prose 0.0 41.7 -> 41.9 (+0.6%) 48.3 -> 48.4 (+0.1%)
gather len2049_prose 1.0 33.1 -> 33.0 (-0.1%) 43.1 -> 43.2 (+0.2%)
gather len8192_copy 0.0 41.3 -> 41.5 (+0.4%) 24.9 -> 25.0 (+0.2%)
gather len8192_copy 1.0 33.7 -> 33.8 (+0.2%) 23.6 -> 23.7 (+0.2%)
gather len8192_prose 0.0 41.3 -> 41.2 (-0.0%) 25.9 -> 25.9 (+0.2%)
gather len8192_prose 1.0 35.7 -> 35.7 (-0.0%) 24.1 -> 24.1 (+0.0%)
gather len31744_copy 0.0 60.1 -> 60.0 (-0.2%) 10.9 -> 10.9 (+0.0%)
gather len31744_copy 1.0 34.6 -> 34.6 (+0.2%) 10.1 -> 10.1 (+0.0%)
gather len31744_prose 0.0 54.9 -> 55.1 (+0.3%) 10.7 -> 10.8 (+0.5%)
gather len31744_prose 1.0 32.0 -> 32.1 (+0.2%) 10.2 -> 10.2 (+0.0%)

5. Exact-head reply hashes (raw TP2 digests)

Distinct solo reply digests per control/prompt/temperature (greedy = temp 0 has one; sampled = temp 1.0 has one per seed). Candidate and base produce the SAME set within a control.

control prompt temp #distinct cand output_sha256[:16]
split len2047_copy 0.0 1 c8b28a85abc9f00d
split len2047_copy 1.0 4 1cbb1c2bb247106a,8f238dbd653c1991,a167253813cbd0ba,fdab3ccd442b8b42
split len2047_prose 0.0 1 0e19602201ffd791
split len2047_prose 1.0 4 5a80eebe6e30bbd6,c1fbda913a6deed6,c367501517972c85,e8cd7fbb0b811575
split len2048_copy 0.0 1 ffb45af71b953244
split len2048_copy 1.0 4 44c7d5f8792d1fba,6446f42e073d623e,abca0eede7ceb064,fd3a0a289169ce5d
split len2048_prose 0.0 1 500f16b403235ce3
split len2048_prose 1.0 4 6041fda14769ec18,616ff26b493e0263,6f42665ebc08c3c7,7cbc206658fd1e58
split len2049_copy 0.0 1 0797fb7f2dbe165d
split len2049_copy 1.0 4 246a60a6f9604b41,d4d16d4381f3f38d,faf504ceb2e1e889,fc654998f2d4badb
split len2049_prose 0.0 1 7c2e89c3384c7539
split len2049_prose 1.0 4 11a5606a357d4a65,22c67853b2c34713,648e34abf3ccd846,755f7a4f35897de3
split len8192_copy 0.0 1 abb884fe293eb3de
split len8192_copy 1.0 4 3af508d4fe3f82fe,73b0c24aad12e55e,91a8267883863807,cd70eb33faf43eaf
split len8192_prose 0.0 1 74e06789219a2ce3
split len8192_prose 1.0 4 1983dcb417ed9989,30fcaef62170518e,3a41d310d32949f0,3bdb5670f0d767f6
split len31744_copy 0.0 1 940af2fc33a2ff04
split len31744_copy 1.0 4 6c2072777dbe8a00,9bded19ca85b4030,ace78eb5f28d6d05,b70fbf0fa49919f6
split len31744_prose 0.0 1 8bce7f63ce3f079d
split len31744_prose 1.0 4 0ddf52c5f690a705,273ec779e24da6be,d060b03858637d82,f848ed021695ff2e
ring len2047_copy 0.0 1 c8b28a85abc9f00d
ring len2047_copy 1.0 4 1cbb1c2bb247106a,8f238dbd653c1991,a167253813cbd0ba,fdab3ccd442b8b42
ring len2047_prose 0.0 1 0e19602201ffd791
ring len2047_prose 1.0 4 5a80eebe6e30bbd6,c1fbda913a6deed6,c367501517972c85,e8cd7fbb0b811575
ring len2048_copy 0.0 1 ffb45af71b953244
ring len2048_copy 1.0 4 44c7d5f8792d1fba,6446f42e073d623e,abca0eede7ceb064,fd3a0a289169ce5d
ring len2048_prose 0.0 1 500f16b403235ce3
ring len2048_prose 1.0 4 6041fda14769ec18,616ff26b493e0263,6f42665ebc08c3c7,7cbc206658fd1e58
ring len2049_copy 0.0 1 0797fb7f2dbe165d
ring len2049_copy 1.0 4 246a60a6f9604b41,d4d16d4381f3f38d,faf504ceb2e1e889,fc654998f2d4badb
ring len2049_prose 0.0 1 7c2e89c3384c7539
ring len2049_prose 1.0 4 11a5606a357d4a65,22c67853b2c34713,648e34abf3ccd846,755f7a4f35897de3
ring len8192_copy 0.0 1 abb884fe293eb3de
ring len8192_copy 1.0 4 3af508d4fe3f82fe,73b0c24aad12e55e,91a8267883863807,cd70eb33faf43eaf
ring len8192_prose 0.0 1 74e06789219a2ce3
ring len8192_prose 1.0 4 1983dcb417ed9989,30fcaef62170518e,3a41d310d32949f0,3bdb5670f0d767f6
ring len31744_copy 0.0 1 940af2fc33a2ff04
ring len31744_copy 1.0 4 6c2072777dbe8a00,9bded19ca85b4030,ace78eb5f28d6d05,b70fbf0fa49919f6
ring len31744_prose 0.0 1 8bce7f63ce3f079d
ring len31744_prose 1.0 4 0ddf52c5f690a705,273ec779e24da6be,d060b03858637d82,f848ed021695ff2e
gather len2047_copy 0.0 1 c8b28a85abc9f00d
gather len2047_copy 1.0 4 1cbb1c2bb247106a,8f238dbd653c1991,a167253813cbd0ba,fdab3ccd442b8b42
gather len2047_prose 0.0 1 0e19602201ffd791
gather len2047_prose 1.0 4 5a80eebe6e30bbd6,c1fbda913a6deed6,c367501517972c85,e8cd7fbb0b811575
gather len2048_copy 0.0 1 ffb45af71b953244
gather len2048_copy 1.0 4 44c7d5f8792d1fba,6446f42e073d623e,abca0eede7ceb064,fd3a0a289169ce5d
gather len2048_prose 0.0 1 500f16b403235ce3
gather len2048_prose 1.0 4 6041fda14769ec18,616ff26b493e0263,6f42665ebc08c3c7,7cbc206658fd1e58
gather len2049_copy 0.0 1 0797fb7f2dbe165d
gather len2049_copy 1.0 4 246a60a6f9604b41,d4d16d4381f3f38d,faf504ceb2e1e889,fc654998f2d4badb
gather len2049_prose 0.0 1 7c2e89c3384c7539
gather len2049_prose 1.0 4 11a5606a357d4a65,22c67853b2c34713,648e34abf3ccd846,755f7a4f35897de3
gather len8192_copy 0.0 1 abb884fe293eb3de
gather len8192_copy 1.0 4 3af508d4fe3f82fe,73b0c24aad12e55e,91a8267883863807,cd70eb33faf43eaf
gather len8192_prose 0.0 1 74e06789219a2ce3
gather len8192_prose 1.0 4 1983dcb417ed9989,30fcaef62170518e,3a41d310d32949f0,3bdb5670f0d767f6
gather len31744_copy 0.0 1 940af2fc33a2ff04
gather len31744_copy 1.0 4 6c2072777dbe8a00,9bded19ca85b4030,ace78eb5f28d6d05,b70fbf0fa49919f6
gather len31744_prose 0.0 1 8bce7f63ce3f079d
gather len31744_prose 1.0 4 0ddf52c5f690a705,273ec779e24da6be,d060b03858637d82,f848ed021695ff2e

@BadAd84

BadAd84 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Just FYI, we have 6 sparks currently dedicated to tensorfold speed improvements, we are attacking concurrency next and all the patches should stack.

We have got single stream to approximately 85% of the speed we tweaked the mia-ai python tensorfold built, up from around 50%. Will keep working, as want to get our fleet all running on thw zig based engine (glm 5.3 flash tp3, DS 4.1 Flash tp2 and qwen flash next tp1)

@BadAd84

BadAd84 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

The matrix is in my comment just above yours - 12 boots, natural text, pinned revisions, acceptance back at the gather level on split and ring. Happy for you to rerun it on your pair as well.

@ashhart

ashhart commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thanks @BadAd84, this is a thorough receipt. Twelve fresh boots in ABBA order with pinned model and drafter, replies equal in every control, prompt and temperature, drafted equal to plain and concurrent equal to solo, and acceptance back at the gather level under both split and ring (0.6073 and 0.6080 against 0.6080). Peak memory and cold TTFT don't move. That's everything we asked for.

The one slow cell at four streams (2,047-token prose, greedy, −16.2%) lands where both gather arms land, and gather's taps are complete on main too, so it's the old stale taps that were lucky there, not a slowdown. This is ready to land.

@ashhart
ashhart force-pushed the pr-dflash-prompt-taps branch from ad65c84 to 3a4e008 Compare November 4, 2026 10:03
ashhart added a commit to BadAd84/TensorFold that referenced this pull request Nov 4, 2026
BadAd84 and others added 4 commits November 4, 2026 11:36
With TF_GLM_PREFILL_REDUCE=split (the default) a split piece's glue posts only a rank's own rows of the residual
and shares normed, never x, so the tap after layers 5/14/24/33/42 read stale rows for every row another rank owns:
half of a prompt's drafter context at TP=2, two thirds at TP=3. Replies never change; draft acceptance does.

Each rank now taps its own rows of a split piece (tapPieces; .local copies the owners' rows in first), and
shareTaps hands the tap rows to every rank once the pass is done, through the relay that shares normed, at the
taps' width (5 x 4096). The glue stays split. A chunk that ends before the drafter's window (dflash.promptRun)
carries no taps, so a long prompt shares only its last window.
@ashhart
ashhart force-pushed the pr-dflash-prompt-taps branch from 3a4e008 to ff71538 Compare November 4, 2026 11:36
@ashhart
ashhart merged commit 2fa5847 into ashhart:main Nov 4, 2026
0 of 7 checks passed
@ashhart

ashhart commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thank you @BadAd84. 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.

@BadAd84
BadAd84 deleted the pr-dflash-prompt-taps branch November 5, 2026 14:55
@ashhart

ashhart commented Nov 5, 2026

Copy link
Copy Markdown
Owner

kelchm pushed a commit to kelchm/TensorFold that referenced this pull request Nov 7, 2026
With TF_GLM_PREFILL_REDUCE=split (the default) a split piece's glue posts only a rank's own rows of the residual
and shares normed, never x, so the tap after layers 5/14/24/33/42 read stale rows for every row another rank owns:
half of a prompt's drafter context at TP=2, two thirds at TP=3. Replies never change; draft acceptance does.

Each rank now taps its own rows of a split piece (tapPieces; .local copies the owners' rows in first), and
shareTaps hands the tap rows to every rank once the pass is done, through the relay that shares normed, at the
taps' width (5 x 4096). The glue stays split. A chunk that ends before the drafter's window (dflash.promptRun)
carries no taps, so a long prompt shares only its last window.

Upstream PR ashhart#1623 (ashhart#1623), cherry picked from commit
4b0dac0 onto the recipe stack unchanged.

Origin: MiaAI-Lab/GLM-5.3-Flash-DGX-Sparks-1104@13f2464 patches/engine 0013-glm-cuda-DFlash2-reads-complete-prompt-taps-at-TP-1.patch sha256:82c33c5feb9953d8697a28075ec771cf2fcdcce05ea4a90c1195b9239b808711
kelchm pushed a commit to kelchm/TensorFold that referenced this pull request Nov 7, 2026
… would be alone

TF_GLM_PROMPT_PAIR refused every step while a drafter was loaded, so with --drafter (the
recipe's DFlash2) a prompt never paired and its exchanges stayed exposed. A pair now carries
the drafter's taps:

- The twin (Pair.init's new `drafter`) holds the second chunk's tap rows, a chunk's worth of
  DFlash2 rows; the first chunk keeps taps_prefill.
- Each chunk taps only when it reaches into the drafter's last window (prefillChunk's rule,
  dflash.promptRun).
- pairBody taps each ffn piece on the side stream right after its glue there posts the rows
  (tapPiece: ashhart#1623's split rule, the rank's own rows; in-process ranks copy the owners' rows
  in first), and once both chunks' last sites are in, shares each chunk's taps on the main
  stream (ashhart#1623's shareTaps) while the side stream holds nothing else.
- The drafter then ingests a's rows from taps_prefill and b's from the twin's
  (Drafter.promptFrom), in that order, as two chunks one at a time do; the MTP head's prompt
  rows stay skipped beside a drafter.

The pass's kernels, their inputs and their order per chunk are pairing's own, and the taps
are the same kernel on the same rows, so the drafter's context is the one an unpaired step
builds.

Origin: MiaAI-Lab/GLM-5.3-Flash-DGX-Sparks-1104@13f2464 patches/engine 0057-glm-cuda-paired-prompt-steps-beside-DFlash2-each-chu.patch sha256:238e9281a2be4e2e84136c8d17bd1bbd5a91565355ad73d02e40ba07ecdcc65a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants