Skip to content

Inkling 2 Mini runs whole on my Spark, groundwork for RTX Spark - #152

Merged
plotarmordev merged 98 commits into
mainfrom
feat/188-inkling-2-mini-runs-whole-on-our-spark-g
Nov 24, 2026
Merged

plotarmordev merged 98 commits into
mainfrom
feat/188-inkling-2-mini-runs-whole-on-our-spark-g

Conversation

@plotarmordev

Copy link
Copy Markdown
Owner

Inkling 2 Mini (thinkingmachines/Inkling-2-Mini, revision ed40e7da62) runs whole on my GB10 (TOP), built on Ash's ashhart#4387 and jschmied's ashhart#4364, ashhart#4365 and ashhart#4441, with their commits kept.

  • inkling2_loop is served by inkling2: Inkling 2 Mini served on CUDA at one rank (H2 + C4), stacked on #4364 and #4365 ashhart/TensorFold#4441's engine. Inkling 2 Mini on CUDA and Metal ashhart/TensorFold#4387's serving checks run against it: device draws against host selection, fresh against resumed prompts, and two streams in shared rounds.
  • docs/recipes/inkling-2-mini-cuda/run-script.sh runs on the GB10 and covers:
    • the serving checks
    • the kernel contract
    • the float64 reference and its planted control
    • first-token time, prompt speed, decode speed and memory at 1 and 4 streams
  • After the build, everything runs inside timeout 600.
  • Receipt from job top-0b05213c9f06:
    • 0 of 32 greedy tokens differ from the float64 reference; the planted control differs at 6.
    • Decode: 32.9 tok/s at one stream, 118.8 tok/s at four. All four streams send the same prompt.
  • Config parsing refuses three kinds of checkpoint before loading: attention-residual block counts above the mix arrays, and head_dim or d_rel widths the kernels don't hold.
  • The recipe README has my note on what RTX Spark (N1X, Windows and WSL2) needs.

jschmied has since closed ashhart#4441 as superseded by ashhart#4387's stack, so an upstream version must move to that stack. Nothing here is sent upstream.

Local card 188; the changelog entry is changelog.d/188-inkling-2-mini-runs-whole-on-our-spark-g.md.

jschmied and others added 30 commits November 21, 2026 13:07
Every Inkling 2 CUDA kernel but the EXL3 expert epilogues now also runs at
Inkling 2 Mini's one-rank shapes (hidden 2,304, 24 over 8 key heads, k/v
width 1,024, 128 experts top 8, floor 8,192, one 201,024-wide vocab row),
each with its planted control. No kernel source changes: the widths were
already arguments. Small's registrations keep their names, shapes and seeds.

Host checks refuse what the kernels cannot hold, by name: Inkling2MixWidth,
Inkling2RouterShape, Inkling2ConvHeads, Inkling2Heads.
…SwiGLU in core

Core grouped experts gain Format.mxfp8 (e4m3 codes times one E8M0 scale per row per 32 inputs, folded
exactly into the bf16 mma operand, fp32 sums) and Layer.caps, Inkling's soft-capped SwiGLU epilogue
(experts.cuh epilogue 4) on the NVFP4 decode and prompt kernels and on the new MXFP8 ones. NVFP4's
per-expert factor is amax / denominator, each rounded to bf16 (experts_mx.nvfp4Factor, open question F1).

Evidence: stored-experts contract 9 kernels pass gates 1-4, 7 short-K controls red; checkpoint layers 0
and 20 decode bit for bit on every weight of 128 experts, outputs within the fp32 bound; SASS of all
465 pre-existing (unit, sm, function) triples equal main on sm_80/86/89/120/121.
… checked on the GPU

experts_mx.splitGateUp takes stored row 2j to gate j and 2j + 1 to up j before packGateUp (the kernels are
unchanged); a host test plants a code in stored row 1 and requires it in the up part. The checkpoint
reference reads row 2j + m. stored-experts ckpt adds E8M0 bytes 0 to 240 through tf_mxfp8_down_f32
against the host decode (byte 0 = 2^-127).
…dule on it

core/visit_plan.zig walks prelude, core x passes and coda, numbering each
state kind's slots in run order, with enter/leave per pass and taps as
step inputs or the post-norm output. Dory's schedule.build now uses it;
its Step, Schedule and tests are unchanged (test-dory-host 43 pass,
3 skip, same as main).
…an, controller and cross-pass names

inkling2_loop parses its loop_config (is_varloop refused, core in whole blocks, passes >= 2, rank <= 128) and
counts the drafter's taps by visit. The plan walks the visits through core/visit_plan.zig with a sliding, full
and conv slot kind. names.zig adds the four controllers a core layer and the two cross-pass query tables; each
layer's expert precision stays read from its w13 dtype. The quantization_config goes through core.modelopt
(admitByTensors, std-only modelopt_config.zig split out so host-only tests import it). Fixtures: Mini's
config.json and its two headers folded (1244 + 54 tensors, sha256 of the unfolded lines).
…ates, core experts

Weights load layer by layer through core.checkpoint (ModelOpt admitted by core.modelopt). Experts run as core
cuda.experts: NVFP4 in L0-19 and MXFP8 in L20-23. Each stream holds 48 visit slots (40 sliding, 8 full, 48 conv).
The loop mix and controller gates (loop.cu) stand in for C2/H3 and use ashhart#4337's arithmetic. A float64 host
reference (mini_ref.zig) checks the greedy tokens. tf-cuda-test inkling2-mini runs on the real checkpoint:
- greedy output is coherent;
- a prompt cut into chunks of 1 or 7 gives bit-equal last-row logits and equal tokens;
- 4 streams together give the same tokens as each alone.
…): inkling2_loop, text only

Each stream gets a cache slot of 48 visit slots. A prompt takes one 512-row chunk a step. A round runs one-row
windows over every stream in a single forward. It offers no drafts and no copies: a conv state has no rollback here.
Refused by name before any load: --loops (the pass count comes from loop_config), a drafter (C5) and captured
kernels. A prompt holding the image token is refused (C6). Streams are fitted to the room at open, as in Dory.
…ates spread over the GPU

- Decode forwards of n one-row windows replay as CUDA graphs keyed by n.
- A one-row forward runs q, gate, rel, sink (and k, v when they share the input) as one product. It uses a single
  packed buffer per layer, with views pinned to the parts' own K slices, so the bits are unchanged.
- Before this, the loop gates ran on 1-3 blocks at decode, about 35% of GPU time. They now spread over rank and
  output blocks. Each output keeps its summation order.
Greedy ids on the real checkpoint are identical to C4a. c=1 is 22 -> 33 tok/s, c=4 63 -> 79 tok/s.
The server's default drafts flag is no longer refused: there is no head, so nothing is drafted.
The tiny checkpoint's 128-wide rel_logits_proj is zero-padded to the kernels' 1024. Mini's is uploaded as stored.
tf-cuda-test inkling2-mini-xcheck compares top-2 logits against ashhart#4337's Metal forward on prompts teacher-forced on
another engine's tokens.
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.
…A/B switch

Prompt-cache states:
- A stream's state at a prompt mark holds each of the 48 visits' K and V: the full caches through the mark, and
  the sliding rings' last 1,023 positions. It also holds every visit's four conv states.
- The states are saved and restored through the native store's snap_* hooks.
- tf-cuda-test checks restored == fresh bit-equal. Its planted control restores another prompt's state and goes red.

The round_caps A/B switch:
- experts.Layer.round_caps rounds the gate and up sums to bf16 before Inkling's soft caps, in the EPI 4 epilogue
  (a negative up cap). It is off by default and the default bits are unchanged.
- The float64 reference and the tests take INKLING2_ROUND_CAPS=1.
- On the tiny checkpoint it does not close the one CUDA-vs-Metal top-1 difference outside Metal's tie list.
# Conflicts:
#	zig/src/core/contract/registry_union.zig
#	zig/src/native/metal.zig
#	zig/tests/cuda/contract_limits.zig
#	zig/tests/fixtures/gradient-serving.tsv
…n; 4-stream receipt names its identical prompts
…glibc 2.40 loader, not the job image's 2.36 (GLIBC_2.38, GLIBCXX_3.4.32 missing)
…le-on-our-spark-g' into feat/232-inkling-2-mini-on-our-spark-size-speed-a

# Conflicts:
#	docs/recipes/inkling-2-mini-cuda/llama-cpp-baseline.sh
…nsorFold on TOP's GB10 (job top-b77911768550)
…very check inside timeout 600, 32.9 tok/s at one stream, 118.8 at four
…, labels the free run as text, pins the b12611 source tree and gcc archive
…s pair arguments and the soft-cap limit2; host test drops promptSmem asserts main moved to experts_prompt_layout.zig
…le-on-our-spark-g' into feat/232-inkling-2-mini-on-our-spark-size-speed-a
…s llama.cpp's cached and cold-only cells, pairs like figures
…our-spark-size-speed-a

Inkling 2 Mini on our Spark: size, speed and quality against Unsloth's GGUF on llama.cpp
…ni-runs-whole-on-our-spark-g

# Conflicts:
#	THIRD_PARTY_NOTICES.md
#	zig/build/cuda_kernels.zig
#	zig/build/inkling2_host.zig
#	zig/build/metal_targets.zig
#	zig/src/core/contract/inkling2_attn_ref.zig
#	zig/src/core/contract/inkling2_cuda_records.zig
#	zig/src/core/contract/inkling2_experts_records.zig
#	zig/src/core/contract/inkling2_ops_records.zig
#	zig/src/core/lanes/fake.zig
#	zig/src/core/lanes/rollback_test.zig
#	zig/src/core/profile.zig
#	zig/src/cuda/kernels.zig
#	zig/src/families/inkling2/config.zig
#	zig/src/families/inkling2/config_test.zig
#	zig/src/families/inkling2/host_test.zig
#	zig/src/families/inkling2/inkling2.zig
#	zig/src/families/inkling2/loop.zig
#	zig/src/families/inkling2/metal/attention_plan.zig
#	zig/src/families/inkling2/metal/backend.zig
#	zig/src/families/inkling2/metal/forward.zig
#	zig/src/families/inkling2/metal/model.zig
#	zig/src/families/inkling2/metal/runtime_test.zig
#	zig/src/families/inkling2/metal/serving_test.zig
#	zig/src/families/inkling2/metal/snapshot.zig
#	zig/src/families/inkling2/metal/state.zig
#	zig/src/families/inkling2/names.zig
#	zig/src/families/inkling2/names_test.zig
#	zig/src/families/inkling2/plan.zig
#	zig/src/native/cuda_families.zig
#	zig/src/native/inkling2.zig
#	zig/tests/cuda/contract_inkling2.zig
#	zig/tests/cuda/contract_inkling2_attn_prep.zig
#	zig/tests/cuda/contract_inkling2_attn_rows.zig
#	zig/tests/cuda/contract_inkling2_ops_mix.zig
#	zig/tests/cuda/contract_inkling2_ops_route.zig
#	zig/tests/cuda/contract_inkling2_ops_rows.zig
#	zig/tests/cuda/contract_limits.zig
#	zig/tests/cuda/inkling2_serving_tests.zig
#	zig/tests/cuda/main_usage.zig
#	zig/tests/fixtures/gradient-serving.tsv
…le-on-our-spark-g' into feat/188-inkling-2-mini-runs-whole-on-our-spark-g
…usal through the merge

Restores Seth For Privacy's 7a5c0da (via b7faf6d), which the merge of origin/main dropped.
…pacity test through the merge

Restores Seth For Privacy's 7a07321 (via 14bbdf4 and f12f0fe), which the merge of origin/main dropped.
…ugh the merge

Restores Seth For Privacy's 1ba8d16 and 3697114, which the merge of origin/main dropped.
…esh turn through the merge

Restores Seth For Privacy's 25dc1ac, which the merge of origin/main dropped.
… of origin/main brought back unreachable

ashhart#4441's engine serves inkling2_loop here (as 9f542e6 decided); the merge re-added cuda_native, loop_* and the
loop_math image and contract tests without wiring them.
's engine

Ports jschmied's crossPrompt check (c79a58f) from origin/main's serving tests.
@plotarmordev plotarmordev changed the title Inkling 2 Mini runs whole on our Spark, groundwork for RTX Spark Inkling 2 Mini runs whole on my Spark, groundwork for RTX Spark Nov 24, 2026
@plotarmordev
plotarmordev merged commit b6cd341 into main Nov 24, 2026
@plotarmordev
plotarmordev deleted the feat/188-inkling-2-mini-runs-whole-on-our-spark-g branch November 24, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants