Repository navigation
Conversation
- Preserve the original release NVFP4 and MXFP8 expert weights and execute the looped text backbone on one Metal device. - Keep the bundled DSpark head and plain prompt-cache reuse in the native lane backend. - Refs ashhart#4274. Local M4 Pro evaluation, separate from the upstream full port.
- Keep the original vision tower, PNG/JPEG preparation, and the separate device and operator checks on the full integration branch. - The padded-image real-weight accuracy gate remains open. This commit is not part of the text-only review branch.
- Match pinned Transformers eager QK and scaling boundaries before FP32 softmax. - Keep the trained padded-image projector bound unchanged.
- Keep original NVFP4/MXFP8 checkpoint bytes and decode weights in registers, using BF16 activations and FP32 sums. - Match pinned Transformers conversion and SwiGLU/route precision, with packed-weight and zero-scale controls. - Refs ashhart#4274. Local original-weight M4 Pro qualification; not an upstream submission.
- Keep the shader and probe comments within the repository lean rules; no arithmetic changes.
- The rebase dropped the alias main uses for slide refusal, so the native server did not compile.
…-ups - Comments are one line each again (339 runs collapsed, 40 shortened) and no `/*` text remains, so lean_check.py adds nothing to the base's 168 problems. - TF_INKLING2_MINI_SMOKE reads through platform/environment.zig: a .metal/.path row, a docs row and a valid case in environment_test.zig. - The load check sums every model*.safetensors shard, as core/checkpoint.zig lists them, plus mtp.safetensors when drafted. - The state-bytes test covers Mini's looped shape: 24 physical layers as 48 visits, 8 global, visit 41 at physical 17. - A new contract control isolates the experts' down projections; --loops and --policy refusals have a test that names them. - The cacheBudget doc comment and the CHANGELOG state the DSpark prompt-cache limit: kept states need --no-drafts. - The Inkling 2 contract suites move to metal_inkling2_main.zig, holding their probes for the run, which keeps metal_main.zig under 600 lines. - The NVFP4 outer factor stays the unrounded quotient, pending the maintainer's F1 decision.
…ites - `zig fmt --check build.zig zig` (what the Zig format workflow runs) is clean; the new suites and loaders had drifted. - Layout and `@intFromEnum` -> `@backingInt` only: the contract, native, vision, forward and environment checks are rerun green on this tree.
…w projections - Score GEMMs are a full fp32 dot, off the tensor-unit operand cut, so an M5 matches the product measured on earlier chips. - One-row projections that share an input use one launch of the existing matvec lane chains. Same checkpoint token hash, about 2 ms off a 57 ms decode token.
- zig fmt on the forward layer, and the score-GEMM note is one line so lean check stays at the base count.
- Drop the blank lines zig fmt --check rejected on the projection fuse.
- f32_nt and f32_nn were filled from bf16 dyadics, so a 10-bit operand cut still matched the float64 product. - Wide inputs now set the low fraction bits. On this M4 Pro the gates pass at 0.337 and 0.354 of the bound.
- Gate-down walked all 64 ranks in one threadgroup. Eight ranks a group, each rank's sum order unchanged. - Decode on this M4 Pro is 23.2 tok/s, from 16.9, hash 57519a5a167f unchanged. - Prefill chunks are 512 rows. A 1056-token prompt prefilled at 81 tok/s.
…v_fuse, and fused decode kernels
8 tasks done
This was referenced Nov 22, 2026
Open
Contributor
Author
17 tasks
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 #4337 (
8d54cafcd4), Inkling 2 Mini Metal ran per-rowexperts_dotacross all prompt widths, lacked NAX prefill attention and multi-TG decode attention, used scalar 1-rowmv_fuse, and serialized ~1,056 dispatches per decode token (~387 tok/s 16K prefill on Apple M5 Ultra, ~101 tok/s on Apple M5 Pro). After: adds indirect-worklistBM=32, BN=64grouped NAX/SIMD MoE (experts_grouped_naxforrows >= 17, preserving bit-identicalexperts_dotforrows = 1..16with branchless E4M3 LUT),inkling2_attn_nax(rows >= 64) + per-Q-headinkling2_attn_decode_fast(rows < 64), 3-tierdenseRows(rows >= 64NAX 64x64,16..63bit-equalmv_mma,< 16mv), coalescedbfloat4multi-rowmv_fuse(rows <= 16), 7 bit-exact fused decode glue kernels (~520 dispatches/tok and ~146 barriers/tok saved), and.concurrentencoder with hazard barriers.max_rows=1024, andTarget.warm()are stacked on this PR in a follow-up draft).8d54cafcd4); this PR adds 1 commit (8b29cbedfb, 22 files).atc overlap --json: Checked with--base 8d54cafcd4(2026-11-22T00:25Z); zero overlap on anyinkling2Metal file against open PRs (onlyzig/tests/contract/metal_limits.zigoverlaps older open PRs in area 7).Checks on this head
8b29cbedfb(stacked on Metal: experimental Inkling 2 Mini text, vision and bundled DSpark #43378d54cafcd4)python3 tools/zig/lean_check.py, on the base and on this head: 168 on base (8d54cafcd4), 168 on head (8b29cbedfb), 0 new findings.zig build native dev-tools -Doptimize=ReleaseFast -Dcpu=apple_m1— passed, 0 errors.zig fmt --check build.zig zigandgit diff --check— clean.tf-kernel-contract --only inkling2— 86/86 kernels PASS, 85/85 planted controls RED, 0 missed, 0 limit problems on Apple M5 Ultra, Apple M5 Pro, and Apple M3 Ultra (details below).Receipt
8d54cafcd4baseline onthinkingmachines/Inkling-2-Minied40e7da625f594fc9c4990f5f66be24873c22d7, measured at full stack headbf46d5b75bwithtools/bench_openai.pyandtools/bench_concurrent.py,T=0.0):--prompt-cache-gib 0):387 tok/s(56.0sTTFT) →2,575.4 tok/s(8.03sTTFT, 6.65x)c=1fibonacci-raw/gpu-chat:39.1 / 38.9 tok/s→41.62 / 41.57 tok/sc=4chataggregate:81.0 tok/s→127.6 tok/s(132.0steady, +63%)c=1fibonacci-raw/gpu-chat:52.3 / 46.4 tok/s→80.15 / 54.84 tok/s(93.1–108.7 tok/son prefill continuation)101 tok/s→840.7 tok/s(8.32x)c=1/c=4chat:25.6 / 41.5 tok/s→28.30 / 69.1 tok/s(73.3steady)c=1fibonacci-raw/gpu-chat:24.1 / 24.1 tok/s→40.30 / 29.89 tok/s1,257.5 / 1,222.5 tok/sc=1/c=4chat:31.58 / 96.7 tok/s(102.8steady); DSparkc=1fibonacci-raw:58.41 tok/sinkling2Metal kernels, ops, experts, forward pass, and Metal contract tests.#4337(8d54cafcd4), head8b29cbedfb(stack headbf46d5b75b), Zig 0.17.0, Xcode Metal 4.0 toolchain, Apple M5 Ultra 512 GiB / M5 Pro 64 GiB (macOS 27.2.1) & M3 Ultra 512 GiB (macOS 26.6.2),thinkingmachines/Inkling-2-Minied40e7da625f594fc9c4990f5f66be24873c22d7with bundledmtp.safetensors.inkling2text prefill, decode, and DSpark verify across M5 (NAX) and M3 (TF_SIMD_FRAGS); verified on M5 Ultra, M5 Pro, and M3 Ultra; M1/M2/M4 not run on hardware.T=0.0,token_sha256on Apple M5 Ultra 512 GiB):p15:plain=a5077f27220d93ba,dspark=a5077f27220d93ba(100% match)p33:plain=114eb7bb615a3609,dspark=114eb7bb615a3609(100% match)p184:plain=da48844b05981221,dspark=da48844b05981221(100% match)tools/bench_openai.py(--tokens 256 --reps 3 --temperatures 0).512/2048/8192/16384,--prompt-cache-gib 0), posted above.Kernel contract, only when a GPU kernel is new or changed
inkling2_exp_bucket,inkling2_exp_grouped_{gate_up,down}_{nvfp4,mxfp8}(replacesexperts_dotforrows >= 17; registered ininkling2_expert_records.zigand tested inmetal_inkling2_experts.zig)inkling2_attn_nax(replacesattention.metalforrows >= 64) andinkling2_attn_decode_fast(replacesattention.metalforrows < 64, heads >= 24; both registered ininkling2_metal_ops_records.zig+metal_limits.zigand tested inmetal_inkling2_attention.zig)inkling2_mv_fuse(multi-rowbfloat4vectorized upgrade, registered ininkling2_metal_ops_records.zig)fused_decode.metal(bit-exact fused decode glue kernels wired inmetal_fused_ops.zig/metal_forward_layer_fused.zig)metal_inkling2_experts.zig(NVFP4 outer factor skip, MXFP8 pre-SwiGLU BF16 rounding skip, NVFP4/MXFP8ks=16substep skip) — all 4 red as planted; fixed upstreammetal_inkling2_loop.zigmutation string; all 85/85 controls red.SUMMARYline and exit status:applegpu_g17, tensor unitstrue):SUMMARY 86 kernels: 86 pass gates 1-4, 0 fail, 0 known findings; 85 controls: 85 red as planted, 0 missed; 0 limit problems; gates 11365 ms, limits 557 ms(exit 0)applegpu_g17, tensor unitstrue):SUMMARY 86 kernels: 86 pass gates 1-4, 0 fail, 0 known findings; 85 controls: 85 red as planted, 0 missed; 0 limit problems; gates 11786 ms, limits 163 ms(exit 0)applegpu_g15, tensor unitsfalse):SUMMARY 86 kernels: 86 pass gates 1-4, 0 fail, 0 known findings; 85 controls: 85 red as planted, 0 missed; 0 limit problems; gates 12862 ms, limits 303 ms(exit 0)Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.--drafter, no slower than without it, greedy and sampled.