Repository navigation
Conversation
…ke rounds while a prompt fills The prompt pass splits into an opening (restore, images) and one chunk a step on the same cut grid; cancel_prefill keeps the last landed chunk. A stream mid-fill is never promoted into slot 0, and one image prompt fills at a time.
ashhart
added a commit
that referenced
this pull request
Oct 25, 2026
Owner
|
Landed on main (94d9a6a..0941f86) with #1304, both under your authorship. Thank you! On an M3 Ultra with Qwen3.8-27B, six alternating runs of an ~8.7k-token prompt arriving while 2 streams decode: the decoding streams' longest pause went from 28.6 s (every main run) to 0.47 s (every run here). The long prompt's first token went from 28.58 s to 30.85 s (+7.9%, inside your ~10%). All replies were byte-identical. Prefill and the 1-8 stream sweep were unchanged. - Synthema, Ash's AI Assistant. |
javierbits
added a commit
to javierbits/TensorFold
that referenced
this pull request
Oct 26, 2026
…lies (ashhart#840) The ashhart#840 row (Python ashhart#248, @simon-lin88): the native parser refused --decode-share outright, while the mechanism it feeds already existed — the lane host's debt share (lane_host_fill.zig) keyed off TENSORFOLD_PREFILL_SHARE only. The flag now serves: the reply's share x sets the prompt's p to its complement (0 keeps whole prompts, the CUDA default; the env stays as the lower override and the flag wins), and it rides api.Open and api.Info to every lane host. ashhart#248's pass cap maps onto the chunk level: while a share is active and replies are decoding, a filling prompt's chunks cap at 512 rows (Share.short_rows) through prefill_step's max_rows hint, honored by the core wrappers and the family backends (qwen3_5, qwen27 metal, glm, flashnext CUDA and HIP, dory, gemma4, kolibri1); without a share or without live decoders the engines keep their own cuts. ashhart#248's row_s estimator has no native analog — the debt is owed from measured wall time, so a stand-alone step needs no calibration. Co-authored-by: simon-lin88 <[email protected]> Rebased on 3f1d669: jschmied's ashhart#1303 moved qwen27 metal's prompt fill into prefill_step chunks, so the max_rows hint re-points at qwen27_slots.prefillStep/chunk (the cap shortens a chunk; the cut grid, marks and decode spans still win), and the lane-host inits that the KV-pages admission reshaped keep the flag beside the served count.
javierbits
added a commit
to javierbits/TensorFold
that referenced
this pull request
Oct 27, 2026
…lies (ashhart#840) The ashhart#840 row (Python ashhart#248, @simon-lin88): the native parser refused --decode-share outright, while the mechanism it feeds already existed — the lane host's debt share (lane_host_fill.zig) keyed off TENSORFOLD_PREFILL_SHARE only. The flag now serves: the reply's share x sets the prompt's p to its complement (0 keeps whole prompts, the CUDA default; the env stays as the lower override and the flag wins), and it rides api.Open and api.Info to every lane host. ashhart#248's pass cap maps onto the chunk level: while a share is active and replies are decoding, a filling prompt's chunks cap at 512 rows (Share.short_rows) through prefill_step's max_rows hint, honored by the core wrappers and the family backends (qwen3_5, qwen27 metal, glm, flashnext CUDA and HIP, dory, gemma4, kolibri1); without a share or without live decoders the engines keep their own cuts. ashhart#248's row_s estimator has no native analog — the debt is owed from measured wall time, so a stand-alone step needs no calibration. Co-authored-by: simon-lin88 <[email protected]> Rebased on 3f1d669: jschmied's ashhart#1303 moved qwen27 metal's prompt fill into prefill_step chunks, so the max_rows hint re-points at qwen27_slots.prefillStep/chunk (the cap shortens a chunk; the cut grid, marks and decode spans still win), and the lane-host inits that the KV-pages admission reshaped keep the flag beside the served count.
javierbits
added a commit
to javierbits/TensorFold
that referenced
this pull request
Oct 27, 2026
…lies (ashhart#840) The ashhart#840 row (Python ashhart#248, @simon-lin88): the native parser refused --decode-share outright, while the mechanism it feeds already existed — the lane host's debt share (lane_host_fill.zig) keyed off TENSORFOLD_PREFILL_SHARE only. The flag now serves: the reply's share x sets the prompt's p to its complement (0 keeps whole prompts, the CUDA default; the env stays as the lower override and the flag wins), and it rides api.Open and api.Info to every lane host. ashhart#248's pass cap maps onto the chunk level: while a share is active and replies are decoding, a filling prompt's chunks cap at 512 rows (Share.short_rows) through prefill_step's max_rows hint, honored by the core wrappers and the family backends (qwen3_5, qwen27 metal, glm, flashnext CUDA and HIP, dory, gemma4, kolibri1); without a share or without live decoders the engines keep their own cuts. ashhart#248's row_s estimator has no native analog — the debt is owed from measured wall time, so a stand-alone step needs no calibration. Co-authored-by: simon-lin88 <[email protected]> Rebased on 3f1d669: jschmied's ashhart#1303 moved qwen27 metal's prompt fill into prefill_step chunks, so the max_rows hint re-points at qwen27_slots.prefillStep/chunk (the cap shortens a chunk; the cut grid, marks and decode spans still win), and the lane-host inits that the KV-pages admission reshaped keep the flag beside the served count.
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.
Until now the 27B's lane backend had no
prefill_step, so the lane host ran each prompt as one whole pass. Every other stream stopped until that pass ended. The prompt pass is now an opening, then one chunk per step on the same cut grid as before. The opening covers GPU-failure recovery, rope, the slot reset, the kept-state restore and the image encode. The host runs the other streams' rounds between chunks.cancel_prefillkeeps the last landed chunk's state. Whole passes (the lone driver, warm passes, the disk probe) run the opening and then all the chunks.Receipts: M3 Pro 36 GB, Qwen3.8-27B MLX 4-bit, z-lab DFlash2 drafter, against main at
faccd11c8.--parallel 4(--context 16384), and with DFlash2 at--parallel 2(8192)zig build test-Dnvcc)An 8,684-token prompt submitted while 2 streams decode (
--parallel 4,--context 16384):The decoding streams no longer stop. The long prompt pays about 10% for the rounds that now run between its chunks.
Design:
opening()andchunk()split the old loop as it was, so chunk cuts, decoded spans and prompt marks are unchanged. Inside each chunk the drafter still absorbs before the marks are taken (the order gemma4 CUDA: a stepped drafted pass keeps its mark after the drafter absorbed the chunk #1286 fixed for Gemma 4).runner.imagesis set for each chunk from the Fill, and a chunk's prompt-mark bank lives within that chunk, as before.promotenever moves a stream that is still filling into slot 0.Not covered: two image prompts filling at once on real weights. Only the logic and its requeue are tested.
Test-only setting: the stock 8 GiB margin beside the weights (
qwen27_served.zigroom()) leaves room for one 27B stream and a 53 MiB prompt cache on a 36 GB Mac. For these receipts, both main and this branch were built with the same uncommitted override setting the margin to 2 GiB, and served with--prompt-cache-gib 2 --prompt-cache-over-cap. The override is not in the branch.