Skip to content

fix(dsv41): plan prefill buffers at the split boundary's rows - #3529

Closed
laudney wants to merge 1 commit into
ashhart:mainfrom
laudney:dsv41-split-rows-plan-fix
Closed

laudney wants to merge 1 commit into
ashhart:mainfrom
laudney:dsv41-split-rows-plan-fix

Conversation

@laudney

@laudney laudney commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Prefill segments of 18..32 rows wrote past the spare streams buffer; the plan now sizes it for them.

main (e7e2424) this PR
w.x<1 - cur> (spare streams) in the prefill plan sized by the 2,048-, 17- and 16-row programs: 17 rows also by the 32-row program: 32 rows
Prefill segment of 18..32 rows (out-of-place split_rows boundary) writes rows 17..31 past the buffer into the next arena role stays inside its role
World 4, prompts of 19..32 tokens (seen on DeepSeek-V4.1-Flash, #3527) row 17 became 2.6e38 after the first ffn site; replies were BOS tokens correct replies for prompts of 8..186 tokens

What this changes

block_prefill_mhc.site writes a boundary of at most split_rows (32) rows out of place into the spare streams buffer. planPrograms planned prefill programs at 2,048, 17 and 16 rows only, and the 2,048-row program never takes the out-of-place path, so the spare was sized for 17 rows. The plan now also emits the 32-row program; with rows <= 17 the planned set is the same as before.

Checks on this head

  • Head commit: 1bb4122
  • Lean checker on base and head: 337 and 337, 0 new.
  • Tests run: zig build test-dsv41-forward test-dsv41-cuda-host 582/583 passed, 1 skipped. The new test "prefill plan: segments of 18..32 rows write the spare streams within the planned roles" fails without the fix (w.x1: need 737280, planned 696320) and passes with it.
  • CI: pending on this head.
  • Not run: an EXL3 checkpoint at world 4 (no EXL3 pack on the test machines); the fix was found and checked on the release checkpoint of DeepSeek-V4.1-Flash release weights (FP8 + MXFP4) on CUDA at world 4 on four GB10s #3527.

Receipt

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Drafts and concurrency: measured equal on the DeepSeek-V4.1-Flash release weights (FP8 + MXFP4) on CUDA at world 4 on four GB10s #3527 stack. Resume: not run, sessions are off at 4 slots.)
  • No precision traded for speed.
  • Decode and prompt processing are no slower than main.

A prefill boundary of at most split_rows (32) rows writes the new
streams out of place into the spare buffer, but the plan sized
prefill roles only from 2,048-, 17- and 16-row programs, and the
2,048-row one never uses the spare. Segments of 18 to 32 rows wrote
past the 17-row spare into the next arena role: at world 4 a 23-row
segment turned row 17 into 2.6e38 after the first ffn site and the
reply into BOS tokens. The plan now also takes the 32-row program;
a test checks every role of 18- to 32-row segments fits the plan.
@ashhart

ashhart commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Thanks @laudney, that is a clean catch. The out of place boundary writing up to 32 rows into a buffer planned for 17 explains the BOS replies on #3527 exactly, the one extra planned program is the smallest fix that covers it, and with 17 rows or fewer the planned set is unchanged so nothing that worked moves. The new test failing on the planned size before the fix and passing after is the right shape of proof.

CI is still pending on the head, so this waits on that rather than on you. #3388 plans the same 32-row program for the one-slot case in #3366, so we will land one of the two and fold the other's test into it, with credit to both. We will run the device cell ourselves: DeepSeek V4.1 Flash on a GB10 at world 4, prompts of 8 to 186 tokens, branch against main, correct replies where main gave BOS and hashes equal where main already served them right.

  • Synthena

ashhart added a commit to sx4im/TensorFold that referenced this pull request Nov 17, 2026
… replay (ashhart#3366)

Every segment from 17 to 33 rows, at starts 0, 2,048 and 65,536, in full mode and in replay's encoder, must find
the second streams buffer (w.x1) planned for its rows. On main 25de9d7 it fails at 18, 24 and 32 rows
(w.x1 needs 737,280, 983,040 and 1,310,720 bytes against 696,320 planned) and passes with the 32-row program
planned; 17 and 33 pass either way. The sweep is @laudney's test from ashhart#3529, widened to both edges and to replay.

Co-authored-by: laudney <[email protected]>
@ashhart

ashhart commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Thanks @laudney, and for finding this at world 4.

Your fix and #3388 plan exactly the same buffers on current main: we compared every role's size at 32, 48 and 2,048 rows, in full and replay mode, and they match. #3388 came first with the #3366 claim and the pair receipts, so it is the one that lands. Your sweep test goes onto it as a commit with your co-author credit, widened to 17 and 33 rows and to replay's encoder. On main it fails at 18, 24 and 32 rows, and with the fix it passes.

We will close this one when #3388 lands. Once that happens, the #3527 stack can drop this commit and take the fix from main.

  • Synthena

ashhart added a commit to sx4im/TensorFold that referenced this pull request Nov 17, 2026
… replay (ashhart#3366)

Every segment from 17 to 33 rows, at starts 0, 2,048 and 65,536, in full mode and in replay's encoder, must find
the second streams buffer (w.x1) planned for its rows. On main 25de9d7 it fails at 18, 24 and 32 rows
(w.x1 needs 737,280, 983,040 and 1,310,720 bytes against 696,320 planned) and passes with the 32-row program
planned; 17 and 33 pass either way. The sweep is @laudney's test from ashhart#3529, widened to both edges and to replay.

Co-authored-by: laudney <[email protected]>
ashhart added a commit to sx4im/TensorFold that referenced this pull request Nov 17, 2026
… replay (ashhart#3366)

Every segment from 17 to 33 rows, at starts 0, 2,048 and 65,536, in full mode and in replay's encoder, must find
the second streams buffer (w.x1) planned for its rows. On main 25de9d7 it fails at 18, 24 and 32 rows
(w.x1 needs 737,280, 983,040 and 1,310,720 bytes against 696,320 planned) and passes with the 32-row program
planned; 17 and 33 pass either way. The sweep is @laudney's test from ashhart#3529, widened to both edges and to replay.

Co-authored-by: laudney <[email protected]>
ashhart added a commit that referenced this pull request Nov 17, 2026
… replay (#3366)

Every segment from 17 to 33 rows, at starts 0, 2,048 and 65,536, in full mode and in replay's encoder, must find
the second streams buffer (w.x1) planned for its rows. On main 25de9d7 it fails at 18, 24 and 32 rows
(w.x1 needs 737,280, 983,040 and 1,310,720 bytes against 696,320 planned) and passes with the 32-row program
planned; 17 and 33 pass either way. The sweep is @laudney's test from #3529, widened to both edges and to replay.

Co-authored-by: laudney <[email protected]>
@ashhart

ashhart commented Nov 17, 2026

Copy link
Copy Markdown
Owner

#3388 has landed with the same plan and your sweep test on top of it, with your co-author credit, so this one closes as we said. Thank you @laudney. The #3527 stack can now drop this commit and take the fix from main.

  • Synthena

@ashhart ashhart closed this Nov 17, 2026
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