Skip to content

Inkling-2-Small: Serve on two GB10s from an EXL3 pack - #4841

Open
ajensenwaud wants to merge 45 commits into
ashhart:mainfrom
ajensenwaud:ink-small-tp2
Open

ajensenwaud wants to merge 45 commits into
ashhart:mainfrom
ajensenwaud:ink-small-tp2

Conversation

@ajensenwaud

@ajensenwaud ajensenwaud commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Inkling 2 Small has its kernels in TensorFold through #4125, #4126 and #4127, but nothing serves it yet. A pair of DGX Sparks can hold Small at 2.2 bits a weight, which is how people run it today, but that needs a loader for the pack and a runtime that splits the model across the two machines. This PR adds both.

What this changes

  • Pack. A standard exllamav3 1.x EXL3 pack on the mul1 codebook loads as it comes from exllamav3. Any other codebook, version or format is refused by name before a tensor is read. The reader is our own and sits beside inkling: load EXL3 packs through the shared family plan #3612, which reads kortexa's pack format.
  • Ranks. Rank 0 serves and drives rank 1 over NCCL, and each layer's partial sums cross by RoCE writes. Each projection and expert is cut to its rank when it loads.
  • Serving. One stream gets the model's full 1,048,576-token window, or several streams share each decode step. Prompts run in 2,048-row chunks, kept prompt states resume a conversation, and images go through the vision tower.
  • Scope. The KV cache is bf16 and a stream decodes one token a step. The DSpark drafter, fp8 KV and the faster-decode switches come in follow-up PRs.
  • Switches. TF_INKLING2_RANK and TF_INKLING2_WORLD name a rank, with rows in docs/environment.md. docs/recipes/inkling-2-small-cuda.md has the run commands.

Rebased onto main 37d4ce7b1, where #4127 has landed, so every commit on the branch is this PR's.

Checks on this head

  • Equality. On raw prompts, all 42 replies have the same token ids as before the rebase. Chat prompts are two tokens shorter since main's eea0560bb, which renders thinking off as effort level 0, so chat replies are checked within the run.
  • Concurrency. Four and eight requests at once give the same tokens as each request alone, in both the served cases and bench_concurrent.py.
  • Resume. A conversation resumed from a kept prompt state gives the same tokens as a fresh one at 21,857 prompt tokens.
  • Cache. That resumed turn reads 20,480 tokens from the prompt cache and starts answering in 3.9 seconds, against 61.4 seconds the first time.
  • Graphs. Graphed decode matches eager decode on all 46 steps.
  • Speed. One stream decodes at 31 tokens a second, and four streams reach 69 to 71 in total.
  • Host. All 860 build steps of zig build test test-gradient-serving compile-cuda-tests -Dfixed-cpu pass, with 13,404 of 13,500 tests (96 skipped). lean_check finds no new problems, and every Zig file is at most 600 lines.

The device runs happened on 24 November on two GB10s against ajensenwaud/inkspark-2dgx at aa29f3a0. Equality, concurrency and resume ran again on 4 December on this head, 453fd5cb1; the host run is from d67d65682, the same patch on main ef4dd750b. The cache and speed figures come from 6b579b2a0 on main 0300dfbfe, before the rebase; graph replay ran again on this head, with 46 of 46 steps bit-identical.

Receipt

Commits.

  • 3188b50eb: load standard exllamav3 packs with two-rank cuts.
  • 59989d0d0: serve Small on two GB10s from an EXL3 pack.
  • 9dc3b1947: add the Inkling 2 Small CUDA recipe page.
  • ee34a83bd: choose a stream's slot before publishing its lane.
  • 7331c11aa: compare every shard byte across the ranks at ready.
  • d932d528c: make a call's scratch safe to free at every failed allocation.
  • 17 later commits answer the review rounds and adapt the branch to main.

Size. 33 files, +3,939 / -12 over main. Shared files take +38 / -9; the rest is new under zig/src/families/inkling2/ and docs/recipes/.

Hardware. Two DGX Spark (GB10, sm_121), RoCE between them, bf16 KV, 12 GiB reserve a rank, images on.

Token equality (bench_concurrent.py --alone --serial, raw prompts either side of the 256-row prompt GEMM threshold, one, two and four at once, greedy and seeded, 64 tokens each): 42 of 42 replies have the same token ids as the run of 25 November before the rebase. The 29 chat cases of tools/g3-equal/ab_tokens.py (chat, code, agent and report prompts, 3,419 and 21,855 prompt tokens, four- and eight-request runs, a resumed run and an image, 256 tokens each) render two tokens shorter since eea0560bb, so none equals the earlier run. Within the head, the four- and eight-request runs equal the single ones, and the resumed run equals the fresh one.

Prompt cache. A follow-up chat turn on a 21,857-token conversation:

Turn Cached tokens TTFT s
First 2,048 61.4
Resumed 20,480 3.9

bench_cache.py (token-id prompts from the pack's tokenizer, 64 tokens): raw completions keep no prompt state, so every repeat runs cold with 0 cached tokens. Repeated and concurrent replies equal the first.

Prompt tokens TTFT s, first TTFT s, repeat Two at once, makespan s
2,000 6.0 6.0 14.5
7,999 24.0 23.9 50.5
32,017 95.8 96.0 194.9

spark-bench (bf16 KV, 512 tokens, chat/code/agent/report):

Streams Per stream tok/s Total tok/s TTFT p50 s
1 31.2 to 31.6 30.7 to 31.2 0.23 to 0.31
2 24.1 to 24.5 47.5 to 48.3 0.34 to 0.47
4 17.6 to 18.2 69.2 to 71.5 0.55 to 0.72

bench_openai.py (256 tokens, 3 reps): 31.9 tok/s on fibonacci-raw at temperature 0, 31.9 on gpu-chat-no-think.

bench_concurrent.py (--alone --serial): equal to alone at 1, 2 and 4 streams on code and chat, 0 unequal.

Graphs. tf-inkling2-engine graphs: 46/46 steps bit-identical, 5 captured, 41 replayed, on 7c7998de4, an earlier head of this branch on main 0300dfbfe.

Kernel contract. No new kernels; the PR runs on #4125, #4126 and #4127.

Notices. THIRD_PARTY_NOTICES.md credits exllamav3 (MIT) for the EXL3 format and HF transformers (Apache-2.0) for the layer order.

@ajensenwaud
ajensenwaud force-pushed the ink-small-tp2 branch 2 times, most recently from e97933a to f6f897a Compare November 24, 2026 06:16
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you, @ajensenwaud. The aligned rank cuts, slot-aware cache states and explicit image-cache handling are good foundations. The pinned pack and concurrency receipts help.

Three source issues need fixing. In lanes.zig, the new map entry is inserted before pick scans its values, so it reads that entry's uninitialized slot; choose the slot before publishing the entry and cover failed initialization. In engine.zig, checkpoint_digest stays all zero, so the rank-ready check cannot reject different checkpoint bytes. Please populate the real content identity and add a mismatch control. In forward.zig, partial allocation cleanup reads the still-uninitialized ids or logits buffer; please make cleanup safe at each failure point.

Please retain serial equality across the prompt GEMM threshold and shared-kernel changes when checking the corrected tree. The changelog conflict can be handled at integration.

  • Synthena

@AIFlowML

Copy link
Copy Markdown
Contributor

On 5fee538c366f5842b950a774a77dd8f68179b45a, zig build test-inkling2-host test-inkling2-cuda-host check-native-cuda-host -Dfixed-cpu -j2 --summary all passed 122 tests with four skips on Apple silicon. The revised CUDA host suite passed 77/77, including the lane insertion, pack identity, and partial-allocation cleanup cases. The build also compiled the native adapter for aarch64 Linux.

The pack fixture changes a payload byte and checks the resulting digest. To cover readiness end to end, the remaining receipt would be a two-rank run that confirms identical packs reach ready and mismatched packs stop with CheckpointBytesDiffer before either rank serves. I did not run NCCL or checkpoint serving in this pass.

I tested the PR head directly. A trial against d1ff890729 has seven conflicts, including the native CUDA family registration and the Inkling expert contract, so it still needs an integration run on current main.

Igor Lessio - AIFLOW LABS

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash, and thanks @AIFlowML. All three are fixed in 5fee538c3, which now sits on your #4127 head 467dbe87b.

  1. Lanes. A new stream's slot is chosen before its lane goes into the map, so pick never reads an entry without a slot. A failed choice leaves no entry behind, and a host test covers both cases.
  2. Checkpoint identity. Each rank now hashes every shard byte while the weights load, and the ready check compares the two digests. A host test shows that one changed byte changes the digest. On two GB10s, identical packs reach ready, with each rank hashing 154.9 GiB beside the load. When rank 1's copy of the pack has its last byte flipped, both ranks stop with CheckpointBytesDiffer and the server never answers.
  3. Scratch cleanup. The token-id and logits buffers start empty, so cleanup is safe at every failure point. A fake-driver test fails each allocation in turn and checks that everything made is freed.
  4. Equality. On this head, prompts of 200, 299, 2,246 and 2,347 tokens, either side of the prompt GEMM threshold, give the same tokens alone and at two and four streams, greedy and sampled. All 28 served cases equal the same patch's earlier run on main 68ff0ad8e. Every case differs from the release build because of main's db36991e0, which normalises before the query reductions in tf_ink2_mix. With that one change reverted, all 28 match the release again.

zig build test passes 13,404 of 13,500 tests on this head, with 96 skipped. Main has since moved shared files that this PR and #4127 both edit, so I'll resolve ours once #4127 lands.

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thanks @ajensenwaud. Slot selection now happens before publishing the lane, and the call buffers start empty before cleanup. The new shard-byte test and reported two-rank mismatch run also close the changed-weight case.

Two fixes remain. The ready digest includes shard bytes but not the effective config, so identical shards with different valid RMS epsilon values can still pass. Please bind that config into readiness and cover a config-only mismatch. Prompt resources also need cleanup if plan insertion, symbol lookup or later engine setup fails. In Engine.init, cleanup still uses the older module copy rather than the copy holding the new prompt resources.

The new threshold and concurrency comparisons are useful. Keep the release-reference difference explicit when checking the corrected tree. Integration conflicts are on our side.

  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. Both are fixed in f481bf083, on top of 5fee538c3 with no rebase.

  1. Config. The ready digest now covers the parsed config each rank runs, plus its context and image limits, beside the shard bytes. A host test changes only rms_norm_eps in config.json and shows that the digest changes, as it does for a different context, image limit or shard byte. A mismatch stops both ranks through the same check as a changed shard byte, and the refusal now names settings as well as packs.
  2. Prompt cleanup. Engine.init now cleans up its own copy of the modules, which holds the prompt projections and the grown scratch. The kernel lookups run before any allocation, and a failed plan insertion destroys its plan. Two fake-driver tests fail the module load, each allocation and the plan insertion in turn, and check that everything made is freed. A later setup failure now also frees the vocabulary spans, the graph cache and the partials list.

No kernel or arithmetic changed, so the earlier device results stand, including the release-reference difference that main's db36991e0 causes. test-inkling2-cuda-host passes 80 of 80.

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you @ajensenwaud. The ready digest now includes the effective config and stream limits, with a config-only control. The prompt plan has an insertion guard, symbol lookup precedes allocation, and engine cleanup uses the module copy that owns the prompt resources. Those source asks are closed.

This is ready for an exact comparison after integration. Please keep the agreed serial-reference gate and the release-reference difference explicit; the earlier token receipts remain credited.

  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. CI on your rebased head 3c262e577 fails to compile in one place. Main added layer_norm_eps to the shared vision config, and the CUDA tower's test config in vision.zig does not set it. The zig, zig-b and zig-windows jobs all stop on that error.

I have a fix ready as one commit on top of your head: the tower reads its eps from the config instead of a constant. The release config sets 1e-5, which is the constant's value, so the tower's arithmetic is unchanged. On that commit, test-inkling2-cuda-host passes 80 of 80. I'll push it unless you are already handling it.

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Pushed as 0bc9ed6a0. The branch now conflicts with main in five files, so CI has not run on it. Happy to rebase if you'd like me to.

@ashhart

ashhart commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Thanks @ajensenwaud for the Inkling 2 Small CUDA work. I found two issues to fix:

  • Prompt and pending token IDs are not checked against the checkpoint vocabulary before a tensor-parallel step is published. An out-of-range ID can therefore reach the embedding table index and read out of bounds. Please reject the complete prompt and every pending ID before sending the step to the other rank.

  • The image step is published before rank 0 finishes encoding. If admission, allocation, upload, or a kernel launch fails, the follower waits for a row broadcast that never comes, so later valid requests cannot recover the service. Please publish only after encoding succeeds, or add an explicit abort covering every failure after publication.

  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. Both are fixed in f3a761983, six commits on top of 29b5f9385.

  1. Token ids. Rank 0 now checks the whole prompt on a pass's first chunk, and every pending id, against the vocabulary before the step goes out. An id past it is refused as InvalidToken, with a host test. Rank 0 also refuses, before publishing, the prompts and windows the engine itself would refuse: one too long for the window, an unknown slot or a full context. A follower that refuses a step it was sent stops, so these must never reach it.
  2. Image step. Rank 0 now encodes the pictures and waits for them before the image step goes out, so a failed encode publishes nothing. The rows then follow by broadcast.

Your #5059 reviews found gaps that this code shares, so the same fixes are here too:

  • Graph capture. Both ranks vote on every capture and room check, and the ready digest covers the graph settings.
  • Drains. The step link, engine teardown, a dropped prompt state, the room exchange and every setup cleanup that frees device memory wait for queued work first.
  • Dropped states. Rank 0 queues the follower's notice before freeing its own copy.

test-inkling2-host, test-inkling2-cuda-host and check-native-cuda-host pass, and pr_check.py reports no new lean findings. The same changes pass #5059's checks on two GB10s. The branch conflicts with main, so CI has not run on it.

@ashhart

ashhart commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Synthena Initial Review — Performance receipt required (kind:perf)

Adds an EXL3 pack loader and two-rank CUDA serving runtime for Inkling 2 Small on a pair of GB10s, including vision, prompt caching, and new TF_INKLING2_RANK/WORLD environment flags.

  • Branch currently has merge conflicts against base.
  • Performance claim detected without a verified tf-receipt-v1 receipt.

Performance PRs require a verifiable benchmark receipt before running project CI hardware. See CONTRIBUTING.md (Performance PRs: verifiable benchmark receipt) and attach the output of:

python3 tools/perf_receipt.py run --base-bin /path/to/base-tf --head-bin /path/to/head-tf --model /path/to/model.tfold --out receipt.json

Findings:

  • [BLOCKER] zig/src/families/inkling2/admit.zig: Admission hard-codes sm_121, but the PR description says the device runs were on GB10 against a specific pack; the diff shows no fallback or clear error path for other sm_121-capable devices, and the check runs before any image load so a mismatch fails the whole open. Suggested fix: Confirm the capability check matches the validated hardware list and surface the device name in the refusal message so users can distinguish unsupported hardware from a mis-set rank.
  • [WARNING] zig/src/families/inkling2/tokenizer_fixture.json: The fixture ends without a trailing newline and hard-codes a 1,048,576-token window; if the tokenizer fixture is used to validate context limits, a mismatch with the served model's actual window would silently truncate or mis-route prompts. Suggested fix: Add a trailing newline and assert the fixture's model_max_length matches the config's context window in a test.
  • [WARNING] zig/src/families/inkling2/config.zig: The EXL3 branch returns early without validating quant_config version or codebook, relying solely on later per-tensor records; a malformed pack could pass config admission and fail mid-load with a less clear error. Suggested fix: Validate the EXL3 quant_config's version/codebook fields here, or document that the pack reader is the sole validator.
  • [WARNING] zig/src/families/inkling2/forward_test.zig: The failure-injection test asserts error.NotReady for every allocation failure, but the fake driver returns cuda.abi.error_not_ready for all failures; if Buffers.init maps other CUDA errors differently, the test would not catch a leak on those paths. Suggested fix: Vary the injected error code across iterations to confirm the cleanup path is error-agnostic.
  • Synthena

@ashhart ashhart added synthena:needs-changes Reviewed by Synthena; changes requested and removed synthena:needs-receipt Speed PR awaiting verified perf_receipt.py hash run labels Dec 3, 2026
@ashhart

ashhart commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Synthena Initial Review — Needs changes (kind:perf)

Adds an EXL3 pack loader and two-rank serving runtime for Inkling 2 Small on a pair of GB10 devices, including vision, prompt caching, and CUDA graph decode. The PR claims decode throughput of 31 tok/s single-stream and 69-71 tok/s with four streams, but no verifiable benchmark receipt is present in the diff.

  • Branch currently has merge conflicts against base.

Findings:

  • [BLOCKER] zig/src/families/inkling2/admit.zig: Admission hard-codes sm_121 (GB10) and world==2, so the family silently refuses every other CUDA device and any single-rank setup even though the loader and kernels are device-generic. Suggested fix: Either document this as an intentional validation gate in the recipe and error text (preferred, since the PR says it was only run on GB10), or relax to a minimum-capability check with a warning once other devices are validated.
  • [WARNING] zig/src/families/inkling2/config.zig: The quantization_config check returns early for any quant_method == "exl3" without validating quant_config fields (e.g. bits, codebook) here; the comment says exl3.admit re-checks version/codebook at weight-open, but if a pack is opened through a path that skips that admission, a bad codebook could be silently accepted. Suggested fix: Ensure every EXL3 open path funnels through exl3.admit's version/codebook check, and add a test asserting a non-mul1 codebook is refused by name before any tensor read.
  • [WARNING] zig/src/families/inkling2/ops.zig: The tf_ink2_gateup kernel and its GateUpArgs struct are removed from ops.cu/ops.zig, but the contract record file still lists inkling2_ops launches; if any record or test still references the removed symbol, contract validation will fail at load time. Suggested fix: Confirm no contract record or test still references tf_ink2_gateup, and update inkling2_ops_records.zig to drop its entry if present.
  • Synthena

MiaAI-Lab and others added 4 commits December 3, 2026 21:14
Patches 0001-0007: TP=2 / TP=4 Inkling 2 Small support, ModelOpt NVFP4/MXFP8 loading, FP8 KV cache, exact
prefill, multi-rank comms, bandwidth-optimized kernels, and DSpark speculative decoding.

This commit carries 0001's BF16 dense part only: a Linear that is EXL3 or BF16, BF16 attention projections and
head loaded from `.weight` tensors, cuBLASLt prompt projections and rowdot decode rows, and the vocabulary cut
in 16-row units. Its ModelOpt experts, four-rank admission and their kernels are not taken.
…s at TP4

0xSero/Inkling-2-Small-EXL3-4bpw quantizes only the routed experts (EXL3, mcg codebook, 4.0 bpw, out_scales
always); attention, embed, unembed, norms, convs and routers stay the source's BF16. Load that hybrid:

- exl3.admit returns the codebook: mul1 packs still need exllamav3 1.x; mcg is admitted without a version.
- exl3.group reads the .mul1 or .mcg marker and checks its magic (0x83DCD12D / 0xCBAC1FED); a layer's experts
  must share one codebook, which the grouped layer launches (tf_exl3_grouped_1 for mcg). Dense EXL3 stays mul1.
- Weights.bf16_dense (ModelOpt, or EXL3 attention stored as .weight BF16) picks the BF16 attention, head, FP8
  attention copies and cuBLASLt prompt projections; is_modelopt now means ModelOpt experts only.
- Weights.units(): EXL3 experts cut in 128-column blocks (TP4: 640/640/512/512), a BF16 head in 16-row blocks.
- experts.run takes mcg layers; the 64-column wide kernel stays mul1-only, so mcg keeps 16-member items.
…s bits kept

Adapts the BF16 dense linears and the mcg routed experts to this family, so a pack that quantized its routed
experts alone (EXL3 mcg, BF16 attention and head) loads at two ranks:

- No ModelOpt Small checkpoint loads here (its experts were not taken), so the config is admitted as EXL3
  alone; `bf16_dense` (a stored `layers.0.attn.wq_du.weight`) picks the BF16 linears, the head and the
  cuBLASLt prompt plans, which the engine now prepares for every projection and the head at init.
- The cuBLASLt plans move to bf16_prompt.zig and keep a row's bits at any row count: each (n, k, output) runs
  one algorithm chosen at a full 2,048-row chunk and checked at each count, and one that splits K or reduces
  partials is refused (the engine then keeps prompt rows on the row-dot kernels).
- A BF16 projection takes the GEMM from 256 rows, the EXL3 prompt GEMM's bound, so a decode call (16 rows at
  most) stays on the row-dot kernels and a row's bits do not depend on how many streams share it.
- A shard test pins the 16-row vocabulary split of 201,024 rows; the recipe names the 2.55-bpw pack.
- The new comments in exl3.zig and experts.zig fold to one line each, as this tree's comments are.

Co-authored-by: MiaAI-Lab <83042094+MiaAI-Lab@users.noreply.github.com>
@ashhart

ashhart commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Synthena Initial Review — Needs changes (kind:perf)

Adds an EXL3 pack loader and a two-rank CUDA serving engine for Inkling 2 Small on GB10, with rank sharding, prompt caching, kept states, and a new tf-inkling2-engine binary. The PR claims decode throughput (31 tok/s one stream, 69-71 total at four streams) and a prompt-cache speedup (3.9s vs 61.4s).

  • Failing CI check(s): verify.

Findings:

  • [BLOCKER] zig/src/families/inkling2/kept.zig: restore() reads x.buf into a local and then runs an async device copy from it, but overwrite() frees that same buffer for any state on the slot past from without any synchronization or lock. A pass overwriting the slot while a restore copy is in flight frees device memory the copy is still reading, a use-after-free on device memory. Suggested fix: Guard save/restore/overwrite with a per-slot lock, or make overwrite mark buffers stale and defer the actual free until the next save/drop after stream.synchronize() confirms no copy is in flight.
  • [BLOCKER] zig/src/families/inkling2/sampler.zig: The in-place ncclBroadcast uses the same device pointer as both sendbuf and recvbuf for every (row, span) pair, but the loop issues one broadcast per span inside a single NCCL group without checking that a rank's spans are contiguous or that the destination regions of different broadcasts are disjoint. If two ranks' spans overlap or are not laid out as the kernel expects, one broadcast's writes race another's reads and rows can be corrupted. Suggested fix: Assert or verify that the spans for a row are exactly the disjoint padded-vocab columns each rank owns (e.g. spans[q].lo == expected offset for rank q) before entering the group, or replace the per-span broadcasts with a single ncclBroadcast of the whole row from rank 0 followed by a local copy of each rank's own columns.
  • [WARNING] zig/src/families/inkling2/admit.zig: placeOf still accepts only world==2, but the environment table declares TF_INKLING2_WORLD with min 1 and docs/environment.md says 'a whole rank count, 2 on CUDA ... unset with it gives one rank'. A user setting TF_INKLING2_WORLD=1 with TF_INKLING2_RANK=0 gets error.Inkling2NoRank instead of the documented single-rank behavior, and the refusal text is only surfaced if the caller wires explain() up. Suggested fix: Either accept world==1 with rank 0 as a valid single-rank place in placeOf, or tighten the rule's min to 2 and update docs/environment.md and the forms text to state that only world=2 (or both unset) is accepted.
  • [WARNING] zig/src/families/inkling2/config.zig: quantization() returns .exl3 for any quantization_config object with no 'format' key, deferring all version/codebook validation to the later weights open. If a caller opens the config without ever loading weights (e.g. a metadata-only path), an unsupported pack is accepted silently instead of refused by name as the PR description promises. Suggested fix: Validate the standard EXL3 fields (version, codebook) here in quantization() as well, or document that .exl3 is only valid when the weights open path is always taken and add a test for the metadata-only case.
  • [WARNING] zig/src/families/inkling2/bf16_prompt.zig: check() reads got.state and got.workspace_size from an uninitialized stack struct if cublasLtMatmulAlgoCheck returns nonzero, and the got struct is never initialized before the call. If the API returns nonzero without writing the struct, the error path reads indeterminate memory (and the workspace_size comparison on the success path relies on the API having filled it). Suggested fix: Initialize got to a zeroed value (e.g. var got: cublaslt.Heuristic = std.mem.zeroes(cublaslt.Heuristic);) before the call, and only inspect got.state/workspace_size when the API returned success.
  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. Nine commits on top of your integration answer the reviews on 453fd5cb1, d51d55f20, 779e05ca4 and b5c2be36d; the head is now de883efe8.

  • Kept states. A pass that overwrites a slot now waits for the stream before it frees the states it replaces, so a restore copy still in flight cannot read freed memory. A host test checks that the wait comes before the frees.
  • Vocabulary spans. Before it posts the broadcasts, the sampler now refuses spans that do not cover the row in rank order. A host test covers a gap, an overlap and a swap.
  • Repeated blockers. The reviews on 779e05ca4 and b5c2be36d repeat the two points above, which both heads already fix.
  • Rank count. The environment table now takes TF_INKLING2_RANK as 0 or 1 and TF_INKLING2_WORLD as 2 alone, and the docs say the same. Placement now refuses only a setting given without its partner, so each mistake has one error and one message. The docs now say that one rank means leaving both settings unset.
  • EXL3 config. The config parser now checks a standard pack's codebook and version itself, with the rule the weights open uses, so an open that never loads weights still refuses a bad pack by name. A mul1 pack needs a released 1.x version, so 1.0.0-rc1 and 1.x are refused.
  • Algorithm check. The result is zeroed before the call. Its fields were already read only after a successful check.
  • Engine tool. The tool now checks that ids.json maps names to token ids and prints its usage line when it does not.
  • CI. The zig job failed because the family's NCCL opens were missing from main's list of opens behind the rank key. The server proves the key before its open, so that open is now listed, and the engine tool proves the key too. The job passes on 779e05ca4. The verify job fails only on the kind:perf label, since main cannot load the pack. Could the PR carry kind:feature?

The family's host suites, test-nccl-auth-host and test-gradient-serving pass on this head.

@ashhart

ashhart commented Dec 4, 2026

Copy link
Copy Markdown
Owner

The logits-exchange finding is cleared on 05de60bfb7. In the sampled path, every rank must post the same row-and-span sequence. Each broadcast names the owner of that span as its root, and NCCL permits equal send and receive pointers for broadcast. The span check requires disjoint ranges that tile the row, and the draw is queued on the same stream after the group. Filtering the calls to the local rank would break collective ordering. The greedy path uses a separate gather of each rank's local top value and global token ID, then resolves ties by the lower ID. See the NCCL in-place and group ordering rules.

#6215's fixture applies to this head. In the combined checkout, shape.zig has one assertion that must expect 8,192 instead of 128,000. With that one test update, 142 CUDA-family host tests and 21 focused attention-reference tests pass. The deployed checkpoint supplies its scaling floor at load. We're running the short and 16K greedy comparison now on Mia's pinned pack and the exact published head.

  • Synthena

@ashhart

ashhart commented Dec 4, 2026

Copy link
Copy Markdown
Owner

The two-Spark greedy comparison is complete on 05de60bfb7 with Mia's pinned 2.55-bpw pack. The short prompt produced 64 tokens on both builds with the same full output hash. Mia's reference completed the long check. The candidate server terminated before returning the long reply, so long-context parity remains open. Both tests used the text-only scope of this comparison and excluded the 0089 image-cache patch.

Please keep the serving change in review until the long-context path completes and supplies a matching receipt. The separate logits-exchange source finding remains cleared.

  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash. Four commits on top of 05de60bfb answer both points; the head is now f8599f4b7.

  1. Long context. The crash was in the BF16 prompt projections. Each cuBLASLt plan kept a pointer to the library inside a struct that moved after the plans were made. The 64-token prompt stays on the decode kernels, so only a long prompt and teardown read the stale pointer. The library now lives on the heap. On two GB10s with Mia's pack at d67aa2509, text only, a 16,565-token prompt now returns 64 greedy tokens, and a refused start shuts both ranks down without the crash. Your long comparison on this head would close it.
  2. inkling2: Small's pin moves to revision 885d78bf, log_scaling_n_floor 8192 in the fixtures and the contract reference #6215. The shape test now reads the floor from the fixture, so it passes whichever of the two lands first.

Two smaller fixes came out of the same run:

  • Engine tool. 05de60bfb did not build tf-inkling2-engine, because a function name shadowed a parameter. Host CI does not build that tool, so the error only showed in the device build.
  • Stream room. At --context 131072 --parallel 4, Mia's pack has no room for four streams. That refusal is now printed by name instead of being hidden behind the teardown crash.
Run

Two GB10s over RoCE, build 79d2d08d5 (the head differs only in two comments), bf16 KV, no drafter, --context 32768 --parallel 1.

Prompt Prompt tokens Reply tokens Time Reply sha256
Short raw 140 64 3.6 s b7bb6649db0d
Long raw 16,565 64 37.8 s 3397e3966be3

Rank 0 reports 97.55 GiB of weights and 4.3 GiB left after the 12 GiB reserve. With --parallel 4 at 131,072 tokens it refuses: "--parallel 4 needs 8.96 GiB for its streams at a 131072-token window, and the CUDA memory budget leaves 4.46 GiB".

@ashhart

ashhart commented Dec 5, 2026

Copy link
Copy Markdown
Owner

A correction to our automated review: This adds a model main cannot load, so it is kind:feature and needs no receipt against main; the verify failure came from our label. The logits exchange was cleared on 4 Dec, kept states drain before they are freed, and the docs already say CUDA refuses one rank.

  • Synthena

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

This one is underway, apologies for the wait.

@ajensenwaud

Copy link
Copy Markdown
Contributor Author

Thanks, Ash, and thanks for correcting the label.

  • Conflicts. I merged main again, and the head is now 0caa27139. Two files conflicted: the CUDA family list, where main now counts Ripple once, and one checksum pin. The merge changed none of the family's own files. Its host tests, test-nccl-auth-host and test-gradient-serving pass on this head.
  • Comments. Two trailing comments that ran past 120 columns now sit on their own lines.
  • Long context. Apart from those two comments, the family's CUDA code is the same as on f8599f4b7, where the 16,565-token prompt returned its 64 greedy tokens on Mia's pack. Your long comparison against Mia's reference on this head would close the last open point.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:perf Classified by Synthena as performance improvement synthena:needs-changes Reviewed by Synthena; changes requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants