Skip to content

perf(inkling2): faster real-world inference (+62% decode, +119% prefill at 3.6k) - #456

Merged
Brooooooklyn merged 6 commits into
mainfrom
perf/inkling2-realworld
Dec 1, 2026
Merged

Brooooooklyn merged 6 commits into
mainfrom
perf/inkling2-realworld

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Contributor

Summary

Speeds up Inkling-2-Mini (Q4_K_XL + inkling-2-mini-dflash2) on real workloads. Numbers are M5 Max, full-LTO release, vs fbbd1ae9b.

Workload Before After
3.6k ctx, T=1.0 decode 92.6 t/s 150.2 t/s (+62%)
3.6k ctx, T=1.0 k=20 decode 77.0 t/s 139.9 t/s (+82%)
3.6k ctx, greedy decode 105.8 t/s 144.7 t/s (+37%)
3.6k prefill 1,318 t/s 2,882 t/s (+119%)
42.8k prefill 1,613 t/s 2,201 t/s (+36%)
114k prefill (TTFT) 90.4 s 66.0 s (-24 s)
2 lanes x 42.8k wall 57.8 s 41.5 s (-28%)
M=16 tree verify forward 50.2 ms 39.1 ms (-22%)
Full bench suite wall 265.9 s 167.8 s (-37%)

What changed

  • Speculation: scheduled solo 4-child sampled verify tree (+SAM), adaptive 1D depth (M=4..8), fused top_k=0 GPU sampler, Q4 spanned draft lm_head.
  • Prefill / long ctx: direct r21 NAX prefill, device int8 Q (no TG q_tile), loop fission, wave-aligned split plan.
  • MoE: unified m16 NAX (NVFP4 + Sym-Q8_0) for M=9..32, faster router, command-buffer split fix.
  • Fusions: OProj+ShortConv+AttnRes, LoopCtrl up-blend+norm, Q-parallel BlockAttnRes (_v2 kernels).
  • Scheduler: zero head-of-line blocking solo tree, atomic ShortConv wave staging, SWA reclaim only for the mandatory 1D wave.
  • Fix: thinkingBudget=0 no longer loops on <|content_thinking|>.
  • SSD cache: arithmetic epoch bumped to v7 (includes GPU core count). Old SSD entries are not reused.
  • Metal symbols synced across C++ bridge, bridge_metallib_names.rs, and metallib-select.ts. No hardcoded GPU/NAX unit counts.

Notes

  • M=9..32 NAX vs M=1..8 SIMD differ by 1-2 ULP. Max RMSE 3e-4 at M=32. This can flip a near-tie greedy token under concurrent waves. MLX_INKLING2_MOE_COL_CUTOFF=999999 restores bit-exact SIMD.
  • MLX_INKLING2_DFLASH2_ADAPTIVE_DEPTH=0 turns adaptive depth off.
  • Pre-existing, untouched: qwen3_5::dflash2::tests::draft_context_kv_bits_follow_append_width_not_slot_or_padding fails on M5 Max on main.

Test plan (full-LTO --release)

  • cargo fmt, git diff --check, cargo clippy -D warnings (mlx-paged-attn, mlx-core, mlx-sys)
  • mlx-paged-attn 369, bridge_metallib_names 10/10, vp test metallib-select + payload 104/104
  • mlx-core Inkling2 / scheduler / DFlash2 suites 629/629
  • Real-model: paged_vs_flat (31/31, 48/48 across SWA 1024), dspark_greedy, concurrent_batched (4/4), cold_tier (RAM + SSD + restart), concurrent_wave with COL_CUTOFF=999999 (4/4 bit-exact)
  • Live inkling2_roofline_profile and inkling2_realworld_bench
  • 7 rounds of Codex adversarial review; remaining notes are out of scope

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 16c3e21d-a164-4ab0-9480-a42f05c24f69

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 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-12-01T02:10:39.990587Z 692206a 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.

@Brooooooklyn
Brooooooklyn force-pushed the perf/inkling2-realworld branch from 692206a to 57e1e3f Compare December 1, 2026 02:32
@Brooooooklyn
Brooooooklyn merged commit 3d0dbef into main Dec 1, 2026
21 checks passed
@Brooooooklyn
Brooooooklyn deleted the perf/inkling2-realworld branch December 1, 2026 03:32
Brooooooklyn added a commit that referenced this pull request Dec 1, 2026
Follow-up to #456. The squash merge missed one line: the test-only
`SuppressedOpenPagedBackend::finalize_turn` in `paged_turn.rs` builds a
`ChatResult` without the `prompt_parts` field added by #451, so `cargo
test --lib -p mlx-core` fails to compile on `main`.

One line: `prompt_parts: None`. Checked with `cargo clippy --all-targets
-D warnings` (clean).
Brooooooklyn added a commit that referenced this pull request Dec 1, 2026
…e with D1 count (#461)

Live at https://portato.void.app (deployed from this tree).

## Site

| Where | Before | After |
|---|---|---|
| Landing hero | Python code chat | PDF card-statement chat + mesh
backdrop |
| Landing chat card | `merge_intervals` code block | letter-photo turn
(app's chat thread) |
| /portato hero | Python code chat | Qwen3.8-27B reads a photo of a
made-up Japanese tax letter |
| Photo tile | static picture | the app's `ImageTiles`: hover card,
viewer, Copy (small island) |
| Work example + Session tab | old mock | real woff-build PR #91
session, speeds scaled per #456 |
| Control Panel | screenshot gallery | 7-view tour of the app's
components with generated mock data (`/panel-frame`) |
| /portato header | mlx-node mark | Portato icon |

- Removed: the Python conversation, `CodeBlock`, the code-highlighting
build, `@shikijs/*`, the screenshot gallery and its shots.
- Default `SITE_URL` is now `https://portato.void.app`
(`vite.config.ts`, `void.config.ts`, `check-site.mjs`).
- README line 42 and `ChatWork.tsx`: "A file edit is shown as a diff,
and each command shows its output."

## `/download`

```
GET /download ─► OS: Sec-CH-UA-Platform, else User-Agent; arch: Sec-CH-UA-Arch / Linux UA
   ├─ mac → Portato-<v>-arm64.dmg
   ├─ windows → Portato-<v>-win32-arm64-setup.exe
   ├─ linux arm64 → Portato-<v>-linux-arm64.deb
   └─ x86 / phone / bot / failure → releases/latest
release list: GitHub API (optional GITHUB_TOKEN secret, cached 10 min)
   └─ API fails → tag from the releases/latest redirect, names as release-version.ts builds them
each GET → one D1 row in `downloads` (at, os, tag, target); no IP, no user agent
```

- Every "Download" button points at `/download`; on Windows/Linux the
label reads "Download for Windows/Linux".
- The site is now a hybrid Void deploy: every request goes through the
Worker (pages are the same prerendered files).
- Read the count: `cd website && CI=1 void db execute --remote --yes
"select os, tag, count(*) from downloads where target = 'file' group by
os, tag"`.

## Also in this PR

- **One lockfile:** `website` is a root workspace; `website/yarn.lock`
is gone (`installConfig.hoistingLimits: "workspaces"` keeps the site's
packages in `website/node_modules`). All 1,014 existing root lock
entries resolve the same; 278 packages added. The root install now runs
6 build scripts (esbuild ×3, workerd, better-sqlite3, `void prepare`).
- **main build fix:** #458 + #460 left two test initializers without a
new field (`turn_history_pin` in `paged_turn.rs`,
`prefix_breakpoint_hints` in `qwen35_cuda_prefill_bench.rs`), so Clippy,
cargo build/test and e2e fail on `main`. Both now use the value every
other test uses.

## Checks

`tsc`, `vp run build`, `check-portato-mock`, `check-numbers`,
`check-site`, `check-samples`, `vp fmt --check` on changed files: pass.
Route tested in `vp preview` and live (API blocked → fallback still
gives the file; HEAD not counted).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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