feat: Kimi-K2.5-MXFP4 LMCache MP offloading for MI355X agentic benchmarks#1564
Merged
seungrokj merged 2 commits intoMay 26, 2026
Conversation
…he MP Add two ROCm-specific patches to the Kimi-K2.5-MXFP4 LMCache MP offloading pipeline that are required for stable operation at high concurrency (c>=32): 1. Chunked connector patch: Caps external KV tokens loaded per scheduling step (CHUNKED_LMCACHE_MAX_TOKENS_PER_LOAD, default 32768) to prevent GPU block exhaustion deadlock when LMCache attempts to restore more KV blocks than the GPU pool can hold simultaneously. 2. Scheduler assertion patch: Handles stale KV transfer finished_recving notifications gracefully instead of asserting. Under high concurrency, asynchronous transfers can complete after the scheduler has already moved a request past WAITING_FOR_REMOTE_KVS state. These patches are loaded via sitecustomize.py alongside the existing demand-pinned memory and MP block transfer fallback patches. Validated in a 19-config sweep on MI355X (TP=4/8 × none/lmcache × c=16..56). At TP=8 c=32, LMCache with chunked loading delivers 3× output throughput (97 vs 33 tok/s) and 7.3× lower ITL (68ms vs 493ms) compared to no offloading. Upstream LMCache PR: LMCache/LMCache#3382
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 39159f7. Configure here.
vLLM passes finished_req_ids as a plain set to get_finished(), not a SchedulerOutput object. The previous getattr() call always fell back to an empty list, causing _chunk_state entries to never be cleaned up. Now checks if scheduler_output is a set/frozenset and iterates directly, with a fallback to the attribute path for forward compatibility. Fixes Cursor Bugbot finding: 'Chunk state cleanup never runs'.
Collaborator
|
LGTM |
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
Adds chunked KV loading and vLLM scheduler assertion patches to the Kimi-K2.5-MXFP4 LMCache MP offloading pipeline for MI355X agentic benchmarks. These patches are required for stable, high-concurrency operation (c≥32) on ROCm.
What is LMCache MP?
LMCache MP (Multi-Process) uses an external LMCache server process that owns a large CPU DRAM pool (2.5 TB) for semantic KV caching. Unlike vLLM's built-in
SimpleCPUOffloadConnectorwhich evicts/restores KV blocks reactively, LMCache MP:Changes in this PR
Two new ROCm-specific runtime patches added to
sitecustomize.py:Chunked connector patch (
chunked_connector_patch.py): Caps external KV tokens loaded per scheduling step viaCHUNKED_LMCACHE_MAX_TOKENS_PER_LOAD(default 32768). Without this, at c≥32, LMCache attempts to restore more KV blocks than the GPU pool can hold simultaneously, causing a deadlock where no request can make progress.Scheduler assertion patch (
scheduler_assertion_patch.py): Handles stale KV transferfinished_recvingnotifications gracefully. Under high concurrency, asynchronous H2D transfers can complete after the scheduler has already moved a request pastWAITING_FOR_REMOTE_KVS→RUNNING, triggering an assertion crash.Benchmark Results (19-config sweep on MI355X)
Environment: vLLM 0.21.0, ROCm 7.2.2, 8× MI355X (288 GB VRAM each), mia1-p02-g17
Model: amd/Kimi-K2.5-MXFP4 (MoE, 262K context)
Benchmark: AgentX v0.3 agentic trace replay, 1800s duration, 375 conversations
TP=8: No Offloading vs LMCache
Key findings:
TP=4: LMCache extends usable range
ROCm-Specific Patches (full stack)
LMCACHE_ROCM_DEMAND_PINNED_ALLOCATOR=1multi_layer_block_kv_transfer(no CUDA kernel on ROCm)LMCACHE_ROCM_MP_BLOCK_FALLBACK=1CHUNKED_LMCACHE_MAX_TOKENS_PER_LOAD=32768How to Run
Related
Note
Medium Risk
Monkey-patches LMCache connector and vLLM scheduler scheduling/KV-transfer behavior at runtime; incorrect caps or stale-notification handling could affect correctness or throughput under load, though scope is limited to the benchmark ROCm patch path.
Overview
Extends the MI355X Kimi LMCache MP benchmark bootstrap with two runtime monkey-patches dropped into the existing ROCm
sitecustomizepatch directory and loaded viaPYTHONPATH.Chunked KV loading (
CHUNKED_LMCACHE_MAX_TOKENS_PER_LOAD, default 32768): patchesLMCacheMPConnectorso each scheduling step only reports/loads a capped slice of external matched tokens (with per-request chunk state and cleanup on finish). This avoids GPU KV block exhaustion deadlocks at high concurrency (e.g. c≥32). Set 0 to disable chunking.Scheduler KV transfer fix: replaces vLLM’s
_update_from_kv_xfer_finishedhandling so stalefinished_recvingnotifications (request already pastWAITING_FOR_REMOTE_KVS) log a warning instead of asserting, while still honoring normal receive/send completion paths.The
lmcacheoffload path now writes both patch modules alongside the existing ROCm patches and exports the chunk env var by default.Reviewed by Cursor Bugbot for commit e5bd4d8. Bugbot is set up for automated code reviews on this repo. Configure here.