Repository navigation
Inkling-2-Small: Add DSpark drafter kernels - #4128
ajensenwaud wants to merge 29 commits into
Conversation
9b30644 to
54a82f8
Compare
|
@ajensenwaud @ashhart I checked the DSpark stage at The conflicts against On the rebased head Igor Lessio - AIFLOW LABS |
54a82f8 to
c0c33a1
Compare
c0c33a1 to
e7d4e44
Compare
|
Shared-core review of what this PR adds over #4127, at Copies of core code
Correctness
Good for Mini: the kernels take gathered tap rows, not layer numbers, so the loop's visit-based taps stay host work in H4/C5. The contract records cover Small at TP=2. C5 adds 4 taps × 2304 at one rank. Every kernel has a planted control. Nit: five test comment lines in the |
|
Device run on a GB10 (sm_121, cc 12.1, driver 615.71.09, nvcc 13.0,
The shared-core points above still stand; this run only covers correctness on sm_121. |
|
Thanks @ajensenwaud for putting together the Inkling 2 Small DSpark drafter kernels and full kernel-contract coverage! Everything in the DSpark slice reads clean and solid: all ten kernels in Next step on our side is to rebase and run the host checks plus A few small things to keep in mind (either in a follow-up or while the top-of-stack family PR comes together):
|
e7d4e44 to
4e3149d
Compare
|
Thanks, Ash, and thanks @jschmied. Both reviews are answered in
A GB10 run (sm_121) on |
|
@ajensenwaud, I checked
|
|
I trial-merged I then added the Inkling reply parser #4124 at zig build test-server-cpu test-inkling2-host test-inkling2-cuda-host \
test-gradient-serving -Dcpu=apple_m1 -j4 --summary all
zig build compile-cuda-tests -Dtarget=x86_64-linux -j4 --summary allThese were host and build checks on M5 Max with Zig 0.17.0. The GB10 kernel results already on the PR cover device execution. Igor Lessio - AIFLOW LABS |
|
The new On M5 Max with Zig 0.17.0, the Inkling and pin checks passed 53 tests with four skips. The Qwen, serving-pin and residency check passed 275 tests with five skips, covering the roots changed by this rebase. The native CUDA target and Linux ARM64 CUDA runner compiled. zig build test-inkling2-host test-inkling2-cuda-host test-gradient-serving check-native-cuda-host -Dcpu=apple_m1 -j4 --summary all
zig build test-qwen-serving-host test-metal-residency-owners-host test-qwen27 -Dcpu=apple_m1 -j4 --summary all
zig build compile-cuda-tests -Dtarget=aarch64-linux-gnu -Dcpu=baseline -Doptimize=ReleaseSafe -j3 --summary allThe new commits touch four host test or module-root files. The kernel sources are unchanged from the previously checked device head. Igor Lessio - AIFLOW LABS |
… bar to the drafter chain (cards 215, 219)
a5a75d6 to
0215f5e
Compare
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.
Inkling 2's DSpark SiLU was its own kernel for torch's g / (1 + expf(-g)). tf_swiglu_rows now takes that form as a template mode, exported as tf_swiglu_rows_expf, and the drafter calls it. Each element runs the same instructions as the family kernel did, and tf_swiglu_rows' SASS is unchanged.
The common-helper check matched only warp_sum and block_sum*, so local warpSum and blockSum copies passed unseen. It now matches either spelling. The four Inkling 2 copies it finds are listed with their reasons.
Inkling's pick was MiniMax's merge with a different fallback id, so both now instantiate one body in common/dspark_pick.cuh. MiniMax's tf_mm3_pick_merge compiles to the same SASS on every SM under nvcc 13.0 and 13.3. Inkling keeps 0x7fffffff when no value beats -Inf, and its compare and select chain is unchanged.
Without later_pending a 13.2 build read the DSpark launches against 13.0's numbers. The 13.3 receipts move to pending_133.zig, as the expert and vision records already do.
0215f5e to
4227682
Compare
|
Thanks, @ajensenwaud. The launcher guards, shared pick/SiLU operations and pending 13.2 records address the review points. This head contains the reviewed expert/vision stage plus eleven DSpark commits. The load-time head-shape check and the eight-row/seven-draft alignment remain part of the later serving integration. The kernel slice looks ready for comparison once we've combined the shared changes with current main on our side, after #4127. The remaining evidence is the resolved tree's focused contracts and unchanged arithmetic for existing shared-kernel users. The reported kernel passes do not yet qualify Small serving or replace Mini's separate arithmetic.
|
|
5060 Ti (sm_120) kernel-contract Clean pass: 12/12 kernels pass gates 1–4, 10/10 planted controls red, 0 missed, 0 limit problems. All nine DSpark drafter kernels launch within driver limits and match their sm_120 records exactly: |
|
Thanks, @ajensenwaud. The launcher guards, shared helpers and pending compiler records remain addressed. The exact-head DSpark result on sm_120 adds useful evidence: twelve entries passed, all ten controls were caught, and no limit problems were reported. The kernel slice is ready for comparison after we combine its DSpark changes with the updated expert and vision stage on current main. The remaining checks cover that resolved tree and unchanged arithmetic for existing shared users. Load-time head validation, tap alignment and final-token verification still belong to the later serving integration.
|
What this changes
Adds the kernels of the DSpark drafter that ships with Inkling 2 Small, their launcher, and their registration with the kernel contract. The pick kernel is now one template shared with MiniMax M3, SiLU runs on a new mode of core's
tf_swiglu_rows, and main's common-helper check now catches camelCase copies. Nothing serves them until the family PR at the top of the stack.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
4227682b6; lean checker 165 on the base, 165 on this head, 0 new.zig build test-cuda-host 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: 9,077 of 9,128 tests, 51 skipped, on4227682b6(main141d6995a), every run step from a fresh cache. Two timing tests outside this PR (pull_proxy's stall resumes,pdf_worker's crash report) failed once while another build shared the host and passed on rerun.zig fmt --check build.zig zigandgit diff --check: clean. CI: pending.Receipt
n/a: no served path reaches these kernels yet.
Kernel contract
dspark.cuand core'stf_swiglu_rows_expf. MiniMax M3's pick kernel and the existingact_rowskernels compile to the same SASS on nvcc 13.0 and 13.3.kernel-contract inkling2givesSUMMARY 53 kernels: 53 pass gates 1-4, 0 fail, 0 known findings; 32 controls: 32 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.