Repository navigation
qwen3_5 cuda: TF_QWEN35_CHUNK_SOLO=8192, solo prompt passes for Qwen 3.5/3.6/3.8 - #3294
Conversation
|
Thanks @jschmied. The retained cache grid and short-tail guard look sound; 67 host checks and the native CUDA compilation pass. One small fix remains: the engine module reaches 601 lines on current main, adding a lean finding. Please bring it within 600 lines. After that, we will run the device check on our side for the wider passes and concurrent decoding.
|
|
Done in |
|
Thanks @jschmied. The comment-only fix brings cuda_engine.zig to 600 lines, and the 67 focused host checks pass with zero new lean findings. No code asks remain. We will run the device check on our side for the wider solo passes, short tails, resumed turns and concurrent decoding.
|
|
Our GB10 check is in: Qwen3.8-27B, main against 3f13808, fresh launches base, new, new, base, with the prompt sizes from 2K to 64K, the context sweep (which covers resumed turns and concurrent decoding) and chat.
Nothing more is needed from you. It's queued to land.
|
|
@jschmied, a correction to my note this morning. The device check is still GREEN, but this head can't land yet: its own CI zig job fails, and a re-run on the same head fails the same way. Four Qwen 3.5 host tests abort, among them The new
|
|
@ashhart Fixed in d3d74d7. The default alone didn't help: those fixtures build |
|
Thanks @jschmied for the quick fix, and for checking that a field default wouldn't reach fixtures built as Our last ask (15 Nov) was: "A default of Here's what we checked on
On exactness, which is a hard rule for us now (changing chunk cuts must not change a single token), here is how the PR proves it, so it's on record:
That leaves one item before this goes back in the landing queue:
One optional cleanup: the comment
|
|
@ashhart CI at d3d74d7: zig fails, zig-windows, pytest and fmt pass. The zig failure is the same panic in a fixture this branch doesn't have: the CI job tests the merge with main, and main's d8d0b4e added The fix needs main's file, so it needs a rebase. It's ready locally: rebased onto 811c384 (clean apply), plus that one fixture line and your |
|
@jschmied, to your question: yes - the fixture fix is in the head we reviewed. Every fixture in the three host The series as supplied does not apply to today's main: besides the two environment tables, where main gained The change itself is done and checked: your device receipt on the GB10 pair shows tokens identical in every row
|
|
Thanks @jschmied. One update before you push the rebase. Main has moved past
Main's newer fixtures that build the engine from
|
d3d74d7 to
d8b9779
Compare
|
Thanks @ashhart. Rebased onto main
Planted controls (both went red, then green on the head):
The GB10 check you asked for (main
Details and the CI runs are in the body. |
|
Thank you @jschmied. The scratch rows now follow the solo count with the variable unset, warm passes keep the grid chunk, and the yield test uses grid_rows with planted controls. The GB10 equality, memory and resume numbers cover the exactness concern. The reviewed head d8b9779 merges cleanly with current main and its CI is green. We will run our GB10 device check on our side and post the result here. Nothing else is needed from you.
|
d8b9779 to
dbb4864
Compare
…es two grid chunks while no other stream decodes Unset, nothing changes: the cold pass cuts every 4096 rows (grid_rows), and the scratch, the INT8 workspace, the tap rings and the EXL3 grouped storage keep main's sizes. Set to 8192, a text pass with no cap, no yield check and no other stream decoding merges whole cold chunks of 2048 rows or more up to 8192 rows; kept marks and request chunk starts keep their cuts, so a kept state lands where a cold pass cuts. Row limits after the scratch-at-load change (23c91fa): - Engine.scratch_rows = cuda_solo.scratchRows(solo rows, context): main's @max(32, @min(4096, context)) unset. The scratch growth ceiling (cuda_scratch growthCapacity, mainGrowthCeiling) and the host-embedding count (cuda_host_embed) read scratch_rows; Round.max_rows (8192) is only the forward's absolute bound. - tap ring and EXL3 grouped storage: cuda_solo.passRows, @max(grid_rows, scratch_rows), 4096 unset. - a pass with a yield check (a warm pass, f12978f) keeps the 4096-row chunk, so a request waits one chunk at most (147db1b, 265b6da). - a pipeline stage refuses a solo value (QwenSoloStage) and keeps its 4096-row boundary.
dbb4864 to
1898565
Compare
|
Thank you @jschmied. 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. |
Head:
d8b9779c71(one commit) on mainaf9777b494. This rebases past the scratch-at-load (23c91fa596), warm-pass (f12978f080) and yield (147db1b6b3,265b6da6a8) changes, per review 6966472610. Ledger row 20 (solo chunks), q3.5 cell, #1554 option C.When the variable is set to 8192 and no other stream is decoding, a foreground Qwen prompt pass takes up to 8,192 rows. Once another stream decodes, it goes back to the 4,096-row grid chunk. A background (warm) pass with a yield check always keeps the grid chunk.
The rule is the shared one,
core/lanes/solo_chunk.zig(Limits,rows,read). It is the same rule Gemma 4 (#2391), Flash Next (#1733) and GLM (#1823) use.When the variable is unset, nothing changes: the replies are the same as main's, and so is the memory.
What changes
Core: nothing new.
solo_chunk.rowsandsolo_chunk.readread the variable.platform/environment.ziggains aTF_QWEN35_CHUNK_SOLOrow (.size, scope.cuda), with test rows inenvironment_test.zigand a line indocs/environment.md.qwen3_5 CUDA only:
Row counts:
grid_rows= 4096. It keeps every cut-related meaning: cold cuts, kept states and resumes, the pages' window, readout pieces, stage shapes and the disk probe.max_rows= 8192 is only the forward's absolute bound: host tables, the round staging layout and the pocket row scales.Engine.scratch_rows(cuda_engine.zig:221) =cuda_solo.scratchRows(solo rows, context)=@max(32, @min(solo, context)). Unset, that is main's@max(32, @min(4096, context)). The separateprompt_rowsof the last round is folded into it.cuda_scratch.zig:90,:95) and the host-embedding count (cuda_host_embed.zig:41) readscratch_rows. The tap rings (tapRows()= 2048 +passRows) and the EXL3 grouped storage readcuda_solo.passRows=@max(grid_rows, scratch_rows), which is 4096 unset.cuda_prefill.soloEnd: an uncapped text pass merges consecutive cold chunks while all of these hold:stream.yield_check == null,cuda_prefill.zig:296), so a warm pass keeps the grid chunk;cuda_solo.othersDecode: a stream with a cache and no fill);solo_min_rows= 2048 rows;Images,
--decode-sharecaps and short chunks (a tail, a request start's chunk, a capped step's rest under 2048) take the same cuts as main.Refusals by name, at load, before any device memory:
error.BadChunkSolo, for any value other than unset, empty, 4096 or 8192;error.QwenSoloStage, for 8192 on a pipeline stage.Both have messages in
cuda_native_explain.zig.Why there is a floor of 2048 rows: in an early version, every cold chunk merged, and that moved a 27B reply. On a 12,300-token prompt, main ends with a 12-row tail, which runs the projections' small-row tiles. The merged pass ran those rows on the large tiles instead. A chunk under 2048 rows now runs alone, as on main. Round 2's tails table covered 12 to 4,000 rows on both models; 64 of 64 were equal.
Metal and HIP: none (this is a CUDA prompt-pass knob).
Evidence on this head (GB10 sm_121, clock cap 2300, page cache dropped before every server start)
Binaries: main
af9777b494md5d12ac7a3, headd8b9779c71md588c67ba9. The arm order is main, off, on, on, off, main. Off is the head with the variable unset; on is the head withTF_QWEN35_CHUNK_SOLO=8192. Each arm runs on a fresh server with--parallel 8 --context 40960, drafting on (DFlash2 for the 27B, MTP for the 35B-A3B).Exactness (on == off == main):
849a6512a4d75e46in all three arms; there are 0 empty replies.a0d16cd7e9f77b2cin all three arms, with 0 empty.Memory (the load line, with
--parallel 8 --context 40960):MemAvailable after load: 27B 74.2–74.3 GB on main, 74.1–74.3 off, 72.0–72.1 on. 35B: 94.1–94.3 main, 94.2–94.3 off, 93.4–93.5 on.
Resumed == fresh (
/v1/chat/completions, 2 chats × 3 turns of about 12.2K tokens,--prompt-cache-gib 8): 6 of 6 in every arm on both models. The resume is real: the later turns reportcached_tokens8192, 8192, 8192 and 12288 in every arm, and on the 27B their first token comes in 0.2–3.6 s instead of about 10 s. Round 3's first run had sent the chats as raw/v1/completionsprompts, which keep no history mark, socached_tokenswas 0 and resumed == fresh tested nothing. The harness now uses the chat API and fails a run whose later turns cache nothing.Cold first token, alone (each prompt paired with the mean of main-0 and main-5; 2 greedy prompts and 1 seeded per size):
Off is −0.1 to +0.4 % (at most 24 ms). That is inside main's own spread between its two runs: main-0 vs main-5 has a median of 0.31 % on the 27B and 0.27 % on the 35B, and a maximum of 0.75 %. Off runs main's cuts: the solo branch needs
scratch_rows>grid_rows(cuda_prefill.zig:296), which is never true unset.Concurrency (wall time vs main):
Planted controls (
~/notes/ledger/q35solo/tools/controls.sh); each went red, and the head is green:max_rows(cuda_solo.zig:27,@min(@max(solo, max_rows), context)) failscuda_solo.zig:84("unset: scratch, pass and tap rows equal main's at every context").cuda_prefill.zig:296) failscuda_prefill.zig:48("… on the grid chunk though solo").Refusals:
cuda_solo.zig:47refuses by name0,off,false,no,on,yes,2," 0",1,2048,4097,6144,12288,16384,-1,8k,0x2000and8192x, and checks the message.:57refuses 8192 on a pipeline stage. Both fire inEngine.init(cuda_engine.zig:221) before any device allocation. Round 2's served refusal run (runs/refuse.log) still applies.Checks on this head:
q35solo-x86-r3b, umask 022):zig build -Dfixed-cpu test-host2141/2141 steps;check-native-cuda-host compile-cuda-tests16/16;-Dfixed-cpu test706/706;test-golden test-kernel-contract test-qwen-serving-host test-server-security test-pull-security fuzz-cortheon check-release-paths67/67 (goldens 322/335 with 0 unexpected);tools/pr_check.pylean 221 vs 221, 0 new, 0 errors (its one warning is the Unreleased bullet, proposed below);zig fmt --check,git diff --check: all green.zig build test-cuda-hostplus the five qwen35 host steps, 425/425 (on32123a1790, which differs from this head only in three comments and one test fixture).Overlap
These open PRs touch the same files:
cuda_prefill.zig.cuda_native.zig.cuda_cache.zig.cuda_prefill.zig,cuda_native.zigandqwen35_formats_host.zig.Every conflict is textual. No other open PR does solo chunks for Qwen.
Proposed CHANGELOG line (not committed)
TF_QWEN35_CHUNK_SOLO=8192lets a foreground prompt pass take up to 8,192 rows while no other stream decodes. It falls back to the usual 4,096 once one does, and in background warm passes. On a GB10, a cold prompt's first token comes 3.6–5.8 % sooner on Qwen3.6-35B-A3B and 0.9–1.6 % sooner on Qwen3.8-27B NVFP4, at 8K–16K tokens, with the same replies. The prompt scratch and each stream's tap ring grow with it (about 0.5–0.6 GiB of model memory, and 0.2 GiB per stream on the 27B). Unset, nothing changes. It uses the shared solo-chunk rule (gemma4 cuda: TF_GEMMA4_CHUNK_SOLO, on a solo-chunk rule shared in lanes (#1554 option C) #2391).Earlier rounds:
d3d74d7df(round 2, on main223da7659b) and its evidence are in this PR's history.