Repository navigation
lanes: a stream whose next rows find no memory ends with length; the round's other streams run on - #3378
Conversation
542961f to
e05a772
Compare
e05a772 to
930d220
Compare
|
Thanks @CodingEmil. The shape is right: a backend hook before the verify, a stream that cannot cover its window finishing with Nothing more is needed from you. We'll rebase it onto current main ourselves (the earlier conflicts were changelog lists) and add one sentence to the settings documentation naming the caller that answers the hook. Then we'll check it on Metal with the KV pages setting: one stream running out mid-window beside one that runs on, comparing token hashes with and without the hook.
|
930d220 to
b7acfee
Compare
|
READY to land on this head. Rebased onto current main by us. Code review: without the backend hook the default path is unchanged, a stream whose next rows find no memory ends with length while the round's other streams run on, and the size cap and pins are respected. A Qwen 27B A/B on an M5 Ultra gave equal tokens on every row with flat speed.
|
…round's other streams run on A backend may answer Backend.grow before a verify: false means the stream's caches find no memory for the window's rows. That stream finishes with `length` and a message before the forward, and a shared round verifies the others' windows; without the hook a round runs as before. Qwen3.8-27B on Metal with TF_QWEN27_METAL_KV_PAGES=1 answers it: its slot covers the window's rows through slot_pages before the round, and a slot the pool cannot cover ends its stream instead of failing the round's. Host tests in lanes/outgrown_test.zig and native/qwen27_outgrown_test.zig (test-qwen27-outgrown-host), part of ashhart#1293.
Main trimmed qwen27_slots.zig to its 600-line cap after this branch was cut; the slot's grow hook would take it to 617. The hook moves unchanged to qwen27_grow.zig, and the backend's two vtables name it there. No line of it changes. qwen27_served.zig, a pinned serving source, now imports the outgrown host test beside main's others: re-pinned with ashhart#3378 added to its note.
b7acfee to
4666704
Compare
Main trimmed qwen27_slots.zig to its 600-line cap after this branch was cut; the slot's grow hook would take it to 617. The hook moves unchanged to qwen27_grow.zig, and the backend's two vtables name it there. No line of it changes. qwen27_served.zig, a pinned serving source, now imports the outgrown host test beside main's others: re-pinned with #3378 added to its note.
|
Thank you @CodingEmil. 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. |
What this changes
Before, a backend could only report missing memory for a stream's next rows by failing its verify. Then
core.step()failed andlane_host_end.failRoundfailed every stream in the round. With this change, a backend may answer an optionalBackend.growbefore the verify. A stream whose window finds no memory finishes withlengthand a message before the forward, and the round verifies the other streams' windows. Qwen3.8-27B on Metal withTF_QWEN27_METAL_KV_PAGES=1answers it: before the round, its slot covers the window's rows throughslot_pages, and a slot the pool cannot cover ends its stream. A backend without the hook runs exactly as before.7238ed8e9) and qwen27 metal pages: a stream promises its pages as its rows come and gives them back when it leaves #3377 (864e6f1d5), which makes a slot's pages grow as rows come. This pull request adds one commit,542961fdb.atc overlap --json(2026-11-14 17:55 UTC,ATC_READ_ONLY=1, on542961fdb): incomplete (otherPullRequestsLimit,pullFilesUnavailable,pullRequestsLimit,timeLimit). Fiveconflicts(dsv41 metal: the vision tower's kernels under the kernel contract #1721, dsv41 metal: image prompts #1722, glm cuda: TF_GLM_GRAPHS=1 replays verify windows as CUDA graphs (#1490) #2279, hip flashnext: a shared round's streams draft in one head pass a step #2696, XPU: Qwen3.8-27B attention merge with 16 subgroups per head, bit-identical #2799), each on one shared file. They are the same five qwen27 metal: M5 takes TF_QWEN27_METAL_KV_PAGES; a paged prompt chunk finds its two pages once #3180 lists, where each wasCHANGELOG.md's Unreleased list; I have not rechecked them withgit merge-treeon this head.Checks on this head
542961fdbon864e6f1d5.python3 tools/zig/lean_check.py, on the base and on this head: 341 on the base, 341 on the head, 0 new (tools/zig/lean_new.py). The 341 are inherited.zig/src/core/lanes/engine.zigstays at 600 lines: the new logic is inzig/src/core/lanes/outgrown.zig, and the engine's two verify calls go through it.qwen27_slots.grow(qwen27_slots.zig558 lines,qwen27_lanes.zig562).zig build testbuilds fromzig/src/core/lanes/lanes.zig), run on their own: base 367 passed, 1 skipped; head 370 passed, 1 skipped (the 3 new tests inoutgrown_test.zig).zig build test-qwen27-outgrown-host(new): 2/2 passed. Its test runs the lane engine with the core's fake backend, whosegrowcovers each slot throughslot_pagesover a host pool of three pages, asqwen27_slots.growdoes.lengthand its message.zig build test-qwen27 test-qwen27-reply-cache-host test-qwen27-startup-host test-lane-api-host test-lane-strand-host test-lane-halt-host test-lane-lone-host test-lane-interrupted-host test-kv-pool test-prefill-service-host test-flashnext-batch-host: 84/84 steps, 1109 passed, 2 skipped.zig build native tf-qwen27-attention-pages tf-qwen27-pages-resume -Dcpu=apple_m1: builds.zig build test test-golden -Dcpu=apple_m1 --summary all, with the GPU free: 870/870 steps succeeded, 13443 passed, 115 skipped, 0 failed. Six test steps came from the build cache (the lanes module's among them, counted in the line above), and the summary does not count their tests.tf-qwen27-attention-pages(plain and--shared-prefix) andtf-qwen27-pages-resumeon this head, on the device: PASS.zig fmt --check build.zig zigandgit diff --check: clean.python3 tools/pr_check.py: 0 errors, 1 warning (it asks for--pr NUMBERto check the Unreleased line).engine.zigand this head's hook and tests, all four new tests fail:max_newinstead of ending after 5 tokens;expected 3, found 24;asked > 0: the base never asks the hook;qwen27 outgrown:, at the cut stream's message: "a" runs to itsmax_new.zig build dev-tools: the change adds an optional vtable field with a default;test-host: no Linux machine with Zig here; CI will run it. The new host step is listed inzig/build/host_ci.zigbeside the other qwen27 host steps.Receipt
Main against branch: no timing cells planned.
qwen27_slots.growcovers the window's rows one call earlier than the verify would (the verify's owncoverthen finds them held). Every other backend runs as before:verifyas before;If you want the paged default measured, I can add a
bench_concurrent --levels 1,2 --alone --serialcell and a decode A-B-B-A against the demand-pages head on an M5 Ultra.When a stream ends this way on qwen27 with only this stack: never on its own. Each slot holds at most its window, and the pool has every slot's window (see qwen27 metal pages: a stream promises its pages as its rows come and gives them back when it leaves #3377). The
falseanswer is reached once something else holds pages of the same pool, as kept states will in Metal: KV pages from the core pool #1293 step 4. This pull request makes that case end one stream instead of the round.Boxes it reaches: every engine on the lane core, through
zig/src/core/lanes/engine.zig. Only a backend that setsgrowchanges behaviour; on main with this stack, that is Qwen3.8-27B on Metal withTF_QWEN27_METAL_KV_PAGES=1.New switch? Default, accepted values, profile row: none.
Backend.growis an optional vtable hook, null by default.Environment, with the TensorFold commit, Zig and backend toolchain, machine and GPU, checkpoint and revision:
542961fdbon864e6f1d5, Zig 0.17.0, Apple M5 Ultra, 96 GB, macOS 27.2. Host tests, the full test run and the page tools; no served checkpoint.Paths and platforms the change reaches, which I ran and which I could not:
grow:familyRound: drafts withfamily_mtp, non-pipelined engines, logprobs, grammars);familyRound;roundStreams).queue);LaneMemorypromise still requeues the request);recorder.ziganddrafted.zigwrappers, whose own vtables do not passgrowon.Exactness, from
tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: not run on a device. In the host tests, the stream that keeps running gives the same tokens as alone, both in the core test and in the qwen27 one over a host pool. A backend whose hook always holds gives the same tokens, steps and shared rounds as a backend without it.Main against this branch, same machine and checkpoint, posted before asking for a run on our machines (or why you can't): not asking for a run; see above.
Decode speed before and after, from
tools/bench_openai.py: not measured; the qwen27 cost is the window's page check one call earlier.Prompt speed before and after: n/a, the change does not reach prompt passes.
Licence of any new weights or drafter, or "n/a": n/a, none.
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 (fake backend and host pool, no device).
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: not measured on a device. Without a slot out of pages, every path runs as before.No precision traded for speed. No arithmetic changes.
Decode and prompt processing are no slower than main at one stream and the widest admitted: not measured.