Repository navigation
feat(moe): split the offload expert cache into slot pools - #689
Conversation
|
Static review only; I didn't run it locally (the new pool tests are all CUDA-only). I didn't find anything that produces wrong results, and the single-pool path looks equivalent to main. A few things I'd like addressed or discussed before merging, roughly in priority order. 1. The multi-layout (per-quant) path is unreachable from the engineEvery format that binds a quant method (bf16, fp8_block, nvfp4*, mxfp4) passes a single FreeToken/python/freetoken/moe/offload_cache.py Lines 486 to 492 in 15f3bff On top of that, That means raw banks, Suggestion: move the multi-layout support into the follow-up that adds a real loader, or at least state this limitation in the code. 2.
|
1a2acd4 to
400cb01
Compare
|
Thanks for the review, pushed 8fa6381, cb2acd8 and 400cb01 on top of 15f3bff.
Nits: left as is ( |
…nto slot pools)
Part of #671.
Summary
The offload expert cache used one LRU pool for all MoE layers. This PR splits it into slot pools: a pool is a contiguous slot range with its own LRU, each MoE layer belongs to one pool, and a pool holds layers of one quant.
--moe-cache-scopeunified(default),per-layerunifiedis one pool, as on main.--moe-cache-splitequal(default),profile:<path>--moe-cache-mem12GiBThe cache also holds pools of different quants, e.g. GGUF Q4_K_M with
ffn_downin Q6_K on some layers and Q4_K on others. No loader produces such banks yet.Changes
Cache (
moe/offload_cache.py)pool_of_layer/pool_sizes, pool-local slot ids, per-pool LRU state and bank views.Kernels (
moe/offload_kernels.py)Policy (
moe/pool_policy.py, new)group_layers(scope),make_pools,split_slots(split), profile loading.Engine and args
ExpertBanks.layer_tagsfor loaders.num_expertsslots lowersmax_running_reqand the CUDA graph batch sizes to fit one decode step.--moe-strategy cpuor--moe-cpu-layers.Other
ft bench bwgather rig and cache status follow the new bank storage.Validation
tests/moe tests/engine tests/server tests/scheduler tests/layers tests/dsv4 tests/kvcache1271 passed, 12 skipped. New tests cover per-layer pools, pools of two layouts through prefill, quant tags, rebuild memory, the split policy and the args.--moe-cache-memend to end, offload with more than one request.