Skip to content

Path G: decode-throughput optimization (target +50–100 %) #58

Description

@ai-hpc

Goal

Push decode tok/s from alpha.10's ~9.1 toward the bandwidth ceiling. Orin's LPDDR5 peak is 102 GB/s; reading the 2.4 GB Qwen3-4B Q4_K_M model per decode step gives a theoretical ~42.5 tok/s. We're at 21 % of bandwidth today. Path G is the incremental optimization track to close that gap.

Mirrors the structure of Path E (#33) and Path F (#45): small phased PRs, each validated, with verified-result comments.

Where we are

Decode has been stuck at 9.1 tok/s since alpha.5 (Path C shipped Q4_K uint32 weight loads on Wo / gate-up / QKV). Every release since (alpha.6 D, alpha.7+8 E, alpha.9+10 F) has been prefill or persistent-KV work — none touched the decode hot path.

Pre-Path-C nsys put 93 % of decode in 5 K-quant GEMV kernels. Path C vectorized 4 of them (the Q4_K paths). What's left, estimated:

Cost Approx % of decode wall
W_down (Q6_K, M=2560 K=9728) ~30 %
Wv (Q6_K row in QKV triple) ~10 %
Wo / gate / up / Wq / Wk (Q4_K, already Path C-optimized) ~30 %
Attention decode (KV reads) ~15 %
RMSNorm + RoPE + final norm ~5 %
Final logits gemv (2560 × 151936) ~5 %
Embedding lookup + sample ~5 %

G1 will produce a fresh nsys profile to confirm or correct these estimates. Every G2+ phase is conditional on what G1 finds.

Phased plan

Phase Scope Estimated win
G1 Fresh nsys profile of alpha.10 decode. Half-day. Zero risk. Identifies hot kernels. 0 (validation)
G2 Q6_K uint16 weight loads. The Q6_K alignment problem from #29 was for uint32 (210 B not divisible by 4). uint16 works at 2-byte alignment, which 210 B satisfies. 2× fewer load instructions on the byte path — mirrors Path C's uint32 win, scaled down. Hits W_down + Wv. +5–10 % decode
G3 Attention KV-tile reuse in shared memory. Flash decode currently reads KV from global mem per head; could stage one layer's K/V in shared and reuse across heads. +5–10 %
G4 Fuse RMSNorm + first projection. Separate launches today for fused_rmsnorm then Wq/Wk/Wv. Merge into one launch to amortize per-layer dispatch overhead. +3–5 %
G5 INT8 KV measurement + default-flip. --int8-kv already supported; never measured at alpha.10. Halves attention-read bandwidth. If output quality holds on a longer context, flip default. +5–15 % for long context
G6 alpha.11 release prep — docs + cumulative win summary. cumulative

Cumulative target: 9.1 → 12–15 tok/s (+30–60 %) at the low-to-mid end. Beats llama.cpp's tg64 = 6.33 ± 0.25 tok/s by another notch on top of alpha.8's already-+44 % lead.

What this is NOT

  • Not speculative decoding. That's the planned Path H (issue Weeks 9-11: speculative decoding + persistent KV cache #6 second half) — a separate multi-week swing for 1.5–2.5× decode, after Path G plateaus or in parallel as research.
  • Not a model architecture change.
  • Not multi-batch decode. Single-stream serving is the GenieClaw use case.

Phase status

  • G1 — nsys profile
  • G2 — Q6_K uint16
  • G3 — attention KV-tile reuse
  • G4 — norm + projection fusion
  • G5 — INT8 KV measurement / flip
  • G6 — alpha.11

Risks worth naming up front

  1. The profile may surprise us. alpha.5 numbers are now nine releases old; cache behavior + scheduler changes since may have shifted where time goes. G1 might say "actually attention is the bottleneck now, not Q6_K". Plan adjusts.
  2. Q6_K uint16 may not bit-equal Q6_K bytes. Float-add reordering same as Path C; expected to be FP16-ULP-bounded. Validate on the reference prompt.
  3. Negative-result phases. Path C had two (Path C Phase 2: CUDA Graphs decode capture #21, Path C Phase 3: split-K K-quant GEMV (target 1.5-2× decode) #22) and Path E had one (Path E phase E3b: wire MMQ Q4_K into prefill dispatcher (JLLM_MMQ_Q4K) #37). Budget 1–2 in Path G.
  4. Bandwidth ceiling is real. At ~21 % util today, the theoretical ceiling at 42.5 tok/s assumes 100 % bandwidth utilization which is never achieved in practice; realistic asymptote is more like 25–30 tok/s. Targeting the 12–15 tok/s range is honest.

Inspirations

Metadata

Metadata

Assignees

No one assigned

    Labels

    alphaAlpha milestone work

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions