Skip to content

pr-set : DSpark speedups and dense attention for 2 to 8 token ubatches (#405 #386 #431), two new CPU / CUDA pins - #461

Merged
danielhanchen merged 3 commits into
masterfrom
pinset-roundG-b12823
Nov 28, 2026
Merged

danielhanchen merged 3 commits into
masterfrom
pinset-roundG-b12823

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Why

Faster speculative decoding for Inkling 2 in the prebuilt. With the current set, DSpark at Studio's T=1 is only just above plain decode on a B200, and the 3-token verify step is held back by the banded attention, by tiny batched cuBLAS GEMMs and by CPU thread wakeups in the draft graph. No upstream change breaks the current set: this is a feature repin, not a conflict fix.

The set is still ggml-org's aged b#### tag plus the pins in scripts/unsloth/pr-set.json, merged in order.

What changes

Three pins move to new heads. Every new head is a fast-forward of the PR's current head (no force-push), authored as Daniel Han, and keeps its upstream merge base (b12818). Two pins are new.

pin change
#405 merges four DSpark commits: the CPU splits of an offloaded block drafter run on one thread unless -td / -tbd is given; an all-greedy draft block skips its draws; rejection verification without a full sort and with q indexed by token id; the draft context's feature readback overlaps the target sampling in the server
#386 merges the finer banded vec split at a few queries (CUDA), and routes 2 to 8 token ubatches to the dense attention with the indexed relative bias (larger ubatches stay banded; quantized cache types that dense FA converts every step stay banded; LLAMA_INKLING_DENSE_NMAX=1 restores the old routing)
#431 re-merges the new #386 (clean)
#459 (new) ggml-cpu: CPY, DUP and CONT below 4096 elements run as one task
#460 (new) CUDA: MUL_MAT over 2 to 8 src1 channels without a batched cuBLAS GEMM (a broadcast 2D src0 becomes one GEMM, a thin F32 src0 goes to MMVF)

feature-checks.json: #460 owns cuda-few-channel-mm (two test-backend-ops MUL_MAT filters that select only its new cases). #459 is unchecked with its reason: it is a scheduling change with identical results, and the CUDA copy tests already run it as their CPU reference.

Evidence

All on a B200 against the current set built on the same tag (b12823):

  • Merge sim on b12823 (the tag the nightly picks now) and b12827 (the newest): 45 of 45 pins merge, pin_contract intact, merge_checks clean. Feature-checks coverage ok.
  • verify --cuda on b12823 and b12827: CPU gate build, full CUDA build and test-chat pass. test-backend-ops on CUDA: MUL_MAT 3049, MUL_MAT_ID 1203, PAD 37, GET_ROWS 372, FLASH_ATTN_EXT 4594 (4595 on b12827), FLASH_ATTN_EXT_BANDED 509, CPY 286, DUP 10, CONT 91, all passing. GPU feature matrix 32 of 32.
  • Numeric gates, wikitext-2 -c 512:
    • Inkling-Small UD-IQ1_S: PPL string-equal to the current set (39.362699), KLD 0, top-1 100%, also at -ub 3.
    • Inkling-2-Mini UD-IQ1_S and UD-Q4_K_XL at the default ubatch and at -ub 1: PPL string-equal, KLD 0. At -ub 3 (the routed path) KLD against the current set is 0.0029 (IQ1_S) and 0.0022 (Q4_K_XL), the size of the existing difference between ubatch sizes.
    • Against a BF16 reference (Q4_K_XL, 24 chunks): ub512 0.002738 for both, ub3 0.002979 -> 0.002864, ub8 0.002600 -> 0.002821 (current -> new; standard errors 0.0001 to 0.00015). The new routing is as close to BF16 as the banded path: lower at ub3, higher at ub8, both within 2 standard errors.
    • DSpark acceptance at T=1, 8 seeds x 4 prompts x 256 tokens: n_max 2 0.404 -> 0.403, n_max 3 0.326 -> 0.322 (per-seed standard error about 0.01). Unchanged.
  • Speed, one exclusive B200, Inkling-2-Mini UD-Q4_K_XL, Studio settings (-c 1048576 -ub 1024), 4 prompts x 256 tokens, 3 interleaved rounds. The current set was run twice for the noise floor: per round, the two runs differ by -1.4% to +2.3%, and the gains below show in every round. The host was busy during the run (load 150 to 310 on 192 CPUs, with the lease's own cores idle), so the exact percentages may be somewhat smaller on a quiet host:
mode sampling current set new set change
plain greedy 103.1 tok/s 102.9 -0.2% (noise)
plain T=1 98.9 99.0 +0.1% (noise)
DSpark n_max 2 greedy 112.9 150.4 +33%
DSpark n_max 2 T=1 103.7 132.0 +27%
DFlash2 n_max 2 greedy 133.2 161.1 +21%
DFlash2 n_max 2 T=1 120.0 140.6 +17%
llama-bench pp3 @ d1024 221.2 t/s 261.6 +18%
llama-bench tg128 110.1 110.1 0%

With the new set, DSpark at T=1 is 1.33x plain decode (1.05x before), and DFlash2 is 1.42x.

Not covered here

HIP, Metal (#431 merges clean but was not compiled here), Vulkan, Windows and ARM legs run only in the nightly. The routing and the banded split were measured on a B200 only for this repin. The few-token paths are not bit-identical to the current set (rounding level, see above); decode and prefill are.

Update: #459 and #460 repinned after review

A second commit (fast-forward) is pinned on each new pin:

  • ggml-cpu : one task for small copies #459 (49918ab): the CPY/DUP scratch area is sized for the plan's thread count. Before, a small quantizing copy in a graph where another node plans all threads got a one-row workspace while every thread ran it. The one-task rule is unchanged, and the DSpark draft CPU split still plans one thread.
  • CUDA: few-channel MUL_MAT without a batched cuBLAS GEMM #460 (eae1b4d): the few-channel MMVF branch also requires a src1 that MMVF can read (unit element stride, 2-element aligned data and strides). Other src1 views keep the cuBLAS path. 12 new test-backend-ops cases with strided and misaligned src1 views abort before this commit and pass with it.

Evidence on b12823 with both commits: merge sim 45 of 45 on b12823 and b12827 (pin_contract intact, merge_checks clean); verify --cuda passes with MUL_MAT 3061 (3049 plus the 12 new cases), MUL_MAT_ID 1203, PAD 37, GET_ROWS 372, FLASH_ATTN_EXT 4594, FLASH_ATTN_EXT_BANDED 509, CPY 286, DUP 10, CONT 91, GPU feature matrix 32 of 32. Inkling-2-Mini UD-IQ1_S and UD-Q4_K_XL at the default ubatch and at -ub 3: PPL string-equal to the previous heads, KLD 0. DSpark n_max 2 texts and acceptance are unchanged. b12827 was simmed with the new heads but not rebuilt.

… to 8 token ubatches), add #459 and #460 (small CPU copies, few-channel CUDA MUL_MAT)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T11:39:37.200434Z 3d18a46 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen
danielhanchen merged commit b5981a2 into master Nov 28, 2026
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.

1 participant