Repository navigation
Conversation
3e0e9bc to
f790014
Compare
|
Independent sm_120 cross-check (RTX 5060 Ti, live), head
|
aefb063 to
c41911e
Compare
|
Sorry for the noise: this was closed automatically when #4387 landed on main and its branch was removed. It is reopened and now targets
|
ashhart#4786 moves each stream's window backup and history from the shared scratch into its slot. Main's stream budget (ashhart#4640) reports per stream exactly what newSlot and the lane buffers allocate, so slotAllocs now sizes all four slot allocations, newSlot and histBytes take their sizes from it, and streamBytes sums them. Without this, admission would count each extra stream short by its backup and history. The stream_bytes test still pins the report to what the allocation hook sees, and its explicit formula now includes the backup and history.
fa72a19 to
94fe2f8
Compare
|
Thank you, @jschmied. We rebased this onto main and ran a serving A/B on a GB10 with Inkling 2 Mini: main against this branch, which also carries #4728 and #4729; builds alternated base, new, new, base.
We'll land #4728 and #4729 first, then this one on top of them.
|
…attention alone loop_backend declared max_streams = 1, so four streams ran four forwards and each read all the weights. loop_round.zig runs every stream's rows in one pass: the row-wise kernels (mix, AR, gates, QKV, row dots, router, experts) once over all rows, each slot's convs and attention as its solo launches over its own rows. Each slot keeps its own window backup and history, so every stream rewinds alone. The backend verifies and keeps several windows at once and declares plain_share, max_streams and batch_rows (round_rows, 128). Every kernel gives a row the bits it gives it alone, so each stream's tokens are its solo tokens.
ashhart#4786 moves each stream's window backup and history from the shared scratch into its slot. Main's stream budget (ashhart#4640) reports per stream exactly what newSlot and the lane buffers allocate, so slotAllocs now sizes all four slot allocations, newSlot and histBytes take their sizes from it, and streamBytes sums them. Without this, admission would count each extra stream short by its backup and history. The stream_bytes test still pins the report to what the allocation hook sees, and its explicit formula now includes the backup and history.
94fe2f8 to
a8ec28b
Compare
|
I checked the Inkling host gates on a clean trial merge of zig build test-inkling2-host test-inkling2-cuda-host check-native-cuda-host -Dfixed-cpu --summary allOn the M5 Max, all 18 build steps succeeded. The host suites passed 88 tests with four skips, and the native CUDA adapter cross-compiled for Igor Lessio - AIFLOW LABS |
What this changes
Stacked on #4729 (
b54506ca73), which is stacked on #4728 (fb55ed477e) and #4640 (321432e4b2). Baselead/inkling2-mini. The diff against #4729 is one commit,fa72a19532. If any of those merge, I'll retarget this PR.One interaction with #4640's review fix (
a28a170bb7, stream_bytes), which is not under this branch: each slot now owns its window backup and history, soslotAllocshas to count them too. In my local merge of the two,slotAllocsreturns four sizes (cache, rewind sites, backup, history),newSlotallocates the four, and the stream_bytes test pins 25,087,496 bytes past the cache on Mini (48·4·32 + 48·3·6656·4 + 48·16·6656·4 + 200,058·4 + 32). I'll push that here once #4640 lands.#4640 gave each served stream its own model slot, but
loop_backendstill declared.max_streams = 1. Four streams therefore ran four forwards, and each forward read all of the weights (~5.3 GB a token). That is why c=4 aggregate ≈ c=1 on #4640 and on every PR above it: 5.57 vs 5.63 tok/s on #4640, and 27.7 vs 28.1 tok/s on the merged speed stack.This PR runs every stream's rows in one forward:
loop_round.zig(new):forward(chains). Each chain is one stream's{slot, p0, tokens}.loop_engine.zig.Model.forward(one slot) is now one chain of it, so prompt chunks and single windows run the same code. Each slot gets its own window backup and history, so every stream rewinds alone.recordedis now per slot.loop_backend.zig.verifyandkeeptake several windows: one forward, then each stream's draws and rewind. The facts declare.plain_share = true,.max_streams = max_slotsand.batch_rows = round_rows(128).The file moves 157 lines out of
loop_engine.zig(594 → 437 lines).Why every stream keeps its solo bits. No kernel changes. Each kernel the shared forward runs over all rows gives a row the same bits whatever other rows run with it:
tf_ink2_mix(rows ≤16) andtf_ink2_mix_rows(>16)tf_ink2_loop_project_qkvtf_ink2_rowdotandtf_ink2_rowdot_tilesrowdot_tilesis documented as givingrowdot's bitsround_bf16, top1The per-slot pieces (convs, attention, rewind history, draws) keep their solo launches. The full per-kernel list is in my notes and can go here if you want it.
families/inkling2/. No kernel, no core file and no Metal file is touched.Checks on this head (
fa72a19532)GB10 (sm_121, CUDA 13.0), Zig 0.17.0,
thinkingmachines/Inkling-2-Mini@ed40e7da.zig build test-inkling2-host test-inkling2-cuda-host compile-cuda-tests check-native-cuda-host: 24/24 steps, 86/90 tests passed (4 skipped).zig fmt --check build.zig zig: clean.git diff --check: clean.tools/pr_check.py --base b54506ca73: 0 errors, lean 167 vs 167, 0 new.tf-cuda-test kernel-contract inkling2):SUMMARY 55 kernels: 55 pass gates 1-4, 0 fail, 0 known findings; 36 controls: 36 red as planted, 0 missed; 0 limit problems. No kernel changes.tf-cuda-test inkling2-serving(your test): all 6 cases PASS. The four-slot case (concurrent greedy and seeded == solo, a fifth refused) now runs through shared forwards.--parallel 4 --context 8192, page cache dropped, default copy drafting and prompt cache on; hashes cover reasoning and content, and an empty reply fails):parity_controls.pyon the base server (the A binary of the speed rows below, md5fbd004356ce7):CONTROLS: PASS (4 prompts, seeds differ on 4)(greedy twice equal, same seed twice equal, two seeds differ, no empty reply).9b35cbd7c284 6cab4f209b56 b776a20d70d3 b00493ac337c/5b886d0faf27 454f0d516c07 0784bd565d6f e4b491588221). Again == solo 4/4 and c=4 == solo 4/4 for both.dad96525689aboth times. Turn 2 resumed == fresh:fdb1da1ad592. All as on Inkling 2 Mini on CUDA: #4387's engine loads the checkpoint, answers correctly (64/64 teacher-forced), serves --parallel streams, and resumes prompt-cache states exactly #4640.--parallel 8), 8 topics, greedy and seeded (seed 37+i), 128 tokens each. Each topic was run solo, then the first four at once, then all eight at once. c=4 == solo 4/4 and c=8 == solo 8/8 for both. The first four solo hashes are Inkling 2 Mini on CUDA: #4387's engine loads the checkpoint, answers correctly (64/64 teacher-forced), serves --parallel streams, and resumes prompt-cache states exactly #4640's.fa72a19532:loop_round.zig:140m.slot = p.slot;→m.slot = ps[0].slot;, so every stream's convs and attention run on the first stream's slot.inkling2-servingfails at the four-slot case (MiniConcurrentChangedTokens), and the eight-stream check differs in c=4 0/4 and c=8 0/8, greedy and seeded. Both are green on this head.a28a170bb7+ inkling2 cuda: split Mini's loop gate into a down half and an up half (decode 5.6 to 7.2 tok/s, same bits) #4697ed5da93076+ inkling2 cuda: Mini decode QKV a warp 32 outputs over staged 128-byte weight rows (decode 5.6 to 6.4 tok/s, same bits) #4718e2671d5830+ inkling2 cuda: Mini decode experts a warp 8 columns, gate and up in one launch (stacked on #4728, decode +3.8 %, same bits) #4729e8de695145+ this PR, with the slotAllocs merge above): served hashes equal Inkling 2 Mini on CUDA: #4387's engine loads the checkpoint, answers correctly (64/64 teacher-forced), serves --parallel streams, and resumes prompt-cache states exactly #4640's, c=4 and c=8 equal solo with 8 streams, contract 55/55 with 38/38 controls red,inkling2-serving6/6, host 88/92 (4 skipped).e8de695145tob54506ca73(modelopt.cuonly;git range-diffshows this commit unchanged). The build, host checks, gates, eight-stream check and planted fault above were rerun onfa72a19532. The speed rows below ran on the stack with inkling2 cuda: Mini decode experts a warp 8 columns, gate and up in one launch (stacked on #4728, decode +3.8 %, same bits) #4729 ate8de695145.Speed (served, full speed stack with and without this PR)
A = the merged speed stack (#4640
a28a170bb7+ #4697ed5da93076+ #4718e2671d5830+ #4729e8de695145, which carries #4728), B = the same plus this PR. Served--parallel 8 --context 8192, default copy drafting and prompt cache on, page cache dropped before each server start, a fresh server per run.usage.0x400, the box's boot-time cap). Binaries: Afbd004356ce7, B325a390a7199(md5).VERDICT c1_tok_s: FASTER (median 1.227%, floor 0.101%, B worse 0 of 5)VERDICT c4_tok_s: FASTER (median 136.216%, floor 0.16%, B worse 0 of 5)VERDICT c8_tok_s: FASTER (median 223.348%, floor 0.149%, B worse 0 of 5)VERDICT ttft_s: WITHIN NOISE (median 0.004%, floor 0.14%, B worse 2 of 5)Reply hashes were equal in every run of both arms: solo, c=4 and c=8.
lead/inkling2-mini, whose Mini engine main does not have.Proposed CHANGELOG line