Repository navigation
Inkling-2-Small: Add grouped-expert and vision kernels - #4127
ajensenwaud wants to merge 19 commits into
Conversation
890e327 to
6c524ae
Compare
|
@ajensenwaud @ashhart I checked the expert and vision stage at My test merge into On the rebased head Igor Lessio - AIFLOW LABS |
6c524ae to
3a5ceaa
Compare
3a5ceaa to
0279798
Compare
|
Shared-core review at Blocker for Mini (C6)
Copies of core code
Correctness
Nits
The kernel contract has a planted control for every one of the 7 kernels. |
0279798 to
ef8a71a
Compare
|
@ajensenwaud,
The description still names head |
ef8a71a to
85539e2
Compare
|
Thanks, @jschmied. Everything you raised is in
A GB10 run (sm_121) on |
|
@ajensenwaud, I checked
|
|
Thanks. I assume there is nothing more to be done, based on your message? |
|
I checked the current standalone zig build test-inkling2-host test-inkling2-cuda-host test-qwen-serving-host \
test-gradient-serving check-native-cuda-host \
-Dcpu=apple_m1 -Doptimize=ReleaseSafe -j2 --summary all
zig build compile-cuda-tests -Dtarget=aarch64-linux-gnu -Dcpu=baseline \
-Doptimize=ReleaseSafe -j2 --summary allThese cover the current host roots and serving pins, including the two updates also carried by #4128. The posted GB10 device run remains tied to its earlier head. Igor Lessio - AIFLOW LABS |
|
@ajensenwaud, yes, nothing more from my side. My GB10 run was at |
|
sm_120 kernel-contract run on the RTX 5060 Ti (jw16, boot fc0f7ff9) at head 84b4d2c, SUMMARY 51 kernels: 51 pass gates 1-4, 0 fail, 0 known findings; 33 controls: 33 red as planted, 0 missed; 0 limit problems; gates 265967 ms. Every inkling2 kernel carries exact sm_120 records (thread counts match the driver caps, registers and shared bytes exact). |
|
Thanks, @ajensenwaud. The shared expert and vision paths, configured widths and refusal checks address the source concerns. The new comparison also captures the intended capped arithmetic and layer-scale rounding, including controls that detect fused operations. The kernel slice is ready for comparison after we combine it with current main. That integration needs to retain Mini's two arithmetic baseline kernels and its newer tail cases. The remaining evidence is the new comparison's result and the resolved tree's focused contracts and unchanged shared-function arithmetic. The older receipts do not yet qualify Small serving or Mini vision.
|
|
I trial-merged the revised The first host compile stop was the zig build test-inkling2-cuda-host test-gradient-serving check-native-cuda-host -Dfixed-cpu -j2 --summary all
zig build compile-cuda-tests -Dtarget=aarch64-linux-gnu -Dfixed-cpu -j2 --summary allThe second command still stops at Igor Lessio - AIFLOW LABS |
|
Results on your head
|
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.
467dbe8 to
6dd6063
Compare
|
I reran the current The runner now compiles, but the trial tree still drops main's Igor Lessio - AIFLOW LABS |
…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.
|
@ajensenwaud, our GB10 checks of this head against main, after the rebase:
The shared EXL3 grouped-expert kernels this PR changes are also used by DeepSeek-V4.1, GLM, Hy4-flash, MiniMax M3 and Muse Spark. We don't have those EXL3 MoE checkpoints. Could you post a token-equality receipt for one of them: main against this head, same checkpoint and revision, greedy, prompt and decode, with full output-token hashes? Then this can go to our landing queue.
|
What this changes
Runs Inkling 2's routed experts on core's EXL3 grouped-expert path, which gains 32-member tiles, an item list for any codebook and a soft-capped SwiGLU epilogue. The experts are EXL3 only. It also adds the vision tower, which runs its attention and scaled residual add on core's ViT kernels. The image placeholder spans move to one core module shared with RADIO, MiniMax M3 and Qwen 27. Nothing serves them until the family PR at the top of the stack.
141d6995a.atc overlap --json: incomplete (ATC's limits). Conflicts only in shared append lists (CHANGELOG.md, the CUDA build and kernel lists, contract joins and limits), with CUDA: #1764's BF16 prompt tile for Qwen ModelOpt, Nemotron and Dory, plus two exact Qwen prompt kernels (#1762) #2008, Unlimited-OCR-2 on CUDA: the family's steps on NVIDIA GPUs (sm_89 and up) #2077, moss image: serve pictures on CUDA (encoder, decoder and host for #1573) #2281, lanes: LFM3's row draw and Flash Next's host reference draw use core's sampling_row (#2460 item 3, step 2) #2679 and server: --vision-image-share fixed gives every image the same share of the visual-token budget (#2510) #2717.Checks on this head
012d456f3; lean checker 165 on the base, 165 on this head, 0 new.zig build test-inkling2-cuda-host test-inkling2-host test-gradient-serving compile-cuda-tests test-exl3-cuda-host test-minimax-cuda-host test-omni-video-host test-qwen27-equality-host test-qwen27-plans-host test-glm-exl3-prompt-host -Dfixed-cpu: 1,436 of 1,453 tests, 17 skipped; the steps cover every family the shared changes touch.zig fmt --check build.zig zigandgit diff --check: clean. CI: pending.Receipt
n/a: no served path reaches these kernels yet.
Kernel contract
tf_exl3_grouped_wide_2andtf_exl3_gateup_capped, core ViT'svision_kernel<64, 8>andtf_vit_pointwise_gamma, and the family'stf_ink2v_embedandtf_ink2v_rope. Every existing function in the shared images compiles to the same SASS on nvcc 13.0 and 13.3.kernel-contract inkling2givesSUMMARY 41 kernels: 41 pass gates 1-4, 0 fail, 0 known findings; 22 controls: 22 red as planted, 0 missed; 0 limit problems.exl3,act,vitandminimaxshow the same limit problems on the head as on main, and no failure that main does not show.