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
bd88428 to
2bc0975
Compare
…tch_rows=64 Rebase PR ashhart#4596 onto ashhart#4618 with 0-ULP scalar attention parity, adaptive decode chunking, up to 8-stream slot batching, and batch_rows=64. Refs ashhart#4652.
2bc0975 to
d1c8c6c
Compare
…atch_rows=64 Rebase PR ashhart#4596 onto ashhart#4618 with 0-ULP sliding attention parity (192-thread GQA 3:1 KV sharing, up to 8-stream slots), batched prepSlots/relTable/merge across all 48 visits, exact ashhart#4618 prompt_attention on the 8 global visits, and batch_rows=64. Refs ashhart#4652.
d1c8c6c to
437cbea
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
|
|
I reran zig build test-inkling2-host test-inkling2-metal-host compile-inkling2-native-host -Dfixed-cpu -j2 --summary all
zig build tf-kernel-contract -Dfixed-cpu -j2 --summary all
./zig-out/bin/tf-kernel-contract --only 'metal inkling2'For the eventual integration, the full branch has 83 conflicts against Igor Lessio - AIFLOW LABS |
Rebases GQA 3:1 sliding KV sharing, multi-stream decode attention slots (up to 8 streams), and batch_rows = 64 onto #4618 while keeping #4618's exact global prompt attention and 0-ULP greedy parity.
What this changes
Shares cached key/value loads across each 3:1 GQA head group and a 2-row cohort (
tf_ink2_attn_scalar,192threads,16384B TG), batches up to8decode streams viatf_ink2_prep_slots(32threads) andtf_ink2_attn_slots(192threads,16384B TG,seg_of = si % max_slots), batchesprepSlots/relTable/mergeacross all 48 visits, keeps#4618's exacttf_ink2_attn_prompt(prompt_attention.metal,prompt_rows = 256,split_rows = 64) on the 8 global visits soProunding matches bit-for-bit, and raisesstate.batch_rows/max_segmentsfrom32to64.lead/inkling2-mini(ad3d31f9ff#4618), 1 commit:437cbea72catc overlap --json:overlapagainstorigin/lead/inkling2-minicovering#4592, #4593, #4594, #4596, #4683, #4685, #4699completed (11changed files isolated to attention/state/forward/backend contract and test files).Checks on this head
437cbea72cde697dd8e73fdbaf9383a041ae1233python3 tools/zig/lean_check.py:7496 files, 167 problems(0new vs basead3d31f9ff);python3 tools/pr_check.py --pr 4596 --base ad3d31f9ff:0 error(s), 1 warning(s)(changelog reminder).-Dcpu=apple_m1):zig fmt --check build.zig zigexit0;git diff --check ad3d31f9ff..HEADexit0;test-inkling2-controls-host,test-inkling2-hostpass;test-inkling2-metal-host(CPU)78 passed; 5 skipped; 0 failed;test-metal-launch-map-host8/8pass (1211registered launches,2controls,0missing).test-inkling2-metal-host(TF_INKLING2_METAL_DIRset toInkling-2-Mini-ed40e7da, ReleaseFast-Dcpu=apple_m1):80 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).49/49 + 49 red), and full M5 Ultra, M5 Pro, and M3 Ultra contract/real-ckpt/serving/cache runs all passed.Receipt
Inkling-2-Mini-ed40e7da, plain--no-draftsvs#4618ad3d31f9ff):bench_concurrent.py --levels 1,4,16 --temperatures 0,1.0 --tokens 128 --reps 2 --alone):chat T=0.0:c=160.0vs57.6(+4.2%),c=4203.1(st=217.1,+3.2%agg) vs196.8,c=16476.1(st=585.4,+5.2%agg /+5.9%steady) vs452.7(st=552.8) tok/s (sha=32ddb869bec4exact match,alone_unequal=0)code T=0.0:c=160.2vs53.6(+12.3%),c=4210.3(st=222.6,+5.6%agg) vs199.1,c=16522.8(st=608.2,+6.4%agg /+7.6%steady) vs491.2(st=565.1) tok/s (sha=4490e6bbcfbdexact match,alone_unequal=0)chat T=1.0:c=135.5vs34.7,c=459.7(st=60.3) vs59.4,c=1672.2(st=73.2) vs71.9;code T=1.0:c=135.3vs34.4,c=458.1(st=59.1) vs57.8,c=1669.4(st=70.9) vs69.4(exact sha set match)bench_cache.py --tokens 64 --repeats 2 --streams 4 --require-cold(pt=8704):qualified=True, coldttft_s=8.2196s(rep_min=8.1666s) vs8.7536sref (-6.1%),dec=49.9(rep_max=49.9) 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=132.1vs31.5,c=4104.0(st=116.1) vs102.6(sha=32ddb869bec4exact match,alone_unequal=0)code T=0.0:c=131.8vs31.8,c=4111.4(st=118.8) vs110.7(sha=4490e6bbcfbdexact match,alone_unequal=0)chat T=1.0:c=123.6vs23.1,c=440.0(st=41.6) vs40.2;code T=1.0:c=123.5vs22.5,c=438.6(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=13.7102s(rep_min=12.7738s) vs12.6426sref,dec=26.2(rep_max=28.2) 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=146.3vs45.3(+2.2%),c=4104.7(st=112.6,+3.8%agg) vs100.9(sha=34819971792dexact match,alone_unequal=0)code T=0.0:c=147.4vs45.4(+4.4%),c=4109.8(st=115.4,+2.9%agg) vs106.7(sha=4490e6bbcfbdexact match,alone_unequal=0)chat T=1.0:c=129.3vs28.4,c=443.1(st=44.1) vs43.5;code T=1.0:c=129.2vs28.3,c=444.4(st=45.3) vs43.9(exact sha set match)bench_cache.py --tokens 32 --repeats 2 --streams 2 --require-cold(pt=2571):qualified=True, coldttft_s=8.3322s(rep_min=8.2920s) vs8.7351sref (-4.6%),dec=38.4(rep_max=41.3) vs37.6tok/s (sha=1fbe89b22692exact match)batch_rows = 64andmax_segments = 64; up to8decode streams batched permax_slots).437cbea72conad3d31f9ff, 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.prep_slots,attn_scalar,attn_slots,rel_table,merge) and segment batching 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 (preserving#4618's exact globalprompt_attentionon the 8 global visits).Kernel contract, only when a GPU kernel is new or changed
tf_ink2_attn_scalar(192threads,16384B TG, replaces32-thread scalar kernel).tf_ink2_prep_slots(32threads,0B TG) andtf_ink2_attn_slots(192threads,16384B TG, multi-stream batched attention).tf_ink2_attn_prompt(prompt_attention.metal,256threads,32768B TG) on global visits for bit-exactProunding.prep_slots(ignoringrsegslot),attn_scalar(row0sharing across row block), andattn_slots(ignoringrsegslot) controls fail red as planted on M5 Max, M5 Ultra, M5 Pro, and M3 Ultra.SUMMARYlines and exit status:applegpu_g17):SUMMARY 49 kernels: 49 pass gates 1-4, 0 fail, 0 known findings; 49 controls: 49 red as planted, 0 missed; 0 limit problems; gates 15323 ms, limits 11 ms(exit0).applegpu_g17):SUMMARY 49 kernels: 49 pass gates 1-4, 0 fail, 0 known findings; 49 controls: 49 red as planted, 0 missed; 0 limit problems; gates 14069 ms, limits 396 ms(exit0).applegpu_g17):SUMMARY 49 kernels: 49 pass gates 1-4, 0 fail, 0 known findings; 49 controls: 49 red as planted, 0 missed; 0 limit problems; gates 14161 ms, limits 32 ms(exit0).applegpu_g15):SUMMARY 44 kernels: 44 pass gates 1-4, 0 fail, 0 known findings; 44 controls: 44 red as planted, 0 missed; 0 limit problems; gates 15661 ms, limits 8 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.