-
Notifications
You must be signed in to change notification settings - Fork 17
Cached MoE Prefill
Cached prefill runs routed expert matrix work on CUDA while expert weights are managed by the cache. Prefill route density and matrix geometry differ from one-token decode, so it retains the existing shape-selected MMQ or MMVQ consumer instead of forcing one kernel family.
Important
CUDA REQUIRED: The cached expert buffers, mapped dispatch, MMQ/MMVQ consumers, and staging pipeline are CUDA-only.
Routing IDs are reused across sibling expert projections where valid. Large unique sets use bounded overflow staging. Partial tiles and quantized source padding are initialized and bounded before MMQ reads them. Compact expert shapes remain eligible for MMVQ when that is the normal faster consumer; the cache does not force MMQ merely because prefill is active.
Eligible small contiguous F32 expert biases can remain resident through the auxiliary-bank policy. Quantized block-scale banks remain tied to the expert slot that owns their weight data.
Prefill can touch most experts in a layer, so cache hit rate alone is not a sufficient success metric. Compare prompt tokens per second, transfer bytes, staging wait, selected kernel family, and exact/coherent output at the real ubatch.
| Branch | Implementation |
|---|---|
moe-cache |
mmid.cu, mmq.cu, mmvq.cu, moe-cache.cu
|
Review history: PR 41, PR 52, and the promoted grouped architecture in PR 56.
GenerelSchwerz llama.cpp
- Home
- Discord community
- Contributors
- Complete feature index
- Hardware setup guides
- Owner-verified evidence
- Notable runs
- Benchmark comparison showcase
- BeeLlama Main
- Llama Main
- Llama Dev
- MoE Cache
Feature groups
- Memory placement and workspace
- Validation and diagnostics
- CUDA MoE cache and helpers
- Grouped MoE drafting
Source branches