Repository navigation
Conversation
b78348b to
e2671d5
Compare
3e0e9bc to
f790014
Compare
|
Independent sm_120 check on
Correctness side is fully green, including the new QKV path: |
|
Thanks, @joshuaswarren. It is the same cause as on #4697. Your nvcc 13.4.92 build reads Your 13.4 values differ from 13.0's in registers only:
The shared bytes match. On sm_121, 13.0 gives the same 86/90/103. nvcc 13.2 (cuobjdump) gives 94/92/100, so 13.2 does not match 13.4 either. A 13.4 receipt set would need your full |
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
|
e2671d5 to
3cfb977
Compare
|
Thanks @jschmied. The QKV path retains the ascending FP32 sums and final BF16 rounding in source. Its contract now compares bytes with forced tiles and includes the missing-row control. The gate dependency matches the gate PR's tree, and the five target records are filled for compiler 13.0. This looks ready for a serving comparison against current main and the gate-only version: matching token IDs and logits, including the 16/17-row boundary, and current timings. Please label the existing speed figures by revision and say which include the gate split.
|
|
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, builds alternated base, new, new, base.
It's now in our landing queue.
|
…ged in whole 128-byte reads tf_ink2_loop_project_qkv tiles 16 rows by 16 outputs, so a one-row decode left 15 of 16 threads idle and re-read its weights in 32-column slices. For up to 16 rows, tf_ink2_loop_qkv_rows1/4/16 run a warp per 32 output columns: the warp stages its 32 weight rows 64 columns at a time with whole-row 128-byte reads and the rows' inputs, and each thread runs its output's rows over the same ascending FP32 chain, so the BF16 results are tf_ink2_loop_project_qkv's. Prompt chunks keep tf_ink2_loop_project_qkv.
…places, its usage on every SM projectQkvTiles keeps tf_ink2_loop_project_qkv's 16x16-tile launch callable at any row count (prompts take it as before); the contract's ProjectQkv now names it in replaces, so gate 3 compares the decode kernels' q, k and v bytes with the tiles' on the same inputs at every served shape. The control told one row fewer stays red against the tiles. tf_ink2_loop_qkv_rows1/4/16 compiled with nvcc 13.0 -cubin -O3 per SM: 128/128/90 registers on sm_80, 128/128/88 on sm_86 and sm_89, 86/90/103 on sm_120 as on sm_121; static shared bytes and the 32-thread bound as on sm_121, no stack or spills.
3cfb977 to
1ca1330
Compare
|
I checked the landing interaction on zig build test-inkling2-host test-inkling2-cuda-host check-native-cuda-host -Dfixed-cpu -j2 --summary allOn M5 Max the resolved tree passed 96 tests with four skips and cross-compiled the ARM64 Linux CUDA adapter in the same 18-step build. The combined GPU comparison remains open. The GB10 result above was for #4718 separately. Igor Lessio - AIFLOW LABS |
Update for review 7098920791: head
e2671d5830, stacked on #4697Stacked on #4697 (
ed5da93076). The base stayslead/inkling2-mini. The two PRs conflicted incontract_inkling2_loop_math_extra.zig, so this one now carries #4697's two commits under its own two:523d872949: the QKV commit, rebased unchanged. Same 4 files, 115+/6−.e2671d5830: this round's fixes.Point 3, the comparison with the old kernel:
loop_math_cuda.projectQkvTileskeepstf_ink2_loop_project_qkv's 16×16-tile launch callable at any row count.projectQkvstill takes it for prompts (more than 16 rows).ProjectQkvnames it inreplaces. Gate 3 now compares the decode kernels' q, k and v bytes with the tiles' on the same inputs. Result:5 shapes bit-equal to the kernel it replaces.Point 2, the kernel records (nvcc 13.0,
-cubin -O3per SM; no stack or spills; static shared bytes and the 32-thread bound as on sm_121):tf_ink2_loop_qkv_rows1regstf_ink2_loop_qkv_rows4regstf_ink2_loop_qkv_rows16regsThe registry test finds 40 on this head, the base's 40. The previous head added 12.
Checks on
e2671d5830(GB10):pr_check: 0 errors, lean 167 vs 167. fmt and diff-check: clean.inkling2: 53/53, 38 of 38 controls red, 0 limit problems.b78348b927: all 8 of itsloop_mathfunctions are identical on sm_80/86/89/120/121. The 2 added functions are 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) #4697's gate halves.b78348b927's (greedy, seeded, again, c=4, long, turn 2).inkling2-serving: PASS.b78348b927. 6.425 → 8.596 tok/s, paired median 1.3375, 0 of 2 pairs slower. Most of that is 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) #4697's gate split, which this head now includes.What this changes
At decode Mini's fused QKV projection (
tf_ink2_loop_project_qkv, 48 calls a token) tiles 16 rows by 16 outputs. With one row, 15 of every 16 threads sat idle, and each weight row was read in 32-column slices scattered over thousands of rows. That ran at about 40 GB/s and cost 28.2 ms of the 181.8 ms a token on #4640's head (nsys, c=1, 60 decode forwards).For up to 16 rows (and
c % 64 == 0),projectQkvnow launchestf_ink2_loop_qkv_rows1/4/16. Each runs one warp per 32 output columns:tf_ink2_loop_project_qkv, and rounds to BF16 the same way. The results are its bits.Prompt chunks (more than 16 rows) keep
tf_ink2_loop_project_qkv, unchanged. The decode QKV goes from 28.2 ms to 5.31 ms a token (about 213 GB/s).321432e4b2), baselead/inkling2-mini. One commit,b78348b927. If 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 merges, I'll retarget this PR.inkling2_loop_mathis Mini's own image. No core code, no Metal file and no other family is touched. The records file is the Inkling contract's.contract_inkling2_loop_math_extra.zig, in the two lines that size and fill the contract's gate and QKV arrays. Whichever lands second needs a one-line merge there; it is resolved and built in my combined stack.kernels/cuda/inkling2/loop_math.cu,families/inkling2/loop_math_cuda.zig(projectQkv), the loop-math contract set and records.Checks on this head (
b78348b927)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 321432e4b2: 0 errors, lean 167 vs 167, 0 new.tf-cuda-test kernel-contract inkling2):SUMMARY 53 kernels: 53 pass gates 1-4, 0 fail, 0 known findings; 37 controls: 37 red as planted, 0 missed; 0 limit problems.3x3072x2304: role 0 row 2 output 0: ffff where bf07 is due). The spec's older aliasing control is namedcontrol: Mini split QKV ..., so theinkling2filter does not select it, 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; I named the new one underinkling2 loopso that it runs.rows186 registers, 4736 shared bytes;rows490, 5120;rows16103, 6656.loop_math.cucompiled at base and head for sm_80/86/89/120/121 and compared function by function. All 5 existing functions are identical on every SM, includingtf_ink2_loop_project_qkv; 3 functions are added.tf-cuda-test inkling2-serving(your test): all 6 cases PASS. They include host-reference token equality, fresh == resumed, cross-prompt resume, four slots greedy and seeded == solo with a fifth refused before anything is queued, and copy drafting rollback.tensorfold-native serve --parallel 4 --context 8192, page cache dropped, default copy drafting and prompt cache on; hashes cover reasoning and content, and an empty reply fails):9b35cbd7c284 6cab4f209b56 b776a20d70d3 b00493ac337c). Again == solo 4/4, four at once == solo 4/4.5b886d0faf27 454f0d516c07 0784bd565d6f e4b491588221). Again 4/4, c=4 4/4.dad96525689aboth times, 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.fdb1da1ad592, 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.Speed (A-B-B-A against #4640's head, this head's binary)
Served,
tensorfold-native serve --parallel 4 --context 8192, default copy drafting and prompt cache on, page cache dropped before each server start. Each arm is a fresh server. Order A B B A, two rounds. A = #4640's head (321432e4b2), B = this head.usage.0x400, the box's boot-time clock cap). No round was dropped.The reply hashes were equal in every arm, solo and c=4. The prompt cell is flat as expected: prompt chunks keep
tf_ink2_loop_project_qkv. nsys (c=1, 60 decode forwards): QKV 28.2 → 5.31 ms a token.019c09e6(built from321432e4b2), Bfb1a7ada(built fromb78348b927, the commit itself). The gates above ran on the same B build.lead/inkling2-mini, whose Mini engine main does not have.Proposed CHANGELOG line