Repository navigation
Conversation
|
/atc depends 4917 |
|
Thank you @gilby. The snapshot slice preserves ring positions, handles the pending tail tap and charges drafter bytes alongside target state. The early-mark horizon and non-first-slot checks are useful. The shared parent still has a contract-probe ownership bug: a failed kernel-list append can free a probe already retained by the suite, which cleanup then follows again. Please make that ownership transfer transactional and cover the failing allocation. The full head needs that repair; the batching combination must also retain the snapshot hooks and mark horizon alongside its Q4/batch paths.
|
|
@gilby, about the probe-registration cleanup our review asked for: the same two-append pattern was on main in 85 places, and #5058 (now merged) fixes it there with one helper, errdefer p.deinit(); // with errdefer s.a.destroy(p) after create, as the suite's teardown frees it
try ct.register(s.a, &s.probes, &s.kernels, p, p.kernel());Using it for this PR's new suites closes that item.
|
4484a13 to
70de70f
Compare
|
Updated #5032 (head
|
70de70f to
2286146
Compare
|
Rebased #5032 onto updated #4917 (
|
What this changes
Before: stacked on #4917 (alongside the generic prompt-cache drafter snapshot contract from #4542), DFlash 2 had no prompt-cache snapshot/restore support (
prepareonly saved DSpark lane state when active), causing warm prompt-cache hits under--drafter <DFlash2>to miss DFlash 2 lane state restoration or skip context snapshot reuse.After (stacked on #4917, commit
9a4a1619c2):zig/src/families/inkling2/metal/{dflash2_state,dflash2,state,backend,dspark_state}.zig: Addsdflash2_state.zigfor byte-exact GPU/host snapshot capture and restore of DFlash 2 lane context KV rings, position/commit state, and metadata at prompt-cache boundaries, integrating intobackend.zig's prompt-cache snapshot hooks alongsidedspark_state.ziganddspark.zig.zig/src/native/inkling2.zig: Wires DFlash 2 prompt-cache snapshot capture/restore cleanly into the serving loop so warm multi-turn and shared-prefix concurrent requests hit prompt cache with bit-exact token determinism and full DFlash 2 acceleration.Tests: Adds
dflash2_snap_test.zig(host_test.zig) verifying DFlash 2 snapshot/restore equivalence, budget accounting, and warm resume parity.Issue: Refs Inkling 2 Mini Metal V4: exact-serial scaling, GPU sampling, DFlash 2 acceleration, and kernel fusions #4961
Stacked on: inkling2 metal: native DFlash 2 drafter support (DFlash2DraftModel) #4917 (
9a4a1619c2, which includes transactionalpublishProbe+FailingAllocatorOOM coverage);git merge-tree --write-tree f3c0fa8c65 HEADclean (b7fb81ecc9) againstmainat inkling2 metal: native DFlash 2 drafter support (DFlash2DraftModel) #4917's base (f3c0fa8c65).Checks on this head
228614678b(8changed files,1202 insertions(+), 171 deletions(-))python3 tools/pr_check.py --base 9a4a1619c2 --pr 5032(python3 tools/zig/lean_check.py):lean 164 vs 164, 0 new,0 error(s)(8changed files, max touched file591lines<= 600);zig fmt --check build.zig zigandgit diff --check 9a4a1619c2..HEADexit0.-Dcpu=apple_m1 -Doptimize=ReleaseFast):zig build -Dcpu=apple_m1 -Doptimize=ReleaseFast: exit0.zig build compile-inkling2-native-host: exit0;zig build compile-inkling2-native-host -Dtarget=x86_64-windows: exit0;zig build compile-native-cuda-windows: exit0.zig build test-inkling2-host -Dcpu=apple_m1 -Doptimize=ReleaseFast:45 passed; 4 skipped; 0 failed(exit0).zig build test-inkling2-controls-host:27tests passed (0failed);zig build test-kernel-contract: exit0;zig build tf-kernel-contract -Doptimize=ReleaseFast: exit0.zig build test-inkling2-metal-host -Dcpu=apple_m1 -Doptimize=ReleaseFasttest binary:118 passed; 6 skipped; 0 failed(includesdflash2_snap_test.zig; JPEG and checkpoint env tests skipped)../zig-out/bin/tf-kernel-contract):228614678b,--only "metal inkling2 dflash2"):SUMMARY 11 kernels: 11 pass gates 1-4, 0 fail, 0 known findings; 13 controls: 13 red as planted, 0 missed; 0 limit problems; gates 62 ms, limits 58 ms(exit0).--only "metal inkling2"):SUMMARY 72 kernels: 72 pass gates 1-4, 0 fail, 0 known findings; 78 controls: 78 red as planted, 0 missed; 0 limit problems; gates 14654 ms, limits 736 ms(exit0).9a4a1619c2, inheriting transactionalpublishProbe+ OOM test); force-pushed cleanly..metalkernels (snapshot/restore operates on DFlash 2 buffers from inkling2 metal: native DFlash 2 drafter support (DFlash2DraftModel) #4917); Apple M1/M2/M3/M4 live prompt-cache runs not directly executed; 2-Mac live prompt-cache verification covers Apple M5 Ultra 512 GiB and Apple M5 Pro 64 GiB.Receipt
base_plainvsnew_plainvsnew_drafterwith--drafter {DFLASH2}, comparing against cold no-cache referencecold_ref_summary;all_sha_match: true,all_warm_hits: trueacross every suite on both machines):base_plain(all_sha_match=true,all_warm_hits=true):single:t1dt=14.997s(cached=0,ttft=12.834s,14.58 tok/s),t2dt=2.451s(cached=1174,ttft=0.312s,14.57 tok/s),t3dt=2.483s(cached=1174,ttft=0.331s,14.57 tok/s).c=2:slotA t1dt=33.943s,t2dt=3.589s(cached=1386,ttft=0.640s,10.64 tok/s);slotB t1dt=33.943s,t2dt=3.589s(cached=1461,ttft=0.333s,9.63 tok/s).new_plain(all_sha_match=true,all_warm_hits=true):single:t1dt=14.988s(cached=0,ttft=12.845s,14.58 tok/s),t2dt=2.446s(cached=1174,ttft=0.309s,14.59 tok/s),t3dt=2.471s(cached=1174,ttft=0.329s,14.57 tok/s).c=2:slotA t1dt=34.008s,t2dt=3.575s(cached=1386,ttft=0.318s,9.57 tok/s);slotB t1dt=34.008s,t2dt=3.575s(cached=1461,ttft=0.645s,10.64 tok/s).new_drafter(--drafter {DFLASH2},all_sha_match=true,all_warm_hits=true):single:t1dt=14.310s(cached=0,ttft=12.881s,21.88 tok/s),t2dt=1.326s(cached=1174,ttft=0.318s,31.11 tok/s),t3dt=1.460s(cached=1174,ttft=0.336s,28.23 tok/s).c=2:slotA t1dt=32.604s,t2dt=2.374s(cached=1386,ttft=0.653s,18.15 tok/s);slotB t1dt=32.782s,t2dt=2.184s(cached=1461,ttft=0.339s,16.92 tok/s).base_plain(all_sha_match=true,all_warm_hits=true):single:t1dt=41.312s(cached=0,ttft=38.730s,12.14 tok/s),t2dt=3.418s(cached=1174,ttft=0.829s,12.11 tok/s),t3dt=3.472s(cached=1174,ttft=0.885s,12.12 tok/s).c=2:slotA t1dt=98.464s,t2dt=5.726s(cached=1386,ttft=0.829s,6.38 tok/s);slotB t1dt=98.463s,t2dt=5.726s(cached=1461,ttft=1.712s,7.80 tok/s).new_plain(all_sha_match=true,all_warm_hits=true):single:t1dt=41.213s(cached=0,ttft=38.594s,12.14 tok/s),t2dt=3.418s(cached=1174,ttft=0.827s,12.13 tok/s),t3dt=3.468s(cached=1174,ttft=0.885s,12.13 tok/s).c=2:slotA t1dt=97.943s,t2dt=5.712s(cached=1386,ttft=1.712s,7.81 tok/s);slotB t1dt=97.943s,t2dt=5.711s(cached=1461,ttft=0.887s,6.46 tok/s).new_drafter(--drafter {DFLASH2},all_sha_match=true,all_warm_hits=true):single:t1dt=41.159s(cached=0,ttft=38.869s,13.70 tok/s),t2dt=2.626s(cached=1174,ttft=0.845s,17.71 tok/s),t3dt=2.942s(cached=1174,ttft=0.903s,15.44 tok/s).c=2:slotA t1dt=97.533s,t2dt=5.432s(cached=1386,ttft=0.849s,6.80 tok/s);slotB t1dt=97.843s,t2dt=5.008s(cached=1461,ttft=1.750s,9.61 tok/s).dflash2_state.zig,dflash2_snap_test.zig,dflash2.zig,dspark_state.zig,backend.zig,state.zig,host_test.zig,native/inkling2.zig.--drafter <DFlash2>runs with prompt cache enabled).228614678bstacked on inkling2 metal: native DFlash 2 drafter support (DFlash2DraftModel) #4917 (9a4a1619c2), Zig0.17.0-Dcpu=apple_m1 -Doptimize=ReleaseFast, Apple M5 Max (applegpu_g17), Apple M5 Ultra 512 GiB, Apple M5 Pro 64 GiB; checkpoint Inkling-2-Mini and DFlash 2 drafter (incoai/Inkling-2-Mini-DFlash2).all_sha_match=trueandall_warm_hits=trueacross every turn and concurrent slot (singlet1..t3,concurrent_c2slotA/slotBt1..t2) on both Apple M5 Ultra and Apple M5 Pro against the cold no-cache baseline.singlewarmt2/t3:14.59 -> 31.11 / 28.23 tok/son M5 Ultra and12.13 -> 17.71 / 15.44 tok/son M5 Pro, cutting warm turn elapseddt_sfrom2.446s -> 1.326s/3.575s -> 2.184s(c=2) on M5 Ultra and3.418s -> 2.626s/5.711s -> 5.008s(c=2) on M5 Pro) while preserving plain parity.cached_tokens(1174,1386,1461) resume identically between plain and DFlash 2 warm turns.Kernel contract, only when a GPU kernel is new or changed
.metalcompute kernels (snapshots DFlash 2 device state buffers from inkling2 metal: native DFlash 2 drafter support (DFlash2DraftModel) #4917).13/13DFlash 2 controls (228614678b,--only "metal inkling2 dflash2") and78/78full Inkling 2 controls (prior commit on same kernels) on Apple M5 Max fail red as planted (0missed).SUMMARYline and exit status:228614678b,--only "metal inkling2 dflash2"):SUMMARY 11 kernels: 11 pass gates 1-4, 0 fail, 0 known findings; 13 controls: 13 red as planted, 0 missed; 0 limit problems; gates 62 ms, limits 58 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.