Skip to content

Commit 01e9e73

Browse files
ApostaCclaudecquil11
authored
[LMCache] Add LMCache arm to official DSV4 FP4 B200 vLLM AgentX sweep / 将 LMCache 分支并入官方 DSV4 FP4 B200 vLLM AgentX 扫描 (#2231)
* feat(agentic): add LMCache arm to official DSV4 FP4 B200 vLLM AgentX sweep Rebased onto main after PR #2224 merged the tuned B200 recipe. The LMCache points now live directly in the official dsv4-fp4-b200-vllm-agentic search space alongside the vllm-simple and Mooncake arms (no standalone config section). LMCache 0.5.1 MP server (lmcache_driven transfer mode) + LMCacheMPConnector per PR #2153; the lmcache arm drops --enable-cumem-allocator because cuMem/VMM allocations cannot be CUDA-IPC-exported to the LMCache server. Ladder validated in the PR #2231 bring-up sweep: peak ~25.7k total tok/s/GPU at DEP8 conc 72 with 96-98% cache hit. 中文:在 PR #2224 的调优配方合并后 rebase 到 main。LMCache 测试点直接并入 官方 dsv4-fp4-b200-vllm-agentic 搜索空间,与 vllm-simple、Mooncake 分支 并列(不再使用独立配置段)。LMCache 0.5.1 MP server(lmcache_driven 传输模式)+ LMCacheMPConnector(沿用 PR #2153);lmcache 分支去掉 --enable-cumem-allocator(cuMem/VMM 分配无法通过 CUDA IPC 导出给 LMCache server)。测试点阶梯已在 PR #2231 调试扫描中验证:DEP8 并发 72 达到峰值约 25.7k total tok/s/GPU,缓存命中率 96–98%。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(agentic): align LMCache DEP8 conc-list with the Mooncake ladder Change the LMCache DEP8 points from the vllm-simple ladder to the Mooncake ladder ([12, 20, 28, 36, 44, 52, 60, 68, 76]) so the two external KV stores are benchmarked at identical concurrency points. TP8 stays on [8, 12, 16] (Mooncake has no TP8 arm). 中文:将 LMCache DEP8 测试点从 vllm-simple 阶梯改为 Mooncake 阶梯 ([12, 20, 28, 36, 44, 52, 60, 68, 76]),使两个外部 KV 存储在完全相同的 并发点上进行基准测试。TP8 保持 [8, 12, 16](Mooncake 无 TP8 分支)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Cam Quilici <cjquilici@gmail.com>
1 parent 9ecc56d commit 01e9e73

3 files changed

Lines changed: 108 additions & 2 deletions

File tree

benchmarks/single_node/agentic/dsv4_fp4_b200_vllm.sh

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ set -x
2121
# MODEL, TP, CONC, KV_OFFLOADING, TOTAL_CPU_DRAM_GB, RESULT_DIR
2222
#
2323
# Pure TP is GPU-resident (KV_OFFLOADING=none). DEP tiers offload KV to host
24-
# DRAM: KV_OFFLOADING=dram requires KV_OFFLOAD_BACKEND=vllm-simple or mooncake.
24+
# DRAM: KV_OFFLOADING=dram requires KV_OFFLOAD_BACKEND=vllm-simple, mooncake,
25+
# or lmcache.
2526

2627
source "$(dirname "$0")/../../benchmark_lib.sh"
2728

@@ -101,13 +102,18 @@ export VLLM_RPC_TIMEOUT=600000
101102
SERVER_LOG="$RESULT_DIR/server.log"
102103
ROUTER_LOG="$RESULT_DIR/router.log"
103104
MOONCAKE_MASTER_LOG="$RESULT_DIR/mooncake_master.log"
105+
LMCACHE_SERVER_LOG="$RESULT_DIR/lmcache_server.log"
104106
mkdir -p "$RESULT_DIR"
105107

106108
SERVER_PID=""
107109
ROUTER_PID=""
108110
MOONCAKE_MASTER_PID=""
111+
LMCACHE_SERVER_PID=""
109112

110113
OFFLOAD_ARGS=()
114+
# vLLM's cuMem/VMM allocator is the recipe default; the lmcache arm clears
115+
# this (see the lmcache case below).
116+
CUMEM_ARGS=(--enable-cumem-allocator)
111117
case "$KV_OFFLOAD_BACKEND" in
112118
"")
113119
require_agentic_kv_offload_none
@@ -194,6 +200,94 @@ EOF
194200
'{"kv_connector":"MooncakeStoreConnector","kv_role":"kv_both","kv_connector_extra_config":{"load_async":true}}'
195201
)
196202
;;
203+
lmcache)
204+
require_agentic_kv_offload_backend lmcache
205+
# The LMCache MP server owns the host-DRAM KV pool as one shared
206+
# tier; vLLM ranks attach via LMCacheMPConnector, so the aggregate
207+
# host budget is passed through undivided (unlike Mooncake's
208+
# per-rank segments). Follows the LMCache DeepSeek-V4 recipe
209+
# (docs.lmcache.ai/recipes/deepseek_v4_flash.html); LMCache handles
210+
# DSV4's Sparse-MLA hybrid KV geometries automatically.
211+
LMCACHE_VERSION=0.5.1
212+
agentic_pip_install --quiet --no-cache-dir "lmcache==$LMCACHE_VERSION"
213+
python3 -c "import lmcache.integration.vllm.lmcache_mp_connector" >/dev/null
214+
215+
LMCACHE_HOST=127.0.0.1
216+
LMCACHE_PORT=$((PORT + 12000))
217+
LMCACHE_HTTP_PORT=$((PORT + 13000))
218+
# LMCacheMPConnector concatenates lmcache.mp.host and port into the
219+
# ZMQ endpoint. Bind the server to a raw host, but pass the connector
220+
# a ZMQ-style host string.
221+
LMCACHE_CONNECT_HOST="tcp://$LMCACHE_HOST"
222+
# Pool target derated to 75% of the aggregate budget: pinned host
223+
# memory is unswappable and also consumes GPU-side mapping
224+
# resources, so leave headroom for vLLM host buffers and the OS.
225+
# Full-budget targets OOM-killed the node (host OOM-killer or
226+
# cudaErrorMemoryAllocation) as the cache filled past ~2 TB during
227+
# PR #2153 bring-up.
228+
LMCACHE_L1_SIZE_GB=$((TOTAL_CPU_DRAM_GB * 3 / 4))
229+
# The pool grows lazily from the initial allocation, so the full
230+
# --l1-size-gb target is not pinned at startup.
231+
LMCACHE_L1_INIT_SIZE_GB=20
232+
LMCACHE_MQ_TIMEOUT=300
233+
# Identical prefixes must hash to identical cache keys across DP ranks.
234+
export PYTHONHASHSEED=0
235+
# LMCacheMPConnector exports the KV cache to the LMCache server
236+
# through legacy CUDA IPC handles, and cuMem/VMM allocations cannot
237+
# be exported that way (register_kv_caches fails with
238+
# cudaErrorInvalidValue), so drop the allocator for this arm only.
239+
CUMEM_ARGS=()
240+
# Per-engine scheduler stats every 5s, to diagnose per-DP-rank KV
241+
# cache imbalance under the session-sticky router.
242+
export VLLM_LOG_STATS_INTERVAL=5
243+
244+
echo "Starting LMCache MP server on port $LMCACHE_PORT..."
245+
# One GPU-side transfer worker avoids concurrent-GPU-transfer stalls
246+
# under heavy async-load pressure; CPU-side workers stay at 8.
247+
lmcache server \
248+
--host "$LMCACHE_HOST" \
249+
--port "$LMCACHE_PORT" \
250+
--http-host "$LMCACHE_HOST" \
251+
--http-port "$LMCACHE_HTTP_PORT" \
252+
--l1-size-gb "$LMCACHE_L1_SIZE_GB" \
253+
--l1-init-size-gb "$LMCACHE_L1_INIT_SIZE_GB" \
254+
--max-gpu-workers 1 \
255+
--max-cpu-workers 8 \
256+
--chunk-size 1024 \
257+
--l1-align-bytes 16384 \
258+
--eviction-trigger-watermark 0.85 \
259+
--eviction-ratio 0.10 \
260+
--eviction-policy LRU \
261+
--supported-transfer-mode lmcache_driven \
262+
--no-separate-object-groups \
263+
> "$LMCACHE_SERVER_LOG" 2>&1 &
264+
LMCACHE_SERVER_PID=$!
265+
LMCACHE_READY=0
266+
for _ in $(seq 1 60); do
267+
if ! kill -0 "$LMCACHE_SERVER_PID" 2>/dev/null; then
268+
echo "LMCache server died during startup." >&2
269+
cat "$LMCACHE_SERVER_LOG" >&2
270+
exit 1
271+
fi
272+
if curl --output /dev/null --silent --fail \
273+
"http://127.0.0.1:$LMCACHE_HTTP_PORT/healthcheck"; then
274+
LMCACHE_READY=1
275+
break
276+
fi
277+
sleep 2
278+
done
279+
if [ "$LMCACHE_READY" -ne 1 ]; then
280+
echo "LMCache server did not become healthy in time." >&2
281+
cat "$LMCACHE_SERVER_LOG" >&2
282+
exit 1
283+
fi
284+
285+
unset VLLM_USE_SIMPLE_KV_OFFLOAD
286+
OFFLOAD_ARGS=(
287+
--kv-transfer-config
288+
"{\"kv_connector\":\"LMCacheMPConnector\",\"kv_role\":\"kv_both\",\"kv_connector_extra_config\":{\"lmcache.mp.host\":\"$LMCACHE_CONNECT_HOST\",\"lmcache.mp.port\":$LMCACHE_PORT,\"lmcache.mp.mq_timeout\":$LMCACHE_MQ_TIMEOUT}}"
289+
)
290+
;;
197291
*)
198292
echo "Error: unsupported B200 KV_OFFLOAD_BACKEND='$KV_OFFLOAD_BACKEND'" >&2
199293
exit 1
@@ -237,7 +331,7 @@ VLLM_CMD=(
237331
--max-model-len 1048576
238332
--gpu-memory-utilization 0.92
239333
--numa-bind
240-
--enable-cumem-allocator
334+
"${CUMEM_ARGS[@]}"
241335
--no-enable-flashinfer-autotune
242336
--tokenizer-mode deepseek_v4
243337
--reasoning-parser deepseek_v4

configs/nvidia-master.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,9 +960,11 @@ dsv4-fp4-b200-vllm-agentic:
960960
# Pure TP at low concurrency.
961961
- { tp: 8, kv-offloading: none, conc-list: [1, 2, 4, 6, 8] }
962962
- { tp: 8, kv-offloading: dram, kv-offload-backend: { name: vllm-simple, version: "904e4ec" }, conc-list: [8, 12, 16] }
963+
- { tp: 8, kv-offloading: dram, kv-offload-backend: { name: lmcache, version: "0.5.1" }, conc-list: [8, 12, 16] }
963964
# DEP
964965
- { tp: 8, ep: 8, dp-attn: true, kv-offloading: dram, kv-offload-backend: { name: vllm-simple, version: "904e4ec" }, conc-list: [8, 16, 24, 32, 40, 48, 56, 64, 68, 72, 80], router: { name: vllm-router, version: "0.1.14" } }
965966
- { tp: 8, ep: 8, dp-attn: true, kv-offloading: dram, kv-offload-backend: { name: mooncake, version: "0.3.11.post1" }, conc-list: [12, 20, 28, 36, 44, 52, 60, 68, 76], router: { name: vllm-router, version: "0.1.14" } }
967+
- { tp: 8, ep: 8, dp-attn: true, kv-offloading: dram, kv-offload-backend: { name: lmcache, version: "0.5.1" }, conc-list: [12, 20, 28, 36, 44, 52, 60, 68, 76], router: { name: vllm-router, version: "0.1.14" } }
966968

967969
dsv4-fp4-b200-trt:
968970
image: ghcr.io#semianalysisai/trtllm-deepseek-v4:feat-deepseek_v4-c185066

perf-changelog.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4993,3 +4993,13 @@
49934993
- "LMCache ladders offset the official arms: TP4 +4 conc [32, 36, 40, 44] vs SimpleCPU [28, 32, 36, 40]; DEP4 +4 conc [36, 44, 52, 60, 68, 76] vs SimpleCPU [32, 40, 48, 56, 64, 72]; DEP8 +8 conc capped at 208 [72, 104, 120, 136, 152, 168, 184, 200] vs GPU-resident [64, 96, 112, 128, 144, 160, 176, 192, 224]"
49944994
pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/2232
49954995

4996+
4997+
- config-keys:
4998+
- dsv4-fp4-b200-vllm-agentic
4999+
scenario-type:
5000+
- agentic-coding
5001+
description:
5002+
- "Add LMCache 0.5.1 DRAM KV-offload arm to the official B200 AgentX sweep alongside the vllm-simple and Mooncake arms, on the same tuned recipe and image (vllm/vllm-openai:nightly-dev-x86_64-cu13.0.1-904e4ec) from PR #2224"
5003+
- "LMCache MP server (lmcache_driven transfer mode) + LMCacheMPConnector per PR #2153; L1 pool derated to 75% of TOTAL_CPU_DRAM_GB; --enable-cumem-allocator dropped on the lmcache arm only (cuMem/VMM allocations cannot be CUDA-IPC-exported to the LMCache server)"
5004+
- "LMCache TP8 points mirror the vllm-simple ladder (conc [8, 12, 16]); LMCache DEP8 points mirror the Mooncake ladder (conc [12, 20, 28, 36, 44, 52, 60, 68, 76]) for a like-for-like backend comparison; the PR #2231 bring-up sweep validated the recipe across DEP8 conc 8-80 (peak ~25.7k total tok/s/GPU at conc 72, 96-98% cache hit)"
5005+
pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/2231

0 commit comments

Comments
 (0)