Repository navigation
Conversation
Integrate PR ashhart#4699's DSpark kernel, weight-packing, online-softmax multi-stream attention, batched GPU chain sampling, host SIMD draw, and shared depth pricing optimizations cleanly onto ashhart#4465 (03bb79e): - Transpose folded phi ([256, 201024]) and load-time split/transposed RNN weights (rnn_kappa, rnn_rec) for coalesced GPU loads. - Replace score-buffer DSpark attention with zero-scratch 768-thread online softmax with M5 tensor-unit and TF_SIMD_FRAGS=1 pre-M5 paths, plus tiled base and two-stage group softmax/argmax logits. - Wire batched multi-stream absorb/hold, chances with softmax reach, two-pass GPU top-k sampling, host SIMD top-k/greedy draws, and shared-batch target pricing while preserving ashhart#4465 invariants (DSP_SCALE, FP32 kappa, plain_guard = false, dspark.warm/measure, and firstLogprobRow). Refs ashhart#4652
8d3589f to
54da692
Compare
3e0e9bc to
f790014
Compare
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
|
|
5060 Ti (sm_120) kernel-contract
rc=1 is the limit-problem exit; no gate or control failures on sm_120. |
|
Thank you, @gilby. All eleven chain changes are included; two earlier drafter fixes are already on main. The remaining overhaul keeps proposals behind target verification, replaces the growing scratch pool with charged fixed buffers, and removes the chain probes with unstable addresses. This is ready for exact comparison on an integrated tree using the pinned Mini checkpoint, on M3 Ultra and M5 Ultra. The reported longer-prompt failure concerns acceptance coverage on a different overlay; please distinguish that from token parity and retain meaningful accepted-draft, rollback and cache checks. The overlay speed results do not yet qualify this change against current main.
|
…ws the hold drafts
…s; contract pins for the base and attention kernels
…are a round of 16 rows
…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
Integrate PR ashhart#4699's DSpark kernel, weight-packing, online-softmax multi-stream attention, batched GPU chain sampling, host SIMD draw, and shared depth pricing optimizations cleanly onto ashhart#4465 (03bb79e): - Transpose folded phi ([256, 201024]) and load-time split/transposed RNN weights (rnn_kappa, rnn_rec) for coalesced GPU loads. - Replace score-buffer DSpark attention with zero-scratch 768-thread online softmax with M5 tensor-unit and TF_SIMD_FRAGS=1 pre-M5 paths, plus tiled base and two-stage group softmax/argmax logits. - Wire batched multi-stream absorb/hold, chances with softmax reach, two-pass GPU top-k sampling, host SIMD top-k/greedy draws, and shared-batch target pricing while preserving ashhart#4465 invariants (DSP_SCALE, FP32 kappa, plain_guard = false, dspark.warm/measure, and firstLogprobRow). Refs ashhart#4652
7e100f9 to
6e6d858
Compare
|
Rebased cleanly onto current Summary of key points addressing the review feedback:
|
|
I checked The unchanged host/capability suites passed 151 tests with ten skips. Removing just the extra brace in scratch let all 74 build steps succeed. On M5 Max the device filter then passed all 61 kernels, caught all 65 planted controls, and reported zero limit problems. zig build test-inkling2-host test-inkling2-metal-host test-inkling2-metal-capabilities tf-kernel-contract -Dfixed-cpu -j2 --summary all
./zig-out/bin/tf-kernel-contract --only 'metal inkling2'Igor Lessio - AIFLOW LABS |
Rebases the DSpark kernel overhaul, batched multi-stream speculative drafting, softmax chances, and two-pass GPU top-k sampling onto integrated
mainwhile preserving zero-ULP parity across plain and drafted paths.What this changes
Transposes DSpark
phi([256, 201024]) and RNN weights (packRnn), replaces the score-scratch attention and sequential chain kernels with zero-score-scratch online-softmaxtf_ink2_dspark_attention(768threads,20736B TG, plusTF_SIMD_FRAGS=1pre-M5 fallback), tiledtf_ink2_dspark_base, coalescedkappa/recurrent, and two-stagetf_ink2_dspark_logits, removes obsolete single-stream chain kernels (inkling2_dspark_chain_metal_records.zig), enables batchedholdFn/absorbFn/chancesFn+fastTopKDrawtwo-pass GPU sampling, and guards non-macOSclock_gettimeand DSpark Metal host tests so host/CI builds pass on all targets.main(3795e6054c), 11 commits rebased ontomaincleanly (6e6d858682, 18 changed files; full 3-Mac serving/cache/contract suite ran on0652b7907b+ post-rebase host and contract checks verified on6e6d858682).atc overlap --json: Checked againstmain(changedFiles: 18); all 3 conflicts from9d249389a5(inkling2_sources.zig,backend.zig,metal_limits.zig) and obsolete chain cleanup cleanly resolved.Checks on this head
6e6d858682(onorigin/main3795e6054c)tools/pr_check.py --pr 4699:lean 165 vs 165, 0 new,18 changed files,0 error(s).6e6d858682(Zig0.17.0-Dcpu=apple_m1 -Doptimize=ReleaseFast, Apple M5 Max):zig fmt --check build.zig zigandgit diff --check origin/main..HEAD— exit0.zig build test-inkling2-host test-inkling2-controls-host test-inkling2-metal-host test-metal-launch-map-host compile-inkling2-native-host—59/59 steps succeeded; 177/187 tests passed (10 skipped)(test-inkling2-host45/4,test-inkling2-controls-host19/0,test-inkling2-metal-host105/6,test-metal-launch-map-host8/0over1302launches,compile-inkling2-native-hostpass)../zig-out/bin/tf-kernel-contract --only "metal inkling2"—SUMMARY 61 kernels: 61 pass gates 1-4, 0 fail, 0 known findings; 65 controls: 65 red as planted, 0 missed; 0 limit problems(gates 10400 ms, limits 23 ms).test-inkling2-metal-host(Inkling-2-Mini,0652b7907b->8e1661e8c3):All 85 tests passed.(0skipped,0failed);46/46kernels /51/51red controls /0limits (10243 ms).All 85 tests passed.(0skipped,0failed);46/46kernels /51/51red controls /0limits (9995 ms).TF_SIMD_FRAGS=1, evaluated with symmetric 2-linethreadqualifier overlay on pre-existingprompt_attention.metallines 11 and 15):All 85 tests passed.(0skipped,0failed);46/46kernels /51/51red controls /0limits (12619 ms).6e6d858682.Receipt
main(0652b7907b) against rebased#4699(8e1661e8c3),Inkling-2-Mini(ed40e7da625f594fc9c4990f5f66be24873c22d7),--parallel 4 --context 8192,tools/bench_concurrent.py --alone --serial --levels 1,4 --tokens 256 --seed 1234 --temperatures 0,1.0(--reps 3on Ultra tiers,--reps 2on Pro tier), alternatingA1_base/B1_4699/B2_4699/A2_basewith--drafter, plusplain_base/plain_4699(--no-drafts):plain/A_base->B_4699aggregatetok/s):code T=0.0 S=1:16.2/22.9->27.05(1.18xvs base drafted,1.67xvs plain)code T=0.0 S=4:28.95/19.55->28.80(1.47xvs base drafted,0.99xvs plain)chat T=0.0 S=1:16.15/20.5->23.60(1.15xvs base drafted,1.46xvs plain)chat T=0.0 S=4:29.35/15.15->30.70(2.03xvs base drafted,1.05xvs plain)code T=1.0 S=1:16.2/17.6->19.30(1.10xvs base drafted,1.19xvs plain)code T=1.0 S=4:28.65/15.2->28.40(1.87xvs base drafted,0.99xvs plain)chat T=1.0 S=1:16.2/20.5->15.90(0.78xvs base drafted,0.98xvs plain — reprseed=1234throttles speculative depth viachancesafter early misses (24/52,15.8 tok/s); serialseeds 1235/1236/1237run19.7/21.0/21.5 tok/s(98/172,111/178,114/173) vs base17.8/19.8/19.6 tok/s)chat T=1.0 S=4:29.15/14.3->29.30(2.05xvs base drafted,1.01xvs plain)A1/B1/B2/A2):10643/34220(1301.78s, RSS20.631 GB) vs3405/5260(939.54s, RSS20.626 GB) /3222/4945(907.32s).TF_SIMD_FRAGS=1Metal 3 with symmetricprompt_attention.metalthreadoverlay on both base and branch):code T=0.0 S=1:12.0/15.8->18.10(1.15xvs base drafted,1.51xvs plain)code T=0.0 S=4:19.5/11.65->19.50(1.67xvs base drafted,1.00xvs plain)chat T=0.0 S=1:11.95/15.0->16.35(1.09xvs base drafted,1.37xvs plain)chat T=0.0 S=4:19.9/9.35->20.15(2.16xvs base drafted,1.01xvs plain)code T=1.0 S=1:12.0/13.6->12.10(0.89xvs base drafted,1.01xvs plain)code T=1.0 S=4:19.5/9.50->19.55(2.06xvs base drafted,1.00xvs plain)chat T=1.0 S=1:11.95/13.5->11.70(0.87xvs base drafted,0.98xvs plain)chat T=1.0 S=4:19.95/8.20->20.00(2.44xvs base drafted,1.00xvs plain)code T=0.0 S=1:13.1/13.3->16.80(1.26xvs base drafted,1.28xvs plain)code T=0.0 S=4:19.75/10.0->19.60(1.96xvs base drafted,0.99xvs plain)chat T=0.0 S=1:13.15/11.9->15.30(1.29xvs base drafted,1.16xvs plain)chat T=0.0 S=4:20.35/7.7->20.30(2.64xvs base drafted,1.00xvs plain)code T=1.0 S=1:13.05/10.35->11.80(1.14xvs base drafted,0.90xvs plain)code T=1.0 S=4:19.6/7.75->19.60(2.53xvs base drafted,1.00xvs plain)chat T=1.0 S=1:13.15/11.8->12.10(1.03xvs base drafted,0.92xvs plain)chat T=1.0 S=4:20.3/7.2->20.30(2.82xvs base drafted,1.00xvs plain)/v1/chat/completionsprompt cache (prompt_tokens=544/542,cold_cached=0,warm_cached=512,branch_cached=512):warm_equals_cold_tokens=Trueandwarm_equals_cold_output=Trueon all 3 Macs (M5 Ultraaccepted=59/95cold,49/98warm,55/98branch; M3 Ultra61/102,55/110,51/96; M5 Pro55/79,47/72,51/81). Note/v1/completionsbench_cache.pykeeps0states onmain(grid=64,tail=false,repeat_min=0).\u70d2×24 report on the earlier overlay:origin/mainusesprompt_rows = 64inzig/src/families/inkling2/metal/state.zig(prompt(64, 3)), whereas that earlier overlay changedprompt_rowsto256(prompt(256, 3)). On integratedmain,All 85 tests passedacross M5 Ultra, M5 Pro, and M3 Ultra (m3ov).TF_SIMD_FRAGS=1verified).TF_SIMD_FRAGS=1pre-M5 shader path auto-selected at pipeline load when!device.tensorUnits()).6e6d858682onmain3795e6054c; 3-Mac full A-B-B-A on8e1661e8c3(0652b7907b), Zig0.17.0-Dcpu=apple_m1 -Doptimize=ReleaseFast, macOS 27.2.1 / 27.0.1 / 26.6.2,Inkling-2-Minied40e7da.dspark.metal), softmaxchances(), and two-pass GPU top-k sampling (draw.zig,dspark_sample.zig) on Apple Silicon Metal.60/60token_sha256+60/60output_sha256parity on M5 Ultra,60/60on M3 Ultra (m3ov),40/40on M5 Pro across all 6 server variants (plain_base,plain_4699,A1,B1,B2,A2) vsplain_base;conc == aloneandconc == serial100%(failed=0,unequal=0in every cell);warm == cold100%.Main against branchacross all 3 Macs (eliminatesS=47.2–19.6 tok/sregression while accelerating greedyS=1+9–29%over base drafted /+16–67%over plain)./v1/chat/completionsTTFT7.165s–16.46s->0.59s–0.64son M5 Ultra with100%exact parity.Kernel contract, only when a GPU kernel is new or changed
tf_ink2_dspark_fuse_taps48B TG,tf_ink2_dspark_attention768threads /20736B TG online softmax withscoreBytes=0,tf_ink2_dspark_residual_norm32B TG,tf_ink2_dspark_kappa64threads,tf_ink2_dspark_recurrent1024B TG, tiledtf_ink2_dspark_base5120B TG, two-stagetf_ink2_dspark_logits4224B TG).tf_ink2_dspark_chain_stepandtf_ink2_dspark_chain_pick(inkling2_dspark_chain_metal_records.zigdeleted).dspark_pre_m5(#define TF_SIMD_FRAGS 1) alongside M5dspark.Metal 3).SUMMARYlines and exit status:6e6d858682, allmetal inkling2):SUMMARY 61 kernels: 61 pass gates 1-4, 0 fail, 0 known findings; 65 controls: 65 red as planted, 0 missed; 0 limit problems; gates 10400 ms, limits 23 ms(exit0).8e1661e8c3):SUMMARY 46 kernels: 46 pass gates 1-4, 0 fail, 0 known findings; 51 controls: 51 red as planted, 0 missed; 0 limit problems; gates 10243 ms, limits 391 ms(exit0).8e1661e8c3):SUMMARY 46 kernels: 46 pass gates 1-4, 0 fail, 0 known findings; 51 controls: 51 red as planted, 0 missed; 0 limit problems; gates 9995 ms, limits 386 ms(exit0).8e1661e8c3+ symmetricthreadoverlay):SUMMARY 46 kernels: 46 pass gates 1-4, 0 fail, 0 known findings; 51 controls: 51 red as planted, 0 missed; 0 limit problems; gates 12619 ms, limits 100 ms(exit0).Metal 3TF_SIMD_FRAGS=1path).Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled.