[P/D disagg] Add HiRadixCache and cache-aware DP routing for decode disaggregation - #26046
huanpengchu wants to merge 2 commits into
Conversation
…ware routing Add prefetch-based HiCache integration in decode preallocation queue, cache-aware load balancing in data parallel controller, and extend server args with HiCache and routing configuration options.
…ache commit Revert nsa_indexer.py repeat_interleave logic, forward_mla.py and deepseek_v2.py import formatting, verbose debug/warning logs in data_parallel_controller, decode, and radix_cache, and restore speculative decoding incompatibility check in server_args.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
ishandhanani
left a comment
There was a problem hiding this comment.
Quick thoughts
- Can you share some performance numbers
- Can you split out the DP rank routing bits from enabling HiCache. I think they should be 2 separate PRs just for ease of reviewing
|
|
i believe cache-aware routing will be a huge leap on throughputs improvements. In my observation, zero cache awareness will result in replicas of kvcache, which hinders throughtput scaling. And i think decode-side hi-cache is independent with cache-aware DCP routing. Maybe consider submitting in separate PR? |
Yes, these two functions can be independent of each other. I'm currently testing various throughput and will submit them soon |
I submitted them separately in #26560 and #26561, and included some test results on a single-node 1P4D setup. |
|
Thanks @huanpengchu. Closing this because it is still a draft and has not been updated in 101 days. Reopen it if the work is still relevant. Some directories moved recently, so an older branch may need retargeting: |
Summary
Extend decode-side radix cache (#19746) with HiRadixCache (L2 host cache + optional L3 storage cache) integration and cache-aware load balancing for multi-DP decode deployments.
With HiRadixCache enabled, the decode worker uses a multi-level cache hierarchy:
GPU (L1) prefix hits avoid KV transfers entirely, host-memory (L2) hits load back KV via async prefetch, and optional storage (L3, e.g. Mooncake) hits use a two-phase prefetch (L3→L2→L1).
Cache-aware DP routing directs incoming requests to the DP rank with the best prefix match, maximizing cache hit rates across DP workers.
Main Changes
decode.py)_load_back_and_lock(): match prefix against radix tree, optionallyload back host-cached KV to GPU, then lock the prefix node.
_match_prefix()read-only prefix match for budget pre-checks.prefetch_and_load_back()for L2 host-hit prefixes, wait with timeout before pre-allocation.
prefixes, defer pre-allocation until data arrives at host, then L2→L1
load back to GPU.
_PlannedPreallocbatched planning: scan all queued requests, planprefix match and allocation budget, then batch-evict before committing.
_evict_for_prealloc()/_batch_evict_for_prealloc()for evictionbefore pre-allocation with page-aligned delta calculation.
_cleanup_hicache_aborted_request().data_parallel_controller.py)CACHE_AWAREload balance method for multi-DP decode.estimate_prefix_match(): estimate prefix match length against aCacheDigestusing chained SHA256 hashing on chunk-aligned token boundaries.load-balance override when request imbalance exceeds
--dp-routing-max-extra-reqs.rank has insufficient available KV tokens.
radix_cache.py,hiradix_cache.py)RadixCache.build_cache_digest(): traverse the radix tree and producechunk-aligned prefix hashes for cache-aware routing.
_digest_dirtyflag on insert / evict / load-back to avoidredundant digest rebuilds.
HiRadixCache._skip_node_in_digest(): include evicted-but-backed-upnodes in the digest (recoverable via
load_back())._match_prefix_device_indices()to prevent gaps in
device_indiceswhen a descendant was re-filled.scheduler.py,load_inquirer.py,io_struct.py)CacheDigestdataclass toio_struct.py.CacheDigesttoGetLoadsReqOutputin the load inquirerwhen decode radix cache is enabled.
server_args.py)--disaggregation-decode-enable-hicache,--disaggregation-decode-hicache-ratio,--disaggregation-decode-hicache-size,--disaggregation-decode-hicache-write-policy.--dp-routing-digest-chunk-size,--dp-routing-max-extra-reqs.cache_awareto--load-balance-methodchoices.cache_awarewhen decode radix cache + DP > 1.Interface
Enable HiRadixCache on the decode worker with:
For multi-DP decode with cache-aware routing (auto-enabled when DP > 1 + radix cache):
Test Plan
cache-hit ranks
CI States
Latest PR Test (Base): ❌ Run #26267730577
Latest PR Test (Extra): ❌ Run #26267730531