Repository navigation
inkling2 cuda: Mini logprob rows (first_row and verify rows) through the shared row kernel - #5210
Conversation
|
Thanks for the slice and the clean exactness story. What it is: Inkling 2 Mini on CUDA currently refuses This is not on main: Two notes for review, both ours to handle:
Status: ready for our review and device run. The run needs one GB10 (sm_121) with Inkling-2-Mini, a
|
|
Thanks. I won't rebase; the On the bf16 copy: every row is computed from the bf16 buffer the token's draw reads, on the same stream, before the next lane's draw can overwrite it.
The serving case's host reference rounds with the same round-to-nearest-even as the draws' copy (the Marking ready for review. |
|
One gap to know about before the device run: with I have the fix ready but have not pushed it, since you rebase at pickup: one field on Mini's opened drafter, one line in the wrapper (the same line open #2475 adds, so the two merge in either order), and a host test that fails without it. On a GB10 against main |
fcb2da5 to
3f6c580
Compare
|
READY to land on this head. Tokens unchanged: the logprob rows read the same bf16 copy of the logits the sampled draw reads, the draw path is untouched, and the device test compares rows with the host over the same logits. Our rebase kept both test pairs in the CUDA serving tests.
|
…the shared row kernel Mini on CUDA gave no logprob rows, so the server refused logprobs for it. The first token's row and each verify row now come from cuda.sample's logprobRows over the bf16 copy of the forward's fp32 logits that a sampled draw reads (a greedy lane makes that copy only when a row is asked for); a round's rows go through one words buffer and one download. Draws are unchanged. The serving test checks both rows against the host's rows over the same logits, greedy and sampled.
3f6c580 to
bd198d3
Compare
|
Thank you @jmpijll. 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: Inkling 2 Mini on CUDA gives no logprob rows (
first_rowis null), sonative/cuda.zigreportslogprobs = falseandlogprobs/top_logprobsrequests are refused for it. After: the first token's row and each verify row come fromcuda.sample.Draws.logprobRowsover the bf16 copy of the forward's fp32 logits that a sampled draw reads (a greedy lane makes that copy only for a round that asks for rows); a round's rows share one words buffer (round_rows×lanes.logprob.words) and one download. The drawn tokens do not change: the draw path is untouched and the row kernel only reads.3c088d969; one commit.atc overlap --json: not run, since I don't use ATC. Instead, a read-only check of the 389 open PRs on this base (their file lists, thengit merge-treeof main and of this head against each PR that lists one of the two files): Inkling 2 Mini: one shared per-head kept-state walk (CUDA uses it) and a shared DSpark lane host with one tokenBytes #4724 meets this change at the end ofrunintests/cuda/inkling2_serving_tests.zig(both append a case call and itscheck.passline; whichever lands second keeps both pairs). inkling2 cuda: serve Mini from a stock EXL3 pack (stacked on #4841) #4966 edits two other lines ofloop_backend.zigand merges with this head cleanly in both files. The rest carry copies from before main's current versions (H3 video and audio: native Zig VAE decoders and one-run re-voice #5194 carries inkling2 cuda: Mini streams share one forward, each slot's convs and attention alone #4786's commits from before it merged; 18 Metal PRs from Inkling 2 Mini on Metal: experts, gates, router, depth mix, combine, row batching, attention chunks and a concurrent forward (1,159 to 14 ms a row on M5 Ultra) #4448 to Inkling 2 Mini on Metal: the snapshot and the DSpark drafter move onto #4724's shared kept-state walk and lane host (same replies, kept states 40 % smaller) #4749 add both files and already conflict with main there); a rebase on main removes those overlaps.Checks on this head
fcb2da5caon main3c088d969(the same tree as123d7568f, which every check and receipt line below ran).python3 tools/zig/lean_check.pyon the base and on this head, compared withpython3 tools/zig/lean_new.py: 123 and 123, 0 new.zig fmt --check build.zig zigandgit diff --checkclean.python3 tools/pr_check.py --base origin/main: 0 errors; 4 advisory warnings (three inherited import cycles, and the Unreleased line, which needs the PR number).zig build -Dfixed-cpu test test-golden: 924/924 steps, 13,647/13,756 tests passed (109 skipped). On one GB10,tf-cuda-test inkling2-serving MODEL IDS(4,400 ids) with the new case "logprob rows equal the host's over the same logits; tokens unchanged": 7/7 PASS (host reference, fresh/resumed, cross-prompt resume, admission, 4-slot concurrent == solo, copy rollback, logprob rows).FAIL inkling2-serving: LogprobsUnsupported(exit 1).Receipt
firstandverifywindows; the server's logprob path only when a request asks forlogprobs.3c088d969against this branch on it; Zig 0.17.0; nvcc 13.3 (NVIDIA PyTorch 26.07 container,-Dsm=121); one NVIDIA GB10 (sm_121, 128 GB unified memory), driver 580.178.04, Linux (DGX OS, kernel 7.0.0-1025-nvidia, aarch64);thinkingmachines/Inkling-2-Mini@ed40e7da(target shard SHA-25665e60f51aa1284d4fb022584908c315270334d991828bb774af60584523539d1); no drafter (main's CUDA Mini has none);--parallel 4 --context 32768 --prompt-cache-gib 0.firstwithlogprobs,verifywindows with rows, greedy and seeded sampled; CUDA sm_121 run, other CUDA SMs not run.tools/bench_concurrent.py --levels 1,4 --alone --serial --tokens 256 --reps 3 --temperatures 1.0,0on both: every cell's concurrent replies equal their alone runs (3/3 at one stream, 12/12 at four) and the alone runs equal"draft": false, on main and on the branch; all 540token_sha256/token_sha/output_sha256values equal between main and the branch. Alogprobsrequest's token ids (return_token_ids) equal the same request without it, greedy and seeded T 1.0: 24-token completions withlogprobs: 5(24 rows of 5) and chat withtop_logprobs: 3(110 and 138 ids; 7 and 27 answer rows of 3); the ids withoutlogprobsequal main's. Main answers 400 "logprobs are not supported by this model or backend". The serving case checks the rows' ids against the host's top-k over the same bf16-rounded logits and their values within 1e-3.tools/bench_openai.py --tokens 256 --reps 3 --temperatures 0(median of 3), runs alternated main, branch, main, branch:fibonacci-raw25.63, 25.33 against 25.40, 25.44 tok/s;gpu-chat-no-think25.98, 25.75 against 25.86, 25.88. Main's two runs differ by 1.2%, more than main and the branch do.bench_concurrent(3 reps; one-stream cells: per-stream decode tok/s; four-stream cells: aggregate tok/s), main -> branch, one pass over every cell: code T 1.0 25.6 -> 25.4 and 57.3 -> 56.1; chat T 1.0 25.8 -> 25.7 and 61.2 -> 61.2; code greedy 25.4 -> 25.3 and 77.2 -> 77.2; chat greedy 25.8 -> 25.8 and 79.8 -> 79.8. The T 1.0 cells were then rerun with a fresh server each in the order main, branch, main, branch (--levels 4, then--levels 1,--tokens 256 --reps 3 --temperatures 1.0; medians of three reps): code four streams 57.49, 57.27, 57.20, 57.16; chat four streams 61.51, 61.19, 61.27, 61.17; code one stream 25.49, 25.35, 25.43, 25.32; chat one stream 25.80, 25.70, 25.75, 25.69. At four streams the branch is 0.2% below main (median of six reps each), less than main's own difference between its two runs (0.5% code, 0.4% chat), so the first pass's 2.1% did not repeat; at one stream it is 0.1 tok/s (0.4%) lower in both pairs, more than main's 0.2% between its runs. Every token hash is equal across the four runs. Requests withoutlogprobsrun the same kernels as on main: the branch adds arows.lentest a window and allocates the words buffer once.fibonacci-rawand 0.330, 0.334 against 0.340, 0.344 s forgpu-chat-no-think).Raw results (
decode.jsonfor the four decode runs,concurrent.jsonfor both arms, the logprob requests, the serving and control logs) can be attached.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled. (Not ticked: in the alternated rerun the four-stream cells are within main's own spread, but the one-stream T 1.0 cells are 0.1 tok/s (0.4%) lower in both pairs, with no added kernel on that path; see Receipt.)