Repository navigation
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
Conversation
|
Three-round A-B-B-A on
Reply hashes were equal in every arm, solo and c=4. The one-round loss doesn't repeat: no cell is consistently slower, so the "don't land yet" in the body is withdrawn. 12 runs in all. |
3e0e9bc to
f790014
Compare
|
sm_120 contract run on RTX 5060 Ti (independent of GB10), head fb55ed4.
No gate failures on sm_120; the limit diffs look like record-staleness on this arch rather than regressions, same pattern as #4697/#4718. |
aefb063 to
c41911e
Compare
|
Sorry for the noise: this was closed automatically when #4387 landed on main and its base branch was removed. It is reopened and now targets
|
ashhart#4728 rewrites tf_ink2moe_up and tf_ink2moe_prompt_up and records their compiled usage at sm_121 only; at sm_80, sm_86, sm_89 and sm_120 the rows held zeros, so the kernel registry test failed with 8 "no compiled usage recorded" entries. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; each sm_121 entry equals the one the PR recorded. No kernel changes.
fb55ed4 to
e93ec03
Compare
ashhart#4728 rewrites tf_ink2moe_up and tf_ink2moe_prompt_up and records their compiled usage at sm_121 only; at sm_80, sm_86, sm_89 and sm_120 the rows held zeros, so the kernel registry test failed with 8 "no compiled usage recorded" entries. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; each sm_121 entry equals the one the PR recorded. No kernel changes.
ashhart#4728 rewrites tf_ink2moe_up and tf_ink2moe_prompt_up and records their compiled usage at sm_121 only; at sm_80, sm_86, sm_89 and sm_120 the rows held zeros, so the kernel registry test failed with 8 "no compiled usage recorded" entries. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; each 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, builds alternated base, new, new, base.
It's now in our landing queue.
|
…ws, the NVFP4 factor once an expert tf_ink2moe_up and tf_ink2moe_prompt_up decoded every BF16 weight with its own byte loads (code, scale) and an FP32 division (amax / denominator), so a decode token spent 96 ms in the routed experts. Each warp now stages its 32 rows' codes 128 bytes a row (8 lanes a row) and their scale bytes in shared memory, and decodes its fragments from there; the expert's factor is computed once a unit. On decode (one row) the next tile and the next step's inputs are fetched while the current step multiplies. Each weight is the same product, rounded alike, and the mma sequence is unchanged, so the bits are unchanged.
…e, K = 32 in the contract fetch read each lane's row scales as whole uint32 words, (2 steps + 3) / 4 of them for NVFP4 and one for MXFP8. The scales are unpadded, so a tile with fewer than four bytes left read past the row, and at the end of the projection past the data; at K = 32 a row's scales also start at an odd half-word, which a word load cannot read. Whole words now load only while four bytes remain and the row's start is word-aligned; the rest loads byte by byte into the same word. Mini's shapes (K 2304 and 1152) are aligned with no tail, so their path still takes whole words. The contract adds NVFP4 and MXFP8 decode cases at K = 32 (rows 1 and 16), each projection's scales in an allocation of exactly their size, so compute-sanitizer memcheck sees any byte read past them.
ashhart#4728 rewrites tf_ink2moe_up and tf_ink2moe_prompt_up and records their compiled usage at sm_121 only; at sm_80, sm_86, sm_89 and sm_120 the rows held zeros, so the kernel registry test failed with 8 "no compiled usage recorded" entries. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; each sm_121 entry equals the one the PR recorded. No kernel changes.
e93ec03 to
ba9a31d
Compare
#4728 rewrites tf_ink2moe_up and tf_ink2moe_prompt_up and records their compiled usage at sm_121 only; at sm_80, sm_86, sm_89 and sm_120 the rows held zeros, so the kernel registry test failed with 8 "no compiled usage recorded" entries. The values are nvcc 13.0's, from kernel-contract-limits over fatbins built for all five SMs from this tree; each 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 for review 7098920791: head
fb55ed477ePoint 4, the scale loads.
fetchread each lane's row scales as wholeuint32words:(2 steps + 3) / 4of them for NVFP4, one for MXFP8. Two things could go wrong:The fix (
modelopt.cu:60-89) is a bounded tail rather than a narrower guard:Mini's shapes (K 2304 and 1152) are aligned with no partial word, so their path still takes whole words.
The contract adds NVFP4 and MXFP8 decode cases at K = 32, rows 1 and 16. Each projection's scales sit in an allocation of exactly their size, so a read past them leaves the allocation.
3cd12eb55e(old kernel) fails every gate withCUDA_ERROR_MISALIGNED_ADDRESS. compute-sanitizer memcheck on that filtered synthetic test reportsInvalid __global__ read of size 4 bytes … misaligned. At K = 32 the misaligned word load is the first fault and hides the over-read behind it.kernel-contract "K = 32":ERROR SUMMARY: 0 errors..f16 = 0, .bf16 = 0with a stated reason): a 32-term sum cannot tell FP16 from FP32. The four Mini-shape specs keep their 30× requirement.Checks on
fb55ed477e(GB10):pr_check: 0 errors, lean 167 vs 167. fmt and diff-check: clean.inkling2: 55/55 pass gates 1-4, 36 of 36 controls red, 0 limit problems.3cd12eb55e(sm_80/86/89/120/121):tf_ink2moe_plan,_actand_combineare identical;tf_ink2moe_upand_prompt_updiffer, as intended. Registers are unchanged on sm_121 (168 and 198).inkling2-serving: PASS. The served binary (e083a52e) is byte-identical to the one the gates ran on.3cd12eb55e(Ae6, B this head), SM clock 2288 MHz in both arms:What this changes
Mini's routed experts (
tf_ink2moe_upfor decode,tf_ink2moe_prompt_upfor prompt chunks) decoded every BF16 weight on its own: one byte load for its code, one for its scale, the expert'samaxand denominator, and an FP32 division (amax / denominator, the NVFP4 factor) for each weight. The experts took 92.8 ms of the 181.8 ms a token on #4640's head (nsys, c=1, 60 decode forwards).This PR changes only how the weights reach the tensor cores:
Each weight is the same product rounded the same way (
e2m1 × e4m3(scale), then × the factor for NVFP4;e4m3 × e8m0for MXFP8; then BF16). The mma sequence and the epilogue are unchanged, so the outputs are bit-equal. The experts go from 92.8 ms to 14.3 ms a token.321432e4b2), baselead/inkling2-mini. One commit,3cd12eb55e. 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.modelopt.cuis Mini's own expert image; no core code, no Metal file and no other family is touched. The records file is the Inkling contract's.kernels/cuda/inkling2/modelopt.cuandinkling2_experts_records.zig(registers and shared bytes of the two changed kernels).Checks on this head (
3cd12eb55e)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.tf_ink2moe_up168 registers, 20480 static shared bytes;tf_ink2moe_prompt_up198, 20480. Neither spills.modelopt.cucompiled at base and head for sm_80/86/89/120/121 and compared function by function. The other 3 functions (tf_ink2moe_plan,_act,_combine) are identical on every SM; onlytf_ink2moe_upandtf_ink2moe_prompt_updiffer, 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 #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 gains because
tf_ink2moe_prompt_upstages its tiles the same way. nsys (c=1, 60 decode forwards): experts 92.8 → 14.3 ms a token.019c09e6(built from321432e4b2), B516459f0(built from3cd12eb55e, 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