Repository navigation
Inkling 2 Mini on Metal: the startup line reports the demand of the asked streams (no change to admission) - #4705
Conversation
3e0e9bc to
f790014
Compare
|
@ashhart a question on this draft before I restack it. This draft does something stricter: it reserves window-sized state per stream when the server opens, so on the same flags it refuses to start ( Do you want admission at open (a refusal that names the count and the largest window that fits), or is the per-stream check on lead the intended behavior? If lead's is, I'd close this draft rather than keep two admission rules; the one shared-core piece ( |
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
|
9e9e7a1 to
65799c1
Compare
|
Thanks @BlivionIaG. The demand breakdown is useful, and this head no longer changes the shared pressure governor. I found a cleanup bug in the new refusal path: it frees the model and drafter before allocating the message. If that allocation fails, the existing error cleanup frees them again. Please allocate the message before freeing those owners, or give cleanup one owner, and add a focused allocation-failure case. On the admission question, I recommend keeping main's check by actual request size and separating the diagnostics. Reserving a full window per stream at startup rejects four short requests that main can serve. The whole-window fourth-request failure is a separate admission problem. The DSpark token-size correction in #4622 also remains separate.
|
65799c1 to
d79dcfe
Compare
|
Thank you, @ashhart. Done as you recommended: the head is now one commit ( Measured at I did not re-run the whole-window fourth-request HTTP 500 and the body says it is left open as its own problem. The new line makes its cause readable ( |
|
Thanks @BlivionIaG. This version keeps main's admission and cleanup paths and only adds the demand breakdown. Removing the refusal path also removes the double free. The new receipts and focused tests are useful. This diagnostic slice is ready for normal landing checks. The whole-window admission case and DSpark sizing correction remain separate.
|
- Weights, dense layers and scratch, the state of each stream at the window and what the streams share, beside the room the load limit leaves. - Which streams and windows start is unchanged.
…ng test The admission test opens native/inkling2.zig for cacheBudget. Since ashhart#4897 a family file imports no native (native/inkling2.zig imports the family's Metal model, backend, state and dspark, so the other way made a cycle), so the test moves unchanged to native/inkling2_admit_test.zig, reaching the family files by path as native/inkling2.zig does, and is registered under test-inkling2-metal-host's root beside native's other tests.
|
Thank you @BlivionIaG. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
Inkling 2 Mini on Metal prints the demand it was asked for in its one startup line, and nothing else changes. Before:
inkling2_loop: 15.6 GiB for stream and prompt state, context up to 8192 tokens. After: the same line, followed by what the asked streams need:; 4 streams ask 20.23 GiB (18.39 GiB weights, dense layers and scratch, 4 x 0.46 GiB a stream, 0.00 GiB shared). The numbers arestate.cacheBytes(window)plus, with--drafter,Drafter.streamBytes(window)and the shared score buffer, and the weights, dense layers and scratch main already computes.This slice does not change admission: the window fit, the stream count, what starts and what is refused, and the per-request
held + need > budgetcheck are main's, byte for byte. The line allocates nothing (std.log.infowith stack arguments), so no ownership moves before it.Left open, as a separate problem: with
--parallel 4 --context 131072on a 48 GiB Mac, four requests that each reserve the whole window start, three run, and the fourth fails with HTTP 500InklingStateFull(a stream needs 4.2 GiB of state; 12.6 of 15.6 GiB are held). The line above makes the cause visible (4 x 4.21 GiBagainst 15.6 GiB) but does not change it. The DSpark window fit (#4622) is also separate.e3c6f79bac). Two commits: a merge of main into the branch, then this change.atc overlap --json: . By hand: onlyopen()inzig/src/native/inkling2.zigand a newmetal/admit.zigchange; Inkling 2 Mini on Metal: with a drafter, the window fit prices a token at a token's bytes (a 64 GB limit holds the whole window for eight streams) #4622 edits thedraft_fixed/draft_tokenlines above the changed line and does not touch it.Checks on this head
d79dcfe744.python3 tools/zig/lean_check.py, on main (e3c6f79bac) and on this head: 165 and 165, 0 new.python3 tools/pr_check.py --base upstream/main --pr 4705: 0 errors, 0 warnings.zig build test-inkling2-metal-host compile-inkling2-native-host test-inkling2-host -Dcpu=apple_m1 -Doptimize=ReleaseFast: 126 pass, 0 fail, 8 skip (they needTF_INKLING2_METAL_DIR), 4 of the passes new inadmit_test.zig(the 48 visits' state, DSpark's terms, the room by RAM class and the whole streams it holds at each window, a drafted demand). With the 48 GiB, 131072-token count changed from 3 to 4 the step fails withexpected 4, found 3; put back.zig fmt --check build.zig zig: clean../zig-out/bin/tf-kernel-contract --only inkling2:SUMMARY 41 kernels: 41 pass gates 1-4, 0 fail, 0 known findings; 41 controls: 41 red as planted, 0 missed; 0 limit problems(no kernel, launch or record is touched).Receipt
Main against branch,
--parallel 4, four short concurrent requests, greedy,--no-thinking --prompt-cache-gib 0,/usr/bin/time -lpeak footprint. Both start or refuse alike:--context 81924 x 0.46 GiB, 20.23 GiB asked--context 655524 x 2.21 GiB, 27.24 GiB asked--context 1310724 x 4.21 GiB, 35.23 GiB asked--drafter --context 8192--context exceeds the largest window this Mac can afford beside the checkpoint and DSpark state(Rows are from the main build
5e390519d0whoseinkling2.zigand Inkling 2 Metal files equale3c6f79bac's. Footprints at the same settings differ by up to 1 GB between runs because the four requests land at different points of their prefill within the 45 s window; they are not a measure of this change.)Boxes it reaches: Macs, the
inkling2_loopMetal path, at open.New switch? None.
Environment: this head, Zig 0.17.0, Xcode Metal toolchain, Apple M4 Pro, 48 GiB, macOS 27.2,
thinkingmachines/Inkling-2-Mini@ed40e7da625f594fc9c4990f5f66be24873c22d7. Load average 1.6 to 3.7 and OS memory pressure level 1 at the start of each run. These rows are start behaviour and footprint, not timings.Exactness: greedy chat hashes (
--parallel 1 --context 8192 --no-drafts), main ate3c6f79bacand this branch:7781f06a3160 33a29a1cc9d2 753dc475f8b6 83614a01d8aeon both (prompt lengths 26, 26, 414, 1034 tokens). An older main build (5e390519d0) gave0b037128ee78 b37d8a0e39c4 146f8038bfc7 870a47079391at prompt lengths 28, 28, 416, 1036; the prompt lengths moved on main before this change, not with it.Decode speed and prompt speed before and after: n/a, no kernel, launch or prompt path is touched; the line is logged once at open.
Licence of any new weights or drafter: n/a.
Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo: not re-run; no token path changes.