Repository navigation
qwen3.5 metal: declare warm turns so a follow-up resumes the reply - #3457
EugeneClaw wants to merge 3 commits into
Conversation
The engine kept a prompt cache but advertised no warm turns, so the server never prefilled the next turn's rendering and a follow-up that re-renders earlier rows prefilled the whole conversation again. The capability now follows the cache's presence; the cache rules are unchanged.
|
@EugeneClaw, FIXES: two cases need covering before warm turns are enabled. The Qwen prefill loop checks cancellation but never the background-yield hook. A host test with foreground work arriving after the first 128-row chunk runs all 300 rows instead of returning The planned cache also needs The existing focused host checks and native build pass. We will run the resumed/fresh, drafted/plain and interleaved-turn device checks on our side once these are fixed.
|
… the completed prefix A warm pass ran to the end of the prompt instead of stepping aside when foreground work arrived: the loop checked cancellation but never the yield hook its background passes wire. The pass now keeps its completed prefix and returns error.Yielded at the boundary; the next pass resumes the kept mark.
A planned store kept a warm end off the grid, and under a one-snapshot budget the unusable end evicted the usable mark: the next request resumed at zero. The rules now set warm_usable, and the one-snapshot regression stays.
|
Both fixed on the branch, new commits:
Both changes are host-side — loop control and a store rule; no device code is touched. CUDA host graph compiles both clean (4123 passed / 0 failed, 14 device skips); qwen35 cache 24/24, lane api 644/644; fmt clean, lean 341 base / 341 head, 0 new. On-device runs on hardware we don't have would be appreciated. |
|
Thanks @EugeneClaw. This passed review and CI, but your fork doesn't accept our landing push, so it lands through #3662, which carries your three commits unchanged under your authorship. This PR closes when #3662 lands. Nothing more is needed from you.
|
|
Your three commits are on main now through #3662 (landed 17 Nov), unchanged and under your name, so I'm closing this one. Thank you @EugeneClaw for the yield-hook fix and the host tests behind it.
|
What this changes
Bug fix: the Qwen3.5-2B Metal engine kept a prompt cache but advertised no
warm_turns, so theserver never prefilled the next turn's rendering; a follow-up that re-renders earlier rows (the
template renders an earlier assistant's reasoning only after the last user message) prefilled the
whole conversation again. The engine now sets
warm_turnsfrom its cache's presence; the cacherules are unchanged.
5c82ef28a).atc overlap --json(baseashhart/main): 3 changed files; Living Weights: slide-forget counting only with --slide-forget, Metal's mask shift for wide pockets (#678) #2026 and Prefill on a GB10, decode on a Mac: long prompts for Qwen3.8-27B handed over ConnectX (#1594, step 2b) #2648 sharelane_host.zig, both clean. The tool reported its own limits (otherPullRequestsLimit,pullFilesUnavailable,pullRequestsLimit,timeLimit), so environment: Metal Qwen paging, slot resume and slide checks refused by name (#2370) #3018 and logit_bias: token biases and -100 bans on each row's draw for Qwen CUDA, Qwen3.5-2B Metal and Nemotron Parse HIP #3146 — which changeqwen35.zigin other functions — were checked from their file lists.Why the rules are unchanged: on a planned store a state resumes only at the resuming request's
chunk starts, so a kept end at the raw prompt length is never resumable.
warm = .onwould keep adead state and drop a history mark on ordinary requests; the declaration alone resumes the same
mark.
Files:
zig/src/core/lane_host.zig(+6),zig/src/core/lane_host_warm_test.zig(+11),zig/src/native/qwen35.zig(1 changed line).Checks on this head
fdd604316zig fmt --checkandgit diff --checkclean.zig build test-cuda-host test-env-defaults-host test-flashnext-constraint-host, head then base:12 failing test binaries on each, same steps. This host has no CUDA device, no xgrammar and no
tokenizer directories. No new failures.
build.zigbuilds on linux and windows as wellas macOS, so CI runs it; it needs no device, and an unconditional
warm_turnsfails it.zig build nativebuilds.from @Whq02. Also CUDA, HIP, Windows devices, 4-stream and 64k-context chats.
Receipt
macOS 27.0.1, M4 Pro 20-core GPU, 48 GiB, Zig 0.17.0,
mlx-community/Qwen3.5-2B-MLX-4bitrev93760be4f1f69842a46bc13dbdc0f19e291392a3,--context 65536 --prompt-cache-gib 1, greedy,thinking on. Timings:
prefill_secondsfrom the response for the first two rows, the engine'sttft=log field for the last two.second.json: cached / prefillReply hashes equal main on the pair, the five-turn chat, and two conversations run alone and
together. Cache totals identical on both arms (29 states, 1001 MiB, 1 evicted); the re-render
shape adds one 44 MiB state per reply on the branch, no evictions at 1 GiB. Eleven malformed and
out-of-range requests return main's status codes; the server stays up.
Checklist
No AI attribution lines.
off.
"draft": false, a resumed prompt equals a fresh one, and concurrentequals solo.
--drafter, no slower than without it, greedy and sampled — one stream measured; widestadmitted and
--drafternot run.