Gemma 4 on the batched-decode branch: merge #120 + perf findings (CUDA graphs +13.6%)#1
Open
mikepapadim wants to merge 18 commits into
Open
Gemma 4 on the batched-decode branch: merge #120 + perf findings (CUDA graphs +13.6%)#1mikepapadim wants to merge 18 commits into
mikepapadim wants to merge 18 commits into
Conversation
… mixed-precision FFN support
…y stock GPU decode, CUDA-graphs +13.6%, batched-decode adaptation analysis
…nel (scale 1.0), validated bit-exact; port plan
…/K/V RMSNorm kernels, validated
…idual kernels, validated
…ernels complete + bit-exact; remaining is layer-graph assembly
…e, layerBaseOff) for per-layer/shared KV; re-validated
…F16 PLE matvec + FP16 norm-apply; E2B dims probed (1536/35L/nHeadKv=1/PLE F32)
…Dim-512 + F32-PLE handled); engine assembly is the remaining integration
…Configuration + parameterize RoPE theta; full serving stack works (12x batched, coherent, prefix-consistent)
…, no crash); fixed HalfFloat-lowering (local var) + double-embed-scale + scale/normed buffer aliasing. Forward still produces garbage - wiring bug pending intermediate-value debug
…ot NaN/scale); residual non-accumulating (wrapX ~0.1); PLE affects but not sole bug; CPU-ref needs 2nd standard-weights model. Debug flags: gemma.noPle/cpuRef/dbg
… CPU forward for Q8 Gemma per-layer-token-embd; cpuRef harness (2nd standard-weights model) hits pre-existing CPU-path AIOOB
…hout (rms 0.2-1.0, no blowup) - subtle direction bug, not a corrupting layer; references blocked by CPU-path bugs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gemma 4 on the batched-decode branch
Merges Gemma 4 support (PR beehive-lab#120,
gemma4-new) onto the vLLM-style batched-decode work(
feat/static-batched-decode, PR beehive-lab#129) and evaluates squeezing Gemma 4 decode perf. Fullwrite-up:
GEMMA4_BATCHED.md. Model:unsloth/gemma-4-E2B-it-Q8_0(5 GB), RTX 4090, CUDA backend.Results
✅ Clean merge — Gemma 4 coexists with all batched-decode features; builds + runs.
✅ Stock Gemma 4 GPU decode works —
"The capital of France is **Paris**."✅ CUDA graphs (model-agnostic) squeeze:
Why full batched decode is a larger follow-up
Gemma 4 (Gemma-3n-class MatFormer) breaks the batched-decode engine's uniform-layer assumptions:
per-layer head/FFN dims, alternating sliding-window / full attention, shared-KV layers,
per-layer embeddings (PLE) + AltUp, pre+post norms + per-head Q/K RMSNorm + query scaling,
GeGLU (not SiLU), NEOX RoPE with two thetas, final logit softcap, and BF16/Q8_0
weights (no plain FP16 for the FP16 MMA path). A Gemma 4 batched-decode layer graph therefore
needs new windowed decode attention, GeGLU FFN, and NEOX RoPE kernels + Gemma
norm/scale tasks + shared-KV addressing + a PLE embedding path + a BF16-or-FP16 weight story —
a dedicated multi-file build, not a small fork.
What transfers for free
The engine-level features (on-device sampling, continuous batching, PagedAttention,
prefix caching, logits-skip) are model-agnostic and drop in once a Gemma 4 batched
forward exists. On-device sampling would help Gemma 4 more (vocab ~262 k → bigger per-step D2H);
greedy stays valid through the monotonic tanh softcap.
Tracked in the vLLM roadmap issue beehive-lab#130. Base branch:
feat/static-batched-decode(PR beehive-lab#129).