Repository navigation
Conversation
Derive per-visit cache access and exact arithmetic for the 48 visits so CUDA admission and kernels have a reference before serving is enabled.
Decode stored NVFP4 and MXFP8 expert weights to BF16 and launch them beside the grouped expert/vision kernels, with exact tensor baselines and planted faults.
Launch cross-pass messages, rank-64 gates, residual steps and split QKV with FP32 reductions, BF16 rounding controls and per-launch resource records.
Run all 48 visits with per-visit cache state, prompt snapshots and exact rollback. Refuse TP, vision and DSpark loading until those engines exist.
… rows where prep wrote them
…in the fewest 1,024-key folds a slot
…up to 32 rows is one launch
…de between a prompt's chunks
…to eight rows of a window
…y for up to 16 rows
…s and enable gpu_tokens Preserve ashhart#4618's exact dot-product, BF16 rounding, and softcap30 summation order in both tf_inkling2_logits (glue.metal) and tf_ink2_logits_units (experts_units.metal). Add LogitMode (.logits, .argmax, .both), Stage-1 per-tile reduction, and Stage-2 tf_inkling2_reduce_argmax matching exact firstGreatest tie-breaking and NaN-at-0 semantics while skipping unread f32 logits DRAM stores when mode == .argmax. Enable gpu_tokens = true with async GPU-resident decode queueFn, shared token/flight metadata rings, mixed/pure verify batch planning, updated launch records, host unit tests, and contract argmax probes + planted tie-order controls for both glue and tensor-unit logits kernels. Refs ashhart#4652
ef7204c to
f15269e
Compare
|
Thanks, @gilby, for making the scalar and tensor-unit argmax rules and barriers explicit. One flight-error path needs fixing. GPU-token decode now takes the early flight return, which skips the earlier command buffers’ failure checks, while landing checks only the final buffer. If an earlier part fails and the final part succeeds, the earlier error is dropped and the flight is marked landed. Please retain and check those earlier buffers on landing before advancing the landed position.
|
3e0e9bc to
f790014
Compare
|
Fixed in
|
|
@gilby Thanks. Every flight buffer is now retained and checked before
|
|
Fixed in
Verified on |
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
|
|
Thanks for your patience, @gilby. Since #4387 landed, this PR's own commits sit on top of an earlier Inkling Metal stack that has not landed on main, and that stack includes a change to the FP32 summation order we have kept out for exactness. Your commits do not apply to main's kernels without it, so we are holding this PR until that stack is decided, rather than carrying unreviewed work along with it. We will follow up here; nothing is needed from you now.
|
Fuses exact two-stage argmax across both Inkling 2 Mini logits paths to skip unread f32 logits stores and enables gpu_tokens async GPU-resident decode on #4618 while preserving bit-exact greedy token parity.
What this changes
Preserves
#4618's exact dot-product,bfloat16rounding, andsoftcap30summation order in bothtf_inkling2_logits(glue.metal) andtf_ink2_logits_units(experts_units.metal) while addingLogitMode(.logits,.argmax,.both), Stage-1 per-tile argmax reduction, and Stage-2tf_inkling2_reduce_argmaxmatching exactfirstGreatesttie-breaking and NaN-at-0 semantics while skipping unreadf32logits DRAM stores whenmode == .argmax.Enables
gpu_tokens = true(runtime_test.zig,serving_test.zig,backend.zig,forward.zig,state.zig) with async GPU-resident decodequeueFn, shared token/flight metadata rings, mixed/pure verify batch planning, updated launch records (inkling2_glue_metal_records.zig), andlogits.settleFlightcopying anycb.failure()text before releasing command buffers (backend.Metal.land+ clobbering mock test inlogits.zig), plus contract argmax probes & planted tie-order controls for both glue and tensor-unit logits kernels.lead/inkling2-mini(ad3d31f9ff#4618), 3 commits:f15269e427,4906fe2b5d,0b44597c64atc overlap --json:overlapagainstorigin/lead/inkling2-minicovering#4592, #4593, #4594, #4596, #4683, #4685, #4699completed (17 modified Metal/Zig/contract files cleanly rebased onad3d31f9ff).Checks on this head
0b44597c64(copiescb.failure()text into caller buffer insettleFlightbefore releasing command buffers)python3 tools/zig/lean_check.py:167 problems(0new vs basead3d31f9ff);tools/pr_check.py --pr 4592 --base ad3d31f9ff:0 error(s), 1 warning(s)(changelog reminder).0b44597c64:zig fmt --checkon touched files exit0;git diff --checkexit0;test-inkling2-controls-host,test-inkling2-host,test-inkling2-metal-host(78 pass, 5 skip),compile-inkling2-native-host(macOS/Linux/Windows) pass;test-metal-launch-map-host(Metal launch map: 1210 registered launches, 2 controls, 0 missing,8/8pass);test-inkling2-metal-hostcompiles cleanly (0errors) forx86_64-linuxandx86_64-windows.test-inkling2-metal-host(at GPU-identical parentf15269e427,TF_INKLING2_METAL_DIRset toInkling-2-Mini-ed40e7da, ReleaseFast-Dcpu=apple_m1):81 passed; 3 skipped; 0 failedacross Apple M5 Ultra, Apple M5 Pro, and Apple M3 Ultra (3 skips are DSpark-gated tests whenTF_INKLING2_DSPARK_DIRis unset).48/48 + 48 red), and full M5 Ultra, M5 Pro, and M3 Ultra contract/real-ckpt/serving/cache runs all passed (onlylogits.zig/backend.zighost error handling changed afterf15269e427).Receipt
Inkling-2-Mini-ed40e7da, plain--no-draftsvs#4618ad3d31f9ff, measured at GPU-identicalf15269e427):bench_concurrent.py --levels 1,4,16 --temperatures 0,1.0 --tokens 128 --reps 2 --alone):chat T=0.0:c=159.0vs57.6(+2.4%),c=4193.4(st=207.8) vs196.8(st=203.1),c=16431.9(st=557.7) vs452.7(st=552.8) tok/s (sha=32ddb869bec4exact match,alone_unequal=0)code T=0.0:c=159.5vs53.6(+11.0%),c=4200.9(st=214.8) vs199.1(st=209.0),c=16475.0(st=577.8) vs491.2(st=565.1) tok/s (sha=4490e6bbcfbdexact match,alone_unequal=0)chat T=1.0:c=135.5vs34.7,c=459.6(st=60.5) vs59.4,c=1671.2(st=73.3) vs71.9tok/s (exact sha set match)code T=1.0:c=135.3vs34.4,c=457.8(st=59.4) vs57.8,c=1668.9(st=71.5) vs69.4tok/s (exact sha set match)bench_cache.py --tokens 64 --repeats 2 --streams 4 --require-cold(pt=8704):qualified=True, coldttft_s=8.7671s(rep_min=8.7099s) vs8.7536sref,dec=49.6(rep_max=49.7) vs48.5tok/s (sha=95e612cfdcafexact match)bench_concurrent.py --levels 1,4 --temperatures 0,1.0 --tokens 128 --reps 2 --alone):chat T=0.0:c=131.9vs31.5(+1.3%),c=4101.5(st=115.9) vs102.6tok/s (sha=32ddb869bec4exact match,alone_unequal=0)code T=0.0:c=131.7vs31.8,c=4110.4(st=120.3) vs110.7tok/s (sha=4490e6bbcfbdexact match,alone_unequal=0)chat T=1.0:c=123.2vs23.1,c=438.8(st=40.7) vs40.2;code T=1.0:c=123.5vs22.5,c=438.2(st=39.5) vs39.1(exact sha set match)bench_cache.py --tokens 32 --repeats 2 --streams 2 --require-cold(pt=2571):qualified=True, coldttft_s=15.6689s(rep_min=13.4539s) vs12.6426sref,dec=28.4(rep_max=28.8) vs29.6tok/s (sha=1fbe89b22692exact match)Metal 3,bench_concurrent.py --levels 1,4 --temperatures 0,1.0 --tokens 128 --reps 2 --alone):chat T=0.0:c=145.9vs45.3(+1.3%),c=4100.7(st=109.6) vs100.9tok/s (sha=34819971792dexact match,alone_unequal=0)code T=0.0:c=146.6vs45.4(+2.6%),c=4105.1(st=111.5) vs106.7tok/s (sha=4490e6bbcfbdexact match,alone_unequal=0)chat T=1.0:c=128.3vs28.4,c=442.3(st=43.7) vs43.5;code T=1.0:c=128.1vs28.3,c=442.6(st=43.8) vs43.9(exact sha set match)bench_cache.py --tokens 32 --repeats 2 --streams 2 --require-cold(pt=2571):qualified=True, coldttft_s=8.6175s(rep_min=8.5912s) vs8.7351sref (-0.195s),dec=38.0(rep_max=37.9) vs37.6tok/s (sha=1fbe89b22692exact match)Mode == .argmaxskips unread logits DRAM stores andgpu_tokens = trueruns by default).f15269e427(GPU benchmarks/contracts),4906fe2b5d, and0b44597c64onad3d31f9ff, Zig0.17.0-Dcpu=apple_m1 -Doptimize=ReleaseFast, Apple M5 Max (applegpu_g17), Apple M5 Ultra (applegpu_g17), Apple M5 Pro (applegpu_g17), Apple M3 Ultra (applegpu_g15), checkpointInkling-2-Mini-ed40e7da.glue.metal,experts_units.metal) andgpu_tokensdecode submission across all 4 Apple Silicon hardware tiers.alone_unequal=0; 100%T=0.0,T=1.0, and cachetoken_shaparity against#4618across M5 Ultra, M5 Pro, and M3 Ultra.Kernel contract, only when a GPU kernel is new or changed
tf_inkling2_logits(glue.metal) andtf_ink2_logits_units(experts_units.metal) with Stage-1 per-tile argmax reduction and.logits/.argmax/.bothoutput mode.tf_inkling2_reduce_argmax(256threads,64B TG) matching exactfirstGreatesttie-breaking and NaN-at-0 semantics.logits,argmax,logits_units cap,logits_units argmax,dspark logits) fail red as planted on M5 Max, M5 Ultra, M5 Pro, and M3 Ultra.SUMMARYlines and exit status:applegpu_g17):SUMMARY 48 kernels: 48 pass gates 1-4, 0 fail, 0 known findings; 48 controls: 48 red as planted, 0 missed; 0 limit problems; gates 6567 ms, limits 69 ms(exit0).applegpu_g17):SUMMARY 48 kernels: 48 pass gates 1-4, 0 fail, 0 known findings; 48 controls: 48 red as planted, 0 missed; 0 limit problems; gates 5857 ms, limits 384 ms(exit0).applegpu_g17):SUMMARY 48 kernels: 48 pass gates 1-4, 0 fail, 0 known findings; 48 controls: 48 red as planted, 0 missed; 0 limit problems; gates 6151 ms, limits 8 ms(exit0).applegpu_g15):SUMMARY 42 kernels: 42 pass gates 1-4, 0 fail, 0 known findings; 42 controls: 42 red as planted, 0 missed; 0 limit problems; gates 5883 ms, limits 183 ms(exit0).Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled.