Repository navigation
Inkling 2 Mini on Metal: #4387's native build compiles, its norms write their output, and concurrent streams equal solo - #4446
Closed
sethforprivacy wants to merge 21 commits into
Closed
sethforprivacy wants to merge 21 commits into
sethforprivacy wants to merge 21 commits into
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.
This was referenced Nov 21, 2026
… rows where prep wrote them
This was referenced Nov 22, 2026
Open
6 of 8 tasks
This was referenced Nov 22, 2026
This was referenced Nov 23, 2026
Merged
8 tasks done
ashhart
force-pushed
the
lead/inkling2-mini
branch
4 times, most recently
from
November 24, 2026 09:43
aefb063 to
c41911e
Compare
Owner
|
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
|
Owner
|
Thank you, @sethforprivacy. Every commit this PR adds is now on main inside #4387 with your authorship kept, so it ships with Inkling 2 Mini on Metal in the next release. Closing this one as landed there.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Before: on #4387's head the native server does not compile; once it does, every Metal reply is token 0, because
norm()bindssp_norm's output and its arguments in each other's slots; and with that fixed, every stream after the first in a shared forward is wrong, because its relative rows are read from past the end of their scratch. After:zig build nativecompiles, the Metal path answers correctly on the released checkpoint, and concurrent replies equal their solo runs.This is a proposal on top of #4387, opened as a draft so the fixes can be read as commits. Take them into #4387 in whatever form suits you.
3e0e9bcb83(this pull request targets its branch). Its own commits are992258230(the build),c68340d31(the norm) and97c91058f(the shared forward).atc overlap --json: not run; ATC is not installed on the machine that pushes. The three commits touchtensorfold.zig(one added line),families/inkling2/metal/model.zig(one line) andfamilies/inkling2/metal/forward.zig(norm()and two offsets inattendSegments).The three commits:
core/checkpoint_metal.zigandmetal/model.ziguse@import("core").checkpoint_file_cacheand@import("core").checkpoint.shardFiles.core/root.zighas both; the native roottensorfold.zighas neither (therecheckpointischeckpoint_metal). The fix exportscheckpoint_file_cachefromtensorfold.zigand takesshardFilesfromcheckpoint_host, which both roots name the same.sp_normtakes its arguments at buffer 2 and its output at 3.norm()bound the output at 2 and the arguments at 3, so the kernel read a width of 0 from the zeroed output buffer and wrote nothing. Every normed input stayed zero, and so did the logits.rel_prepholdsrel_width(384) BF16 values a row, 768 bytes.attendSegmentsoffset a segment's rows in it bybase * 24 * ap.extent * 2, 49,152 bytes a row, which isrel_tab's stride. Segment 0 is at offset 0 either way, so one stream is right; a later segment'stf_ink2_prepwrote, and itstf_ink2_rel_tableread, past the end of the buffer. The offset is nowbase * state.rel_width * 2in both places.Checks on this head
97c91058f, on Inkling 2 Mini on CUDA and Metal #4387's3e0e9bcb83.lean_new.py, this head's checker on both).zig build native -Dcpu=apple_m1: compiles (on3e0e9bcb83it stops with the two errors above).zig build test-inkling2-metal-host test-inkling2-host test-inkling2-controls-host test-inkling2-launch-map-host test-inkling2-metal-capabilities compile-inkling2-native-host -Dcpu=apple_m1: exit 0.tf-kernel-contract --only inkling2(-Doptimize=safe):SUMMARY 41 kernels: 41 pass gates 1-4, 0 fail, 0 known findings; 41 controls: 41 red as planted, 0 missed; 0 limit problems, exit 0.zig fmt --check build.zig zigandgit diff --check: clean.zig build test test-goldenon this exact head. On the same two commits with the later speed commits on top it leaves 7 failed steps, and Inkling 2 Mini on CUDA and Metal #4387's own head leaves the same ones plus its two compile errors (rollback_testlone keep twice, the DeepSeekvision_configtest twice,cuda_keep_others_test,contract.registry, and thememcpylink check). No test for the norm binding or the segment offset is added: nothing in the tree runsforward.zigon a device without a checkpoint, and I did not want to invent a fixture for your branch. The two-segment comparison above would make that test once a fixture exists. CUDA, HIP, Linux and Windows are not reached.Receipt
inkling2_loopMetal path only.c68340d31, Zig 0.17.0, Xcode's Metal toolchain, Mac Studio M5 Ultra (256 GB), macOS 27.0,thinkingmachines/Inkling-2-Mini@ed40e7da625f594fc9c4990f5f66be24873c22d7. The load also needs the pread cap of checkpoint_metal: clamp pread chunks to INT_MAX #4433 or Metal loader: a checkpoint span of 16 GiB or more loads (each pread capped at 1 GiB) #4435, applied locally for every run here.token_sha 0bf3c7a5bfdb.--parallel 4, 16 tokens each, Inkling 2 Mini on CUDA and Metal #4387's kernels untouched: before, the first matches its solotoken_shaand the second does not (0f4d5903a542solo,99d692cea3cctogether); after, both match. How it was found: two caches fed different prompts, then 40 teacher-forced steps each run solo and as the two segments of onerunShared, comparing logits. Before: segment 0's worst difference is 0 and segment 1's is 3.7 to 8.9 at every step, withrel_tabthe first scratch buffer that differs in the first visit. After: 0 for both over all 40 steps. With the speed commits of Inkling 2 Mini on Metal: experts, gates, router, depth mix, combine, row batching, attention chunks and a concurrent forward (1,159 to 14 ms a row on M5 Ultra) #4448 on top,bench_concurrent.py --alone --serialat four streams gives 12 of 12 equal, plain and with the drafter.tools/bench_openai.py: not run at this head. A 50-token reply decodes at 0.86 tok/s; the breakdown is in the report on Inkling 2 Mini on CUDA and Metal #4387, and the speed work is its own draft.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo. (Concurrent equals solo now. A prompt fed in chunks of 64, 16, 7 or 1 rows gives the sametoken_sha. Resumed from a kept state not run.)