Skip to content

core/deltanet: the wide prompt chain keeps up to four marks (MK[4]), each mark's state and conv window as a segment ending there leaves them - #851

Merged
ashhart merged 1 commit into
ashhart:mainfrom
jschmied:deltanet-marks
Oct 16, 2026
Merged

ashhart merged 1 commit into
ashhart:mainfrom
jschmied:deltanet-marks

Conversation

@jschmied

Copy link
Copy Markdown
Contributor

What this changes

Step 1 of #548: the shared DeltaNet prompt scan can store its recurrent state and conv window at up to four rows of a call (Flash Next's MK[4] convention), each byte-equal to what a chunk ending at that row leaves.

  • zig/kernels/metal/core/deltanet.metal: the loop of tf_delta_gdn_chain_wide moves into tf_delta_gdn_chain_wide_body<bool M>. tf_delta_gdn_chain_wide is body<false> with the same buffers 0-9 as before. The new tf_delta_gdn_chain_wide_marks (body<true>) adds buffer 10, one uint4 mark list per segment (rows of that segment, 0 unused), and buffer 11, the state at each mark; a mark stores when marks[m] == node + 1. The new tf_delta_gdn_mark_conv writes the conv window at each mark, read as tf_delta_gdn_conv_commit reads it for a keep ending at that row.
  • zig/src/core/deltanet_kernels.zig: the two kernels, MARKS = 4, and markList, which refuses marks that are not ascending, zero, past the rows, or more than four.
  • zig/tests/deltanet_marks.zig and the test-deltanet-marks step.

No caller passes marks yet, so nothing served changes. The 27B keeping its prompt-cache marks inside one call (qwen27_slots.zig) follows separately, once it can be checked on a 27B.

Receipt

  • Environment: TensorFold c7137bb3 plus this commit, native Metal engine, Apple M3 Pro (36 GB), macOS 26.7.1, Xcode 27.0 (metal 32023.921), Zig 0.17.0. No checkpoint: model-free tests.
  • Exactness: zig build test-deltanet-marks runs two segments in one call (24 rows from slot 0, 17 from slot 1; 1 key / 2 value heads, dk = dv = 128, 4 taps), with marks none, first row, last row, interior, four, and one segment only. Each mark's state equals tf_delta_gdn_chain_wide's end state, and its conv window equals tf_delta_gdn_conv_commit's, for a segment ending at that row, byte for byte: 16 marks, 0 mismatches. The marked call's outputs and end states equal the unmarked call's, and unused mark slots stay untouched.
  • Unmarked scans unchanged: the LLVM IR of every existing kernel is main's; tf_delta_gdn_chain_wide's body is the same 186 instructions (alias-scope metadata aside). tf-qwen27-synthetic, -served-check, -dflash-served-check, -lanes-check and -dflash-synthetic (the 27B's GDN shape, 16 key / 48 value heads) pass with byte-identical output on main and this branch.
  • Mutations: storing the state one row late fails the test (48 mismatches), and so does reading the conv window one row late (16).
  • Speed: none claimed; no caller passes marks, and the unmarked scan compiles to main's instructions.
  • Tests run: zig build test 162/162 steps, 1,947 of 1,955 tests passed, 8 skipped. zig fmt --check clean. lean_check.py: 527 findings, as on main.
  • Not run, and why: a real 27B (no checkpoint on this Mac): served hashes, resumed against fresh, TTFT, tf-qwen27-reuse. M1, M2, M4 and M5. CUDA (Metal only).

Checklist

  • 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. (No serving path changes.)
  • No precision traded for speed. If the bits change, the description says which sums change and why. (No bits change.)
  • Prompt processing is no slower than the last release.
  • The description says which platforms I ran, Metal M1 to M5 and CUDA, and which I could not.
  • 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. No AI attribution lines.

…each mark's state and conv window as a segment ending there leaves them

tf_delta_gdn_chain_wide_marks stores the state after each marked row, tf_delta_gdn_mark_conv the conv window conv_commit
would leave there; tf_delta_gdn_chain_wide is the same scan without marks. test-deltanet-marks checks both against
segments that end at the mark, on synthetic rows.
@ashhart
ashhart merged commit b5564a1 into ashhart:main Oct 16, 2026
4 checks passed
ashhart added a commit that referenced this pull request Oct 16, 2026
…build step)

Layout only: trailing commas and zig fmt in the Zig files, three Metal statements broken across lines; the code is unchanged.
ashhart added a commit that referenced this pull request Oct 16, 2026
@ashhart

ashhart commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Thank you, @jschmied. Keeping up to four marks in the wide prompt scan, each holding exactly the state and conv window a segment ending there would leave, is the piece prompt reuse needs before a family can resume from inside a chunk, and your synthetic check pins it mark by mark.

Your commit ships in TensorFold 1.0.12 as it is, merged in b5564a1fe, so this pull request shows as merged. One commit of ours, a582d9b5f, wraps 18 lines at 120 columns, layout only.

The marks check gave equal words for every mark set we ran (none, first, last, interior, four, and one segment) on an M3 Ultra and an M5 Ultra. No model calls the marks yet.

Posted by Ash's AI Assistant Synthena

BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
…check, build step)

Layout only: trailing commas and zig fmt in the Zig files, three Metal statements broken across lines; the code is unchanged.
BlivionIaG pushed a commit to BlivionIaG/TensorFold that referenced this pull request Oct 20, 2026
@jschmied
jschmied deleted the deltanet-marks branch October 23, 2026 21:02
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