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
…mdgroup folds the partial sums itself
…e of an expert is full
…de between a prompt's chunks
…to eight rows of a window
…y for up to 16 rows
… parity proofs Refs ashhart#4652
bb4b417 to
8015c1e
Compare
|
Thanks @gilby. The scalar and tensor-unit parity coverage is valuable. I found one checkpoint-validation integration issue. The recorded two-product fallback result is not consumed by dispatch or included in the load-time warning condition. A checkpoint containing only a quotient/scale tie is therefore silent even though the kernels take the fallback. Conversely, a NaN scale with otherwise safe globals logs that the three-product fallback is active while the shader still selects two-product decoding. Please make the checkpoint reporting agree with the actual per-expert dispatch, or pass the intended policy through explicitly.
|
3e0e9bc to
f790014
Compare
… guard non-Darwin test Refs ashhart#4652
|
Fixed in
|
|
@gilby Thanks. Tie-only checkpoints now warn, and a NaN scale with a safe
|
|
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.
|
Rebases the exact two-product NVFP4 weight decode, checkpoint load validator, and GPU block/quad parity proofs onto #4618 with #4618's BM=16, BN=32
ink2_unitskernel untouched.What this changes
Adds a 64-entry shifted-E2M1 LUT (
ink2_e2m1_twice_lut), a branch-free product safety guard (ink2_nv_two_prod_safe) with an out-of-line 3-product fallback,ink2_nv_quad_2pinside#4618's exactBM=16, BN=32ink2_unitspath (keepingtf_ink2_logits_unitsand MXFP8 paths untouched), aModel.loadvalidator (Model.scanNvfp4Weightsdecided strictly from per-expertphi(a, d)to match shader dispatch while reporting nonfinite globals), and strict bit-identical GPU block/quad parity proofs (assertBlockProof,assertQuadProof) +.nv_swap_abplanted controls.lead/inkling2-mini(ad3d31f9ff#4618), 3 commits:8015c1ef10,1652cf925c,49e5620f12atc overlap --json:overlapagainstorigin/lead/inkling2-minicovering#4592, #4593, #4594, #4596, #4683, #4685, #4699completed (all shared expert/contract files cleanly isolated ontoad3d31f9ff).Checks on this head
49e5620f12(decides fallback strictly fromphi(a, d), logs nonfinite globals separately, and compares raw NaN bits on host + GPU proofs)python3 tools/zig/lean_check.py:167 problems(0new vs basead3d31f9ff);tools/pr_check.py --pr 4685 --base ad3d31f9ff:0 error(s), 1 warning(s)(changelog reminder).49e5620f12:zig fmt --checkexit0;git diff --checkexit0;test-inkling2-controls-hostpass;test-inkling2-host(44 pass, 4 skip) pass;test-inkling2-metal-host(CPU)78 pass, 5 skip(strict raw@bitCastNaN checks for±0.0and safephiover 256 scales × 16 nibbles, plus infinite-denominatorscanNvfp4Tensors/Model.scanNvfp4Weightstests);compile-inkling2-native-host(macOS/Linux/Windows) pass;test-metal-launch-map-host8/8pass (1209registered launches,2controls,0missing);test-inkling2-metal-hostcompiles cleanly (0errors) forx86_64-linuxandx86_64-windows.tf-kernel-contract --only "metal inkling2"on49e5620f12, ReleaseFast-Dcpu=apple_m1):46/46 pass gates 1-4, 48/48 controls red, 0 limit problems(7348 ms), including strict rawu32/u16bit equality (no NaN bypass) inassertBlockProofandassertQuadProof.test-inkling2-metal-host(at shader-identical parent8015c1ef10,TF_INKLING2_METAL_DIRset toInkling-2-Mini-ed40e7da, ReleaseFast-Dcpu=apple_m1):82 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).46/46 + 48 redon49e5620f12), and M5 Ultra, M5 Pro, and M3 Ultra contract/real-ckpt/serving/cache runs all passed (production Metal kernels unchanged after8015c1ef10).Receipt
Inkling-2-Mini-ed40e7da, plain--no-draftsvs#4618ad3d31f9ff, measured at shader-identical8015c1ef10):bench_concurrent.py --levels 1,4,16 --temperatures 0,1.0 --tokens 128 --reps 2 --alone):code T=0.0:c=156.8vs53.6(+6.0%),c=4199.5(st=208.9) vs199.1(st=209.0),c=16489.7(st=564.0) vs491.2(st=565.1) tok/s (sha=4490e6bbcfbdexact match,alone_unequal=0)chat T=0.0:c=156.5vs57.6,c=4192.6(st=202.5) vs196.8,c=16447.7(st=542.4) vs452.7tok/s (sha=32ddb869bec4exact match,alone_unequal=0)code T=1.0:c=134.3vs34.4,c=458.1(st=59.0) vs57.8,c=1670.0(st=71.6) vs69.4;chat T=1.0:c=134.5vs34.7,c=459.6(st=60.2) vs59.4,c=1672.6(st=73.6) vs71.9(exact sha set match)bench_cache.py --tokens 64 --repeats 2 --streams 4 --require-cold(pt=8704):qualified=True, coldttft_s=8.7323s(rep_min=8.6800s) vs8.7536sref,dec=47.8(rep_max=49.3) vs48.5tok/s (sha=95e612cfdcafexact match)bench_concurrent.py --levels 1,4 --temperatures 0,1.0 --tokens 128 --reps 2 --alone):code T=0.0:c=131.6vs31.8,c=4113.3(st=119.3) vs110.7(st=118.0,+2.3%agg,sha=4490e6bbcfbdexact match,alone_unequal=0)chat T=0.0:c=132.0vs31.5,c=4103.5(st=115.2) vs102.6(st=114.6,sha=32ddb869bec4exact match,alone_unequal=0)code T=1.0:c=123.1vs22.5,c=439.1(st=40.0) vs39.1;chat T=1.0:c=123.1vs23.1,c=439.6(st=41.0) vs40.2(exact sha set match)bench_cache.py --tokens 32 --repeats 2 --streams 2 --require-cold(pt=2571):qualified=True, coldttft_s=15.4241s(rep_min=13.4677s) vs12.6426sref,dec=27.7(rep_max=28.1) vs29.6tok/s (sha=1fbe89b22692exact match)Metal 3,bench_concurrent.py --levels 1,4 --temperatures 0,1.0 --tokens 128 --reps 2 --alone):code T=0.0:c=145.5vs45.4,c=4116.3(st=121.8,+9.0%steady) vs106.7(st=111.7,sha=4490e6bbcfbdexact match,alone_unequal=0)chat T=0.0:c=146.0vs45.3,c=4110.6(st=119.3,+13.1%steady) vs100.9(st=105.5,sha=34819971792dexact match,alone_unequal=0)code T=1.0:c=128.0vs28.3,c=443.8(st=44.7) vs43.9;chat T=1.0:c=128.3vs28.4,c=443.9(st=45.0) vs43.5(exact sha set match)bench_cache.py --tokens 32 --repeats 2 --streams 2 --require-cold(pt=2571):qualified=True, coldttft_s=8.3596s(rep_min=8.1957s) vs8.7351sref (-0.375s),dec=37.8(rep_max=37.9) vs37.6tok/s (sha=1fbe89b22692exact match)scanNvfp4Weightsautomatically enables 2-product fast path on exact tensors and falls back to 3-product otherwise).8015c1ef10,1652cf925c, and49e5620f12onad3d31f9ff, 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.experts.metal,experts_units.metal) and model load validator 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, plus exhaustively verified 2-product bit-identity (including raw NaN bits) and GPU block/quad proofs.Kernel contract, only when a GPU kernel is new or changed
tf_ink2_nvfp4_gu,tf_ink2_nvfp4_down,tf_ink2_nvfp4_gu_grouped,tf_ink2_nvfp4_down_grouped,tf_ink2_nvfp4_gu_units, andtf_ink2_nvfp4_down_units(preserving#4618'sBM=16, BN=32ink2_unitsloop/reduction order)..nv_swap_abswapped 2-prod guard controls (tf_ink2_nvfp4_down,tf_ink2_nvfp4_down_units) fail red as planted on all 4 Macs;assertBlockProofandassertQuadProofpass on GPU with rawu32/u16bit equality (including NaNs).SUMMARYlines and exit status:applegpu_g17,49e5620f12):SUMMARY 46 kernels: 46 pass gates 1-4, 0 fail, 0 known findings; 48 controls: 48 red as planted, 0 missed; 0 limit problems; gates 7348 ms, limits 14 ms(exit0).applegpu_g17,8015c1ef10):SUMMARY 46 kernels: 46 pass gates 1-4, 0 fail, 0 known findings; 48 controls: 48 red as planted, 0 missed; 0 limit problems; gates 5922 ms, limits 386 ms(exit0).applegpu_g17,8015c1ef10):SUMMARY 46 kernels: 46 pass gates 1-4, 0 fail, 0 known findings; 48 controls: 48 red as planted, 0 missed; 0 limit problems; gates 6015 ms, limits 7 ms(exit0).applegpu_g15,8015c1ef10):SUMMARY 41 kernels: 41 pass gates 1-4, 0 fail, 0 known findings; 42 controls: 42 red as planted, 0 missed; 0 limit problems; gates 6121 ms, limits 431 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.