Repository navigation
inkling2 metal dspark: 2-bit screened head, 4-bit NAX draft layers, and single-CB GPU sampling - #4748
cwschroeder wants to merge 32 commits into
Conversation
|
Thanks @cwschroeder. I found one bug in the Q2 screen and two gaps in its tests. The shortlist starts each slot at Seven of the non-finite probes ( The conflicts with main, the duplicate loader commit and the missing changelog credit all come from the base branch, so those are on us and you do not need to touch them. This review covers only these defects and is not a decision on the low-bit draft head, which is still open.
|
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
|
eaab893 to
7f311b9
Compare
…in the fewest 1,024-key folds a slot
…up to 32 rows is one launch
…uffers, independent launches side by side
… a row's sums never depend on its chunk
…t attention, and use mv_mma for prompt dense projections
Replace the scalar stride-2304 tf_inkling2_logits kernel with a 256-thread (8-simdgroup) batched implementation where each simdgroup computes one vocab row across up to 8 token rows, sharing coalesced bfloat4 unembed loads and preserving width-invariant FP32 reduction and BF16 softcap rounding. Update glue dispatch, contract limits record, host check, and 8x8 tile/interval contract tests.
… and batch conv staging and commits
…size prompt part_o by capacity, and widen glue/loop scratch to 512
…eams and raise batch_rows to 64
… step reads kappa as the FP32 it is
…ws the hold drafts
…s; contract pins for the base and attention kernels
…are a round of 16 rows
… ranks the kernel writes
…s streams, and one in all when they are greedy
…window costs and a hold timed at load, up to the whole block
…e step against the recurrent kernel and the pick against a scan
…t draft pays from a third landing
…ane state for prompt cache
… candidate refinement
… fusion, and single-CB GPU sampling
…nd launch records for Q2/Q4 screen and sample kernels
7f311b9 to
c3dcf8e
Compare
|
Thank you for rebasing this onto main, @cwschroeder. We went through the new head commit by commit. It still carries the earlier Inkling Metal stack underneath your work, including commits that change the order FP32 dot products are summed in (the lane-strided sum and the simdgroup router, loop-gate and grouped-expert dots). TensorFold keeps every output bit equal to the serial reference, by default and behind a switch, so those commits cannot land, and the PR is held until the stack is rebuilt without them. Where your own commits reshape a reduction, the same applies; where they only reorder work, scheduling or launches, they can be reviewed once they sit on a base without those changes. An exact version of the faster router and gate dots, one thread per output in the original summation order, is something we are looking at on our side. Nothing is needed from you right now; we will follow up here.
|
What this changes
Stacked on #4699 (
04da51f7d, overlead/inkling2-mini3e0e9bcb8). Keeps target verification 100% lossless (all target token IDs and hashes unchanged, greedy and sampled):tf_ink2_dspark_q2_pack,tf_ink2_dspark_q2_proj,tf_ink2_dspark_q2_proj_units,tf_ink2_dspark_q2_screen,tf_ink2_dspark_q2_refine,tf_ink2_dspark_q2_pick):half2IEEE-754 mantissa-bias0x6400unpack, 8 KiB TG scratch), and refines the top-256 candidates against exact BF16 weights.tf_ink2_dspark_q4_pack,tf_ink2_dspark_q4_units) + bit-exactdense2/dense3fusion:half2mantissa-bias unpack, 1/2/3-way fused output split, 8 KiB TG scratch), cutting draft layer time 3.16x while preserving acceptance.dense2/dense3projections viadense_units.encode6(21 -> 12 dispatches).temperature > 0(tf_ink2_dspark_q2_sample,15.6 us/step):top_k/top_p/min_pfiltering over the 256 refined BF16 candidates directly on GPU, so all streams<= 16(both greedy andtemperature > 0) execute in a single Metal command buffer (dspark_hold = 1.70 msattemp=1.0).metal_inkling2_dspark_screen.zig,metal_inkling2_dspark_screen_controls.zig,inkling2_dspark_chain_metal_records.zig,inkling2_units_metal_records.zig,inkling2_dspark_metal_records.zig,dspark_kernels_test.zig).Checks on this head (
6125120ed)zig fmt --check build.zig zig: PASS (Zig0.17.0)tools/zig/lean_check.pyvs04da51f7d: 167 vs 167, 0 new (all modified/added files <= 600 lines)tools/pr_check.py --base origin/lead/inkling2-mini: 0 errors (1 advisory warning for--pr NUMBER)zig build native -Doptimize=Debug: PASSzig build test-inkling2-controls-host test-inkling2-metal-host test-metal-launch-map-host test-inkling2-launch-map-host: PASS (1237 registered launches, 2 controls, 0 missing)applegpu_g17,tensor units true):tf-kernel-contract --only "inkling2 dspark": 20/20 kernels pass Gates 1-4, 20/20 controls red as planted, 0 limit problemstf-kernel-contract --only "inkling2 units": 6/6 kernels pass Gates 1-4, 6/6 controls red as planted, 0 limit problemsReceipt
0.17.0,thinkingmachines/Inkling-2-Mini@ed40e7da625f594fc9c4990f5f66be24873c22d7(unmodified BF16+NVFP4+MXFP8).sha=b5017c21c071, 4Ksha=2469b1cbb494) and sampledtemp=1.0, top_p=0.95, top_k=20(seed=42 sha=3854e647286d,seed=7 sha=d495ebb59858) outputs match unmodified target verification bit for bit.powermode 0, 128 tokens):dspark_hold(short prompt):6.52 ms -> 2.59 ms(Q2 head)-> 1.64 ms(+ Q4 NAX draft layers, 3.97x faster;1.70 msattemp=1.0).37 rounds 91/170->36 rounds 92/164.temp=1.0, top_p=0.95, top_k=20(seed=42) and 97.4-101.7 tok/s greedy when paired with lanes: the host GPU-rule sampler keeps its best 1,024 candidates in a bounded heap, not a full sort #4744's bounded-heap target sampler.