Repository navigation
inkling2 cuda: Mini decode experts a warp 8 columns, gate and up in one launch (stacked on #4728, decode +3.8 %, same bits) - #4729
Conversation
39fd949 to
e8de695
Compare
|
The three-round A-B-B-A on the round-1 head New head Checks on
No cell is consistently slower, so the "don't land yet" is withdrawn. Details are at the top of the body. |
3e0e9bc to
f790014
Compare
|
sm_120 contract run on RTX 5060 Ti (independent of GB10), head b54506c.
No gate failures on sm_120; limit diffs are record-staleness on this arch, same as the rest of the stack. |
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#4729 rewrites tf_ink2moe_up again (a warp eight output columns, gate and up in one launch) and records its compiled usage at sm_121 only, leaving zeros at sm_80, sm_86, sm_89 and sm_120 for the kernel registry test. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; the sm_121 entry equals the one the PR recorded. No kernel changes.
b54506c to
aba9fb8
Compare
ashhart#4729 rewrites tf_ink2moe_up again (a warp eight output columns, gate and up in one launch) and records its compiled usage at sm_121 only, leaving zeros at sm_80, sm_86, sm_89 and sm_120 for the kernel registry test. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; the sm_121 entry equals the one the PR recorded. No kernel changes.
|
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; builds alternated base, new, new, base.
We'll land #4728 first, then this one, then #4786.
|
ashhart#4729 rewrites tf_ink2moe_up again (a warp eight output columns, gate and up in one launch) and records its compiled usage at sm_121 only, leaving zeros at sm_80, sm_86, sm_89 and sm_120 for the kernel registry test. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; the sm_121 entry equals the one the PR recorded. No kernel changes.
aba9fb8 to
4052417
Compare
…up in one launch At decode tf_ink2moe_up ran a warp per 32 output columns over the whole K, so a layer's projections had 288 to 576 warps, about 6 an SM, and each warp's long serial stream left 70 % of the issue slots idle; the gate and up halves of w13 were two launches of 1.5 waves each. Decode warps now own one n8 tile (8 columns, kDecodeTiles), and one launch walks w13's rows in order, storing even rows to the gate and odd rows to the up buffer. Each output's mma sequence over K and its rounding are unchanged, so the bits are unchanged; prompt chunks keep 32 columns a warp and two launches.
… a tile The bounded scale loads chose word or bytes per word. A tile whose row scales are word-aligned with no partial word, every tile at Mini's shapes, now takes the whole-word loop it took before the bound, after one test; the byte path serves only the rest.
ashhart#4729 rewrites tf_ink2moe_up again (a warp eight output columns, gate and up in one launch) and records its compiled usage at sm_121 only, leaving zeros at sm_80, sm_86, sm_89 and sm_120 for the kernel registry test. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; the sm_121 entry equals the one the PR recorded. No kernel changes.
4052417 to
5555e46
Compare
#4729 rewrites tf_ink2moe_up again (a warp eight output columns, gate and up in one launch) and records its compiled usage at sm_121 only, leaving zeros at sm_80, sm_86, sm_89 and sm_120 for the kernel registry test. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; the sm_121 entry equals the one the PR recorded. No kernel changes.
|
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. |
Update: head
b54506ca73, the bounded scale loads at no costThe round-1 head
e8de695145was slower than39fd949338in a three-round A-B-B-A: c=1 0.9990 (6 of 6 pairs slower), c=4 0.9991 (5 of 6), TTFT 1.0004 (6 of 6). Its bounded scale loads chose between a word and bytes for each word.b54506ca73makes one test a tile instead. When the row's scales are word-aligned with no partial word, which is every tile at Mini's shapes, it takes the whole-word loop it took before the bound. Otherwise the byte path loads the rest.39fd949338:_plan,_actand_combineare identical on sm_80/86/89/120/121;_upand_prompt_updiffer.Checks on
b54506ca73:inkling2: 55/55, 36 of 36 controls red, 0 limit problems.kernel-contract "K = 32": 0 errors.inkling2-serving: PASS.39fd949338, SM clock 2288 MHz in both arms:No cell is consistently slower, so the "don't land yet" below is withdrawn.
Update for review 7098920791: head
e8de695145, stacked on #4728fb55ed477efetchinmodelopt.cu, where inkling2 cuda: Mini expert weights staged a warp in 128-byte rows, the NVFP4 factor once an expert (decode 5.6 to 9.8 tok/s, same bits) #4728 bounds the scale loads and this PR makes the tileTile<NT>. The resolution keeps both: the NT tile, with the bounded scale loads.kernel-contract "K = 32"runs through this PR's NT decode kernel too.Checks on
e8de695145(GB10):pr_check: 0 errors, lean 167 vs 167.inkling2: 55/55 pass gates 1-4, 36 of 36 controls red, 0 limit problems. The K = 32 cases pass shapes, nonfinite and repeat. Memcheck onkernel-contract "K = 32": 0 errors.39fd949338:_plan,_actand_combineare identical on all 5 SMs;_upand_prompt_updiffer, which is the scale-load change. Registers on sm_121 are unchanged (111 and 198), as recorded.inkling2-serving: PASS. The binary (5e79fa1d) is byte-identical to the one the gates ran on.39fd949338:What this changes
Stacked on #4728 (the expert tile staging,
3cd12eb55e), which is stacked on #4640 (321432e4b2); baselead/inkling2-mini. The diff against #4728 is one commit,39fd949338. If either merges, I'll retarget this PR.After #4728, decode's
tf_ink2moe_upstill ran one warp per 32 output columns over the whole K. A layer's three projections had 288 to 576 warps, about 6 an SM. nsys and ncu (on the contract's synthetic shapes) showed the issue slots 70 % idle. The gate and up halves of w13 were also two launches of 1.5 waves each.This PR changes two things at decode:
kDecodeTiles, 8 output columns) and stages 8 weight rows a tile. That gives four times the warps.row_step1). It stores even rows to the gate buffer and odd rows to the up buffer, so each layer makes 2 expert launches instead of 3.Each output's mma sequence over K, its weights and its BF16 rounding are unchanged, so the outputs are bit-equal. Prompt chunks keep 32 columns a warp and two launches;
tf_ink2moe_prompt_up's SASS is identical to #4728's.nsys (c=1, 60 decode forwards): experts 14.3 → 10.5 ms a token (11.3 ms with the column split alone); expert launches 144 → 96 a token.
modelopt.cuis Mini's expert image,modelopt.zigis its launcher, and the records file is the Inkling contract's (thesm_121row oftf_ink2moe_up). No shared code and no Metal file are touched.Checks on this head (
39fd949338)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; 36 controls: 36 red as planted, 0 missed; 0 limit problems.modelopt.run, so the fused decode launch is what the four Mini expert specs measure. They stay bit-equal to the kernel they replace at all their shapes.tf_ink2moe_upstay red, including "decode up projection clears the planted up-row code", which now goes through the fused launch.tf_ink2moe_up111 registers, 5120 static shared bytes (sm_121, recorded).modelopt.cuagainst inkling2 cuda: Mini expert weights staged a warp in 128-byte rows, the NVFP4 factor once an expert (decode 5.6 to 9.8 tok/s, same bits) #4728's head for sm_80/86/89/120/121: 4 of 5 functions are identical on every SM (tf_ink2moe_prompt_up,_plan,_act,_combine); onlytf_ink2moe_updiffers, as intended.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 #4728'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 = #4728's head (3cd12eb55e), B = this head.usage.0x400, the box's boot-time clock cap). No round was dropped.tf_ink2moe_prompt_up, whose SASS is unchanged. The one slower pair is 27.091 → 27.098 s (+0.03 %); the four A runs spread over 0.07 s.516459f0(built from3cd12eb55e), Be43fdeb1. B was built from17c3175e76; this head39fd949338differs from that commit only in the records file's unmeasured-SM rows, and a rebuild from39fd949338gave the sametensorfold-nativemd5. The gates above ran on B.lead/inkling2-mini, whose Mini engine main does not have.Proposed CHANGELOG line