Repository navigation
Inkling-2-Small: Serve on two GB10s from an EXL3 pack - #4841
ajensenwaud wants to merge 27 commits into
Conversation
e97933a to
f6f897a
Compare
|
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 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.
|
The family's attention was a copy of prefill_attention.cu's vision_kernel, so the tower now calls vit.Attention.full at head dim 64, the instance and record Qwen3-ASR already brought to main.
grouped_body takes the member tiles a program as a template parameter. tf_exl3_grouped_wide_2 runs 32 members by 64 columns for prompt chunks; the existing instantiations compile to the same SASS on every SM.
nvcc 13.3 changed tf_exl3_grouped_2's sm_120 and sm_121 SASS when the wide instance followed it; defined first, every existing kernel compiles as before under 13.0 and 13.3.
The item plan was limited to mcg and slot rows written to ey. It now takes every codebook, writes scratch y when ey is 0, picks the wide kernel for 32-member items and the capped epilogue for act_mode 3.
The family's grouper and grouped projections were copies of core's. Inkling now runs exl3_experts.runWith on grouped.Router's item plan, 16-member items below 512 rows and the wide kernel from there; outputs are bit-equal to the kernels this replaces. Expert widths up to 8 bits are admitted, as core decodes them.
tf_ink2_gateup duplicated core's gate/up epilogue apart from the softcaps, which core now runs as act_mode 3. Its registration moves to tf_exl3_gateup_capped, with the swapped-caps control kept.
RADIO, MiniMax M3, Qwen 27 and Inkling 2 each kept their own copy of the placeholder span and the cut that maps a prompt pass onto it. They now share core.image_rows, started from RADIO's copy, and each family keeps only its own splice. The cut now works in usize and takes the offset before adding the buffer row, as RADIO's did. MiniMax M3 and Inkling 2 already cut in usize, so their results are unchanged. RADIO and Qwen 27 no longer overflow u32 on a span that ends past 2^32; nothing else changes.
Inkling 2's tf_ink2v_scale_add was a layer-scaled residual add, which is tf_vit_pointwise with a per-column scale between the activation and the add. vit.cu now has tf_vit_pointwise_gamma for that, and the tower calls it through vit.Kernels.pointwiseGamma. Its fp32 multiply, bf16 rounding and add are the same round-to-nearest steps the family kernel took, so the tower's results are unchanged. Every existing function in vit.cu and inkling2/vision.cu compiles to the same SASS on sm_80, 86, 89, 120 and 121 under nvcc 13.0 and 13.3. The contract now registers the core kernel, with the late-gamma control retargeted to it; its records come from cuobjdump -res-usage, and 13.2 stays pending.
The Metal and residency builds give qwen27 its own core roots, which lacked image_rows after the shared module moved into core.
Core builds exl3_experts.cu with contraction on, so the soft-capped SwiGLU's products and sum fused into FMAs, and Inkling 2 Small's tokens no longer matched the build it was validated on. Explicitly rounded operations give the SASS the old text has at the glue kernels' flags.
…ls, bit for bit With ashhart#4127, Inkling 2's softcapped gate/up epilogue and vision layer scale come from core (tf_exl3_gateup_capped, tf_vit_pointwise_gamma) in place of main's family kernels (tf_ink2_gateup, built at --fmad=false, and tf_ink2v_scale_add). A host test writes both kernels' arithmetic at their rounding points: every product and sum on its own, the same order, the shared rotation and the fp16 or bf16 store. Over 512 random 128-column blocks with saturating and non-finite inputs, and 65,536 layer-scale values, the old and new forms give the same bits. A control contracts one product into the rotation's first sum, as core's fmad=true flags would without the explicit _rn operations, and it differs, so the comparison can see one fused rounding.
Reads an EXL3 pack from exllamav3 1.x on the mul1 codebook: every attention projection and the head as EXL3 linears, each layer's experts as one grouped layer, cut to a rank by key heads, columns or rows.
Rank 0 serves and sends every step to rank 1 over NCCL; the per-layer partial sums cross by RoCE writes. Decode rows from several streams share one graphed forward, prompts run in 2,048-row chunks with kept states at chunk starts, and images go through the vision tower. No drafter yet: a stream decodes one row a step.
The new map entry went in before pick scanned the lanes, so the scan read the entry's unset slot, and a failed pick left the entry behind. The slot is now chosen first and the entry added only once it has one.
checkpoint_digest stayed zero, so the ready check passed two ranks holding different packs. Each rank now hashes every shard byte beside the load and hands that digest to the check.
Buffers.deinit read ids and logits before init had made them. Both now start empty, and a fake-driver test fails each allocation in turn.
f6f897a to
5fee538
Compare
|
On 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 I tested the PR head directly. A trial against Igor Lessio - AIFLOW LABS |
|
Thanks, Ash, and thanks @AIFlowML. All three are fixed in
|
|
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 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.
|
Two ranks with identical shards but different configs, such as another rms_norm_eps, passed the ready check. The digest now also covers the parsed config and the stream shape each rank was started with.
Engine.init cleaned up a stale copy of its modules, which never held the prompt projections. A failed kernel lookup leaked the GEMM workspace and a failed plan insertion leaked its descriptor and layouts.
|
Thanks, Ash. Both are fixed in
No kernel or arithmetic changed, so the earlier device results stand, including the release-reference difference that main's |
|
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.
|
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
mul1codebook 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.TF_INKLING2_RANKandTF_INKLING2_WORLDname a rank, with rows indocs/environment.md.docs/recipes/inkling-2-small-cuda.mdhas the run commands.Stacked on #4127 at
467dbe87b; only the last six commits are new.Checks on this head
db36991e0reverted, token ids equal the release build's on all 28 cases at bf16 KV. That commit changes the arithmetic oftf_ink2_mix, so with it every case differs from the release.bench_concurrent.py.zig build test test-gradient-serving compile-cuda-tests -Dfixed-cpupass, with 13,404 of 13,500 tests (96 skipped).lean_checkfinds 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-2dgxataa29f3a0. Equality, concurrency and resume ran again on85dc7a169, which carries this head's patch on an older main, and the host run ond67d65682, the same patch on mainef4dd750b. The cache, graph and speed figures come from6b579b2a0on main0300dfbfe, whose Inkling 2 files differ from this head only in two hook signatures. The review fixes ran on 25 November on this head: equality, serial equality across the prompt GEMM threshold and the checkpoint check.Receipt
Commits.
4d06cf054: load standard exllamav3 packs with two-rank cuts.3da1f58fa: serve Small on two GB10s from an EXL3 pack.ff6abfb87: add the Inkling 2 Small CUDA recipe page.31069d466: choose a stream's slot before publishing its lane.338b9ca5f: compare every shard byte across the ranks at ready.5fee538c3: make a call's scratch safe to free at every failed allocation.Size. 31 files, +3,629 / -10 over #4127. Shared files take +41 / -8; the rest is new under
zig/src/families/inkling2/anddocs/recipes/.Hardware. Two DGX Spark (GB10, sm_121), RoCE between them, bf16 KV, 12 GiB reserve a rank, images on.
Token equality (
tools/g3-equal/ab_tokens.py, 28 cases: chat, code, agent and report prompts, 3,421 and 21,857 prompt tokens, four- and eight-request runs, a resumed run and an image, 256 tokens each, greedy): withdb36991e0reverted, 28 of 28 equal the release build's. Without the revert, 28 of 28 equal the same patch's earlier run on main68ff0ad8e. 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:
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.
spark-bench (bf16 KV, 512 tokens, chat/code/agent/report):
bench_openai.py (256 tokens, 3 reps): 31.9 tok/s on
fibonacci-rawat temperature 0, 31.9 ongpu-chat-no-think.bench_concurrent.py (
--alone --serial): equal to alone at 1, 2 and 4 streams oncodeandchat, 0 unequal.Graphs.
tf-inkling2-engine graphs: 46/46 steps bit-identical, 5 captured, 41 replayed, on7c7998de4, an earlier head of this branch on main0300dfbfe.Kernel contract. No new kernels; the PR runs on #4125, #4126 and #4127.
Notices.
THIRD_PARTY_NOTICES.mdcredits exllamav3 (MIT) for the EXL3 format and HF transformers (Apache-2.0) for the layer order.