Review LMCache offload compatible connector and bounded staging#3
Open
yhl-amd wants to merge 27 commits into
Open
Review LMCache offload compatible connector and bounded staging#3yhl-amd wants to merge 27 commits into
yhl-amd wants to merge 27 commits into
Conversation
…WIP) New atom/kv_transfer/offload/ package: a standalone (non-vLLM) KV offload connector that reuses LMCache as a storage tier (CPU LRU + NVMe L3) via StorageManager + ChunkedTokenDatabase, with an opaque per-block byte codec (ATOMKVByteCodec) that bypasses engine.store/retrieve to preserve AITER's swizzled KV layout. Load/save run daemon-after-forward off the RPC thread; cross-process hit lookup via LMCache's ZMQ LookupClient/LookupServer. Engine hooks: - disaggregation/factory.py: register the "lmcache_offload" connector. - model_engine/scheduler.py: offload-wake branch (a parked WAITING_FOR_REMOTE_KVS seq resumes as a suffix prefill, not the P/D decode-jump) + offload_resume guard against re-allocate-on-populated-blocks. TP=2 fixes (offload was non-functional at TP>1): - config.py: lookup_server_worker_ids=[0]. The cross-rank ZMQ lookup took min() across ranks and rank!=0 returned 0 despite having stored the chunk (contains()=True) -> min(0,hit)=0 -> the load never fired. Only rank 0 answers lookup now (both ranks save in lockstep, so rank 0 is authoritative). - connector.py: split load/save into separate executors so a latency-critical reload never queues behind the fire-and-forget save backlog. Verified end-to-end at TP=2 (MiniMax-M2.5 FP8, 2x MI325X): an evicted 32K prompt reloads 32000 tokens from CPU and recomputes only the 5-token suffix (Scheduled prefill cached:[32000], new:[5]); was a full recompute before. Known issues (WIP): - Reload latency high (~131s in the micro-bench): the per-block Python copy path is slow (~88ms/chunk) and the load waits on the storage_manager lock held by a save burst. Needs a bulk/batched copy rewrite of ATOMKVByteCodec. See ../OFFLOAD_TP2_FIXES.md and ../PHASE4_RESULTS.md. - Verbose [OFFLOAD-*] diagnostic logging + an engine.lookup monkeypatch are still present and must be removed/demoted before benchmark/production use. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This reverts commit 77dbd02.
Apply Scheme A load semantics after allocation: skip small or unsafe CPU reloads, hand off unaligned HBM floors by prefill-to-boundary when enabled, and promote completed remote-KV waiters before fresh admissions. Add scheduler and connector tests for aligned reloads, unaligned handoff, min-load skips, and deferred-output cleanup.
yhl-amd
commented
Jun 8, 2026
| entries) and check `can_allocate` + token-budget, mirroring the | ||
| same checks the admission while-loop runs below. | ||
| """ | ||
| if self._partial_prefill_count > 0: |
Owner
Author
There was a problem hiding this comment.
解决已有问题,如果只看waiting状态会有问题的
A prompt:
[chunk1 已算] [chunk2 未算] [chunk3 未算]
A 在 running
A.is_partial_prefill = True
_partial_prefill_count = 1
yhl-amd
commented
Jun 8, 2026
| if num_new_tokens > self.max_num_batched_tokens: | ||
| if ( | ||
| not self.enable_chunked_prefill | ||
| and num_new_tokens > self.max_num_batched_tokens |
Owner
Author
There was a problem hiding this comment.
超长上下文超过了maxlen,也不支持标记为prefillable,防止 dp的时候认为他又能了
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.
Summary
This is a consolidated review PR for the LMCache KV offload stack.
The PR base is intentionally
review/lmcache-offload-base-release_rc, a fork branch pointing at the originalorigin/release_rcsnapshot. This avoids the noisymainhistory mismatch and makes GitHub show the full offload diff in one PR.Existing stacked PRs are still useful for smaller slices:
feature/lmcache-compatible-connector -> feature/lmcache-offload-scheme-afeature/lmcache-compatible-fused-staging -> feature/lmcache-compatible-connectorThis PR shows the whole stack through
feature/lmcache-default-chunk2.Key Changes
CacheEngine.store()/CacheEngine.retrieve()without modifying LMCache source.OFFLOAD_GPU_STAGING_CHUNKS.OFFLOAD_GPU_STAGING_CHUNKSto2.Validation
Recent chunk2 CxS fixed-source runs are recorded in
18_SUMMARY_009_kv_offload.mdoutside this repo checkout:Review Notes
chunk2is the low-memory default, not the best performance point. The benchmark notes show that chunk32 is faster for non-layerwise bounded staging, but uses more resident staging memory. This branch defaults to chunk2 as requested.