Repository navigation
Conversation
…tart with its rows allocate trimmed a window with suffix-match grafts as a plain tree. On drafts the head holds, sanitizeTree paired the grafts' tokens with the held drafts' parents and the held count stayed, so the window claimed rows its parents did not cover; and a count inside a copied trunk left branch_from past the window's last row. It now sanitizes every draft, the held ones as placeholders, keeps the first min(held, count) of them held, and clears branch_from when the trimmed tree keeps no graft.
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.
What this changes
allocate(zig/src/core/lanes/windows.zig:206) trims a tree window (windows.zig:232) withsanitizeTree. Suffix-match grafts fromfillLanes(windows.zig:101) broke two things that trim assumed:fillLanesleaves the held drafts on the device and puts only the grafts inp.tokens(windows.zig:126), while the parents cover both.sanitizeTreepaired the grafts' tokens with the held drafts' parents andp.heldkept its count, sobuildread past the parents inrowParents(accept.zig:12).branch_from, the first graft row (windows.zig:128), past the window's rows.conclude'srows - p.branch_from(engine.zig:360) then went below zero: a panic in a safe build, and in ReleaseFast a loop on the next line over the wrapped length that does not finish.allocatenow sanitizes every draft, held ones first as placeholders, keeps the firstmin(held, count)held and the rest asp.tokens, and setsbranch_fromback to 0 for a count below it, which keeps no graft. A window with neither held drafts nor grafts, such as the 27B's host trees, comes out as before.Nothing served turns grafts on yet (the 1.0.12 notes). Only the Mac
tensorfold run ... --lanes N(orauto) setsfill_lanes(zig/src/main.zig:316); with--streams 2or more, a shared round whose allocation (engine.zig:265) cuts a grafted window of held drafts reaches the first case. A lone round allocates only a head window, and only withdraft_probabilities(engine.zig:212), which Nemotron does not set. Nemotron's Metal backend, the only onetensorfold rundrives, refuses every shared window with parents (error.SharedTreesNotBuilt, zig/src/families/nemotron/backend.zig:423), so that round now ends in that error instead of reading past the parents. No shipped configuration grafts a copied trunk, the second case. Draft #861'strimmedkeeps its own copy of the old branch, so it would need the same change.Receipt
fill_lanes9 (as--lanes 8); their replies and finish reasons must equal one stream's one-token decode, and some grafted rows must be accepted. It runs on held drafts, as the CLI's streams, and on copied ones, at most 4 rows a round so the allocator cuts into the copy.branch_from. Unlike the shared-round test, it reaches counts below the held drafts. No lanes test trimmed a grafted window before.zig test -lc -O <mode> zig/src/core/lanes/lanes.zig: 120/120 in Debug, ReleaseSafe and ReleaseFast (118/118 on the base).zig build test: 84/84 steps, 1378/1385 tests, 7 skipped (1376/1383 on the base).test-kernel-contract18/18.test-golden309/319 equal, 0 unexpected, as on the base.fuzz-cortheon7/7. Plainzig buildon Linux: 12/12 steps.tools/zig/lean_check.py: the same 517 problems as the base, exit 1 on both (the one in a touched file, windows.zig:153, is inherited).tools/zig/lean_new.pyagainst the merge base: 0 new.zig fmt --check build.zig zigandgit diff --checkpass.git checkout 46a08c18 -- zig/src/core/lanes/windows.zig), each run alone with--test-filter.branch_from4); in ReleaseFast that test was still running when a 120 s timeout stopped it.held = p.held(no cap),p.held = c,p.heldleft as it was, placeholders after the grafts, andbranch_fromleft, reset at<=, reset only beside held drafts, reset always, or reset to the count. Two other variants pass both tests: another placeholder value, which no row reads, and clearingtriedwithbranch_from. The fix keepstriedby choice, so a held window whose grafts are all cut still counts asgraft_hit's miss (stream.zig:182).zig build test test-golden -Dcpu=apple_m1(the lanes tests compile foraarch64-macoswith-mcpu apple_m1 --test-no-exec, a compile check only) and notensorfold run ... --lanes N --streams M; no GPU or model, so no Metal or CUDA run.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (No device run; see Exactness. Resumed against fresh was not run, since the change acts inside one round's allocation.)SUMMARYline is in the receipt. (n/a: no kernel changes.)