Skip to content

Inkling 2: Spark projections on the row-invariant tensor-core kernels (2/4, stacked on 1/4) - #431

Merged
AzeezIsh merged 2 commits into
Atlas-Inf:mainfrom
Enntity:inkling2/up051-2-spark-proj
Nov 28, 2026
Merged

AzeezIsh merged 2 commits into
Atlas-Inf:mainfrom
Enntity:inkling2/up051-2-spark-proj

Conversation

@data-angel

@data-angel data-angel commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Change 2 of 4 porting the SparkInkling 0.5.1 engine to main, stacked on #430 (two commits past it: the fork's commit, then a cap fix).

What

Inkling's verify rows keep the decode row's arithmetic, so text with drafts is the text without. For the Spark
NVFP4 projections and head that meant the scalar batch GEMV tiers, which repeat the one-row kernel's FMA chain and
are issue-bound. ATLAS_SKINNY_MMA's kernels compute a row the same way at every width, so under that existing
lever decode and verify stay exact twins on the tensor cores:

  • skinny_mma.cu moves from the qwen3.6-27b overlay to kernels/gb10/common, so every GB10 target (Inkling 2
    Mini's included) ships it. The lever stays off unless set; nothing changes for a serve that does not set it.
  • Under the lever Inkling's one-row fused projection kernel (inkling2_proj_gemv_mixed, the scalar arithmetic) is
    not used, so a decode row takes the skinny kernels as a verify row does.
  • An exact verify's NVFP4 projections and the verify head go to the skinny kernels in one call (up to 128 rows)
    instead of 15- and 16-row passes that read the weight again.
  • skinny_mma_microtest covers Inkling's shapes and runs on its kernel set.

SparkInkling's Spark mode sets ATLAS_SKINNY_MMA=1; its Strict mode (BF16 projections) does not.

Beyond the cherry-pick: skinny_mma_microtest.rs and lm_head_batched.rs are run through rustfmt (the fork's
commit was not formatted), and a second commit keeps both files it grows under the 500-line cap, moving code as is:
the microtest's shape table to skinny_mma_microtest_parts/shapes.rs, and GlueKernels::window_meta (#430) to
glue/route.rs beside kv_write.

Observed (the fork's engine, all of 0.5.1, so not this change alone): Spark mode on SparkModelBench, medians,
code / prose / structured decode 88.2 / 57.0 / 129.9 tok/s and short code at one / two / four / eight requests
63.2 / 81.9 / 104.7 / 144.1 tok/s aggregate. Greedy text for 8 prompts of 320 tokens with drafts on equals drafts
off at one, two and four requests, 8/8, in both modes. The commit message carries the preliminary dev-build numbers
for this change alone (a drafted step at one request 68.5 -> 54.6 ms, single runs).

The series

The engine of SparkInkling 0.5.1
(Enntity/atlas inkling2/rc-0.5.1-20261126 at a4dbba378), ported onto main (9f4fd773f) as one change
per PR, stacked linearly:

  1. Window-bounded KV for the sliding-window visits — Inkling 2: window-bounded KV for the sliding-window visits (1/4, SparkInkling 0.5.1 engine) #430
  2. Spark projections on the row-invariant tensor-core kernels — Inkling 2: Spark projections on the row-invariant tensor-core kernels (2/4, stacked on 1/4) #431
  3. Inkling 2 prefill kernels — Inkling 2: prefill kernels — tensor-core bias, per-head flash attention, fused norms, gates and gate_up epilogue (3/4, stacked on 2/4) #432
  4. scheduler: a busy prompt runs one prefill chunk a tick — scheduler: a prompt arriving while others decode runs one prefill chunk a tick (4/4, stacked on 3/4) #433

The DFlash2 drafter commits that 0.5.0 carried are already on main. Two things are not in this series:
the fork's ATLAS_PREFILL_BUSY_TOKENS chunk cap (#4 here makes it unnecessary, and the fork removed it, so it is
not proposed and no PR adds an ATLAS_* name) and the opt-in LoopCD (--loopcd), which is not proposed for now.

After #4, the engine files these commits touch equal a4dbba378's except for main's own changes underneath
them (glue.rs's route / kv_write now in glue/route.rs; weights.rs, serve_load.rs), rustfmt, code moved
as is to keep files under the 500-line cap (#2, #3), and the AMD flash prefill kept beside the new gb10 kernel (#3).

Where the numbers come from. Every GPU number below was measured on the fork's engine on its older base
(before #413 and #426), not on these branches: SparkModelBench 293a44f (RigMark protocol 1.3.0, RigMark Quality
v0.0.2, reasoning_effort: low) on one DGX Spark, SparkInkling 0.5.1's default profile, published with receipts in
results/2026-11-27-rc-0.5.1.
No GPU has run these rebased branches.

Test plan

  • On this branch (Rust 1.93.1, CUDA stubs, no GPU): fmt, clippy (-D warnings, spark-runtime / spark-model / spark-server, --tests), cargo test --release of those crates (spark-model 2,524, spark-runtime 608 and spark-server 3,258 passed; the same five spark-server tests fail on main in this container (three need a .git checkout, two read the disk's free space)), the 500-line cap, SPDX and kernel-shadow checks; no new ATLAS_* name
  • On the fork's engine, one DGX Spark: skinny_mma_microtest at Inkling's shapes (rows byte-identical at 1..128 rows); drafted = plain greedy text as above
  • PR gates and the strix-hip build: left to the maintainers (no strix-hip file touched)

Authorship

AI-authored: Claude (Opus 5.5) in Claude Code, directed and reviewed by a human; no hand-written code.

CLA

  • I have read and agree to the Contributor License Agreement.

🤖 Generated with Claude Code

data-angel and others added 2 commits November 27, 2026 10:38
…(ATLAS_SKINNY_MMA)

Inkling's verify rows keep the decode row's arithmetic so text with drafts
is the text without. For the Spark NVFP4 projections and head that meant
the scalar batch GEMV tiers, which repeat the one-row kernel's FMA chain and
are issue-bound: at eight verify rows they read Inkling's [3072 x 2304]
projections at about 90 GB/s, and they were about 14 ms of a 68 ms drafted
step on one GB10.

ATLAS_SKINNY_MMA's kernels compute a row the same way at every width, so
decode and verify stay exact twins on the tensor cores:

- skinny_mma.cu moves from the qwen3.6-27b overlay to gb10/common, so every
  GB10 target (Inkling 2 Mini's included) ships it; the lever stays off
  unless set.
- Under the lever Inkling's one-row fused projection kernel
  (inkling2_proj_gemv_mixed, the scalar arithmetic) is not used, so a
  decode row takes the skinny kernels as a verify row does.
- An exact verify's NVFP4 projections and the verify head go to the skinny
  kernels in one call (up to 128 rows) instead of 15- and 16-row passes
  that read the weight again.
- skinny_mma_microtest covers Inkling's shapes and runs on its kernel set.

Observed on one GB10, dev build, Spark weights, DFlash2 drafter,
voice engines resident, preliminary, single runs: skinny_mma_microtest
passes at Inkling's shapes (rows byte-identical at 1..128, error against
FP64 no worse than w4a16_gemv). Greedy text for 8 prompts x 320 tokens with
drafts at one, four and eight requests, and plain at eight, identical to
drafts off one at a time. A drafted step at one request 68.5 -> 54.6 ms;
RigMark short code C1/C2/C4/C8 aggregate 65.8 / 73.9 / 108.7 / 149.1 tok/s
with the lever (release 0.5.0, voice suspended: 58.7 / 77.6 / 103.0 / 136.0).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 19f3e27)
…move

skinny_mma_microtest's shape table moves to skinny_mma_microtest_parts/
shapes.rs and GlueKernels::window_meta to glue/route.rs beside kv_write;
code moved as is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@AzeezIsh AzeezIsh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@data-angel Gated this as the tree main gets: main with #430 merged, then this branch merged on top (bb62c76cd, the same tree GitHub's merge gives now that #430 is in as ffb94a585), against its parent. One GB10, sparky job 210, fresh worktrees at both commits.

With the lever off (the default), nothing changes

check parent vs this PR
Qwen3.8-27B QAD exact profile (sets ATLAS_SKINNY_MMA=1, so it runs the moved skinny_mma.cu): lp_dump 26,912 tokens, greedy C1 / C8 max|Δ| 0.0000 · 8/8 · 8/8
Inkling Strict plain: greedy C1 / C8 8/8 · 8/8
Inkling Spark plain: greedy C1 / C8, NLL (57,716 tokens) 8/8 · 8/8 · ties 32/32
Inkling Spark + DFlash2 (0.5.1 spark draft env): greedy C1 vs plain 8/8

With ATLAS_SKINNY_MMA=1 (Spark)

  • Drafts equal no drafts: Spark + lever + DFlash2 vs Spark + lever plain, greedy C1 / C8 8/8 · 8/8. C1 vs C8 is also 8/8 within each arm.
  • The text changes from lever-off, as expected (0/8 identical). Teacher-forced NLL is unchanged to five decimals (0.82294 both, 14 of 32 chunks lower, 6 ties).
  • Tools 14/14 (both arms). Quality probe with the drafter: 40/40, needle 12/12. Image 3/3. cachehit warm == cold 6/6. 4 × ~25K concurrent prompts all served. 0 ERROR lines.
  • Plain lever-on had needle 9/12. The three misses are empty answers (reasoning hit the probe's 600-token cap), with C1/C8 text identical to the drafter arm, which scored 12/12. That probe runs 4 concurrent ~K-token prompts, and on main concurrent batched prefill varies run to run (#430 job 209), so I read it as that.

Speed: one binary, one variable (Spark + DFlash2, 0.5.1 spark env; sq_bench medians, decode n=3, concurrency n=2):

prose code json C1 C2 C4 C8
lever off 61.0 82.3 69.0 64.4 70.1 93.7 119.1
lever on 64.8 93.2 71.4 66.5 79.1 99.6 130.7

That is observed +3–13%, on one box and one harness.

Strix Halo (DevLab A/B run 46148035545, same merge commit vs main): lp_dump identical (max|Δ| 0 over 19,952 tokens), NLL ties 32/32, decode unchanged (Spark C1 42.7 / 42.6, Strict 28.9 / 28.8 tok/s), 0 hipError lines. Greedy at C4 was 3/8 Spark and 6/8 Strict. That's inside what a main-vs-main control on the same harness gives (2/8, 6/8; see #430), because C4 text on that harness isn't stable run to run.

CI: every workspace job passes on fresh runs against the new main. Merging.

sparky nightq 210 · parent 5807bb377 (tree of ffb94a585) ink bd2547fb q27 d9e1cd5a · gated 65f9062c3 (tree bb62c76cd) ink cc3ffad1 q27 ebc6ab12 · 2026-11-28

🤖 Generated with Claude Code

@AzeezIsh
AzeezIsh merged commit 249a187 into Atlas-Inf:main Nov 28, 2026
25 of 28 checks passed
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.

2 participants