Skip to content

Commit a35a71f

Browse files
hyukjleeclaude
andcommitted
[AMD][AgentX] kimik2.7: add DEP (DP-attention + EP) path + 900s tune sweep
Wire DP_ATTENTION into the vLLM recipe, mirroring dsv4_fp4_b300_vllm.sh: - DP_ATTENTION=true -> TP1 x DP=$TP with --enable-expert-parallel (experts EP-sharded across DP ranks), fronted by vllm-router on $PORT (consistent_hash + X-session affinity from aiperf's X-Correlation-ID). DP engine binds $PORT+1. - DP_ATTENTION=false -> unchanged pure-TP path on $PORT. - Add DP_ATTENTION to check_env_vars; clean up ROUTER_PID on exit. Retarget the -tune config key from the (non-working) EP1-vs-EP8 probe to a scaling experiment: pure-TP8 vs DEP, each with LMCache/Mooncake, conc[16,32,48], 900s. Aims for a throughput curve that grows with concurrency instead of the GPU-KV-capacity collapse the pure-TP path hits at conc>=16. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7ba22b7 commit a35a71f

2 files changed

Lines changed: 60 additions & 9 deletions

File tree

benchmarks/single_node/agentic/kimik2.7_fp4_mi355x.sh

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set -x
1313

1414
source "$(dirname "$0")/../../benchmark_lib.sh"
1515

16-
check_env_vars MODEL TP CONC KV_OFFLOADING TOTAL_CPU_DRAM_GB RESULT_DIR DURATION EP_SIZE
16+
check_env_vars MODEL TP CONC KV_OFFLOADING TOTAL_CPU_DRAM_GB RESULT_DIR DURATION EP_SIZE DP_ATTENTION
1717

1818
if [[ -n "${SLURM_JOB_ID:-}" ]]; then
1919
echo "JOB $SLURM_JOB_ID running on ${SLURMD_NODENAME:-unknown}"
@@ -76,8 +76,13 @@ PREFIX_CACHE_ARGS=()
7676
# ---- Offload service cleanup ------------------------------------------------
7777
LMCACHE_PID=""
7878
MOONCAKE_MASTER_PID=""
79+
ROUTER_PID=""
7980

8081
cleanup_offload_services() {
82+
if [[ -n "$ROUTER_PID" ]] && kill -0 "$ROUTER_PID" 2>/dev/null; then
83+
kill "$ROUTER_PID" 2>/dev/null || true
84+
wait "$ROUTER_PID" 2>/dev/null || true
85+
fi
8186
if [[ -n "$LMCACHE_PID" ]] && kill -0 "$LMCACHE_PID" 2>/dev/null; then
8287
kill "$LMCACHE_PID" 2>/dev/null || true
8388
wait "$LMCACHE_PID" 2>/dev/null || true
@@ -305,15 +310,37 @@ if [ "$EP_SIZE" -gt 1 ]; then
305310
EP_ARGS=(--enable-expert-parallel)
306311
fi
307312

313+
# Parallelism layout:
314+
# DP_ATTENTION=false -> pure TP: attention TP-sharded across all $TP GPUs in a
315+
# single engine (low TPOT, capacity-capped at high CONC).
316+
# DP_ATTENTION=true -> DEP: per-DP-rank attention (TP1 x DP=$TP) with experts
317+
# EP-sharded across the DP ranks (requires EP_SIZE>1). Grows KV capacity +
318+
# decode width with concurrency. Mirrors dsv4_fp4_b300_vllm.sh.
319+
PARALLEL_ARGS=(--tensor-parallel-size="$TP")
320+
USE_VLLM_ROUTER=false
321+
VLLM_BACKEND_PORT="$PORT"
322+
if [ "$DP_ATTENTION" = "true" ]; then
323+
PARALLEL_ARGS=(--tensor-parallel-size=1 --data-parallel-size="$TP")
324+
USE_VLLM_ROUTER=true
325+
VLLM_BACKEND_PORT=$((PORT + 1))
326+
VLLM_ROUTER_METRICS_PORT=$((PORT + 10000))
327+
# vllm-router expands the one HTTP backend into one logical worker per DP
328+
# rank and sends X-data-parallel-rank per request; consistent_hash pins each
329+
# conversation to a rank so its prefix cache stays warm. aiperf's stable
330+
# X-Correlation-ID is aliased to the router's X-Session-ID for that affinity.
331+
export AIPERF_HTTP_X_SESSION_ID_FROM_CORRELATION_ID=1
332+
pip install --quiet "vllm-router==0.1.14"
333+
fi
334+
308335
echo "Starting vllm server..."
309336
export PYTHONNOUSERSITE=1
310337

311338
{ set +x; } 2>/dev/null
312339
VLLM_CMD=(
313340
vllm serve "$MODEL_PATH" --served-model-name "$MODEL"
314341
--host 0.0.0.0
315-
--port "$PORT"
316-
--tensor-parallel-size="$TP"
342+
--port "$VLLM_BACKEND_PORT"
343+
"${PARALLEL_ARGS[@]}"
317344
"${EP_ARGS[@]}"
318345
--gpu-memory-utilization 0.90
319346
--block-size=1
@@ -329,7 +356,28 @@ printf '\n' | tee -a "$RESULT_DIR/vllm_command.txt"
329356
SERVER_PID=$!
330357
echo "Server PID: $SERVER_PID"
331358

332-
wait_for_server_ready --port "$PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID"
359+
wait_for_server_ready --port "$VLLM_BACKEND_PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID"
360+
361+
# In DEP mode, front the DP engine with vllm-router on $PORT so the agentic
362+
# client (which targets $PORT) load-balances across DP ranks with prefix
363+
# affinity. Pure-TP serves the client directly on $PORT.
364+
if [ "$USE_VLLM_ROUTER" = "true" ]; then
365+
ROUTER_LOG="$RESULT_DIR/router.log"
366+
echo "Starting vLLM router on port $PORT for $TP DP ranks..."
367+
vllm-router \
368+
--worker-urls "http://localhost:$VLLM_BACKEND_PORT" \
369+
--policy consistent_hash \
370+
--intra-node-data-parallel-size "$TP" \
371+
--host 0.0.0.0 \
372+
--port "$PORT" \
373+
--prometheus-host 127.0.0.1 \
374+
--prometheus-port "$VLLM_ROUTER_METRICS_PORT" \
375+
--request-timeout-secs 14400 \
376+
--disable-retries > "$ROUTER_LOG" 2>&1 &
377+
ROUTER_PID=$!
378+
echo "Router PID: $ROUTER_PID"
379+
wait_for_server_ready --port "$PORT" --server-log "$ROUTER_LOG" --server-pid "$ROUTER_PID"
380+
fi
333381

334382
# ---- Run benchmark ----------------------------------------------------------
335383
build_replay_cmd "$RESULT_DIR"

configs/amd-master.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,11 @@ kimik2.7-fp4-mi355x-vllm-agentic:
572572

573573

574574
# Perf-tuning experiment key (same recipe as the record sweep above, via
575-
# model-prefix kimik2.7). Wave 1: does expert parallelism help? Compares EP1
576-
# (current) vs EP8 at TP8+LMCache. Dispatched at 900s via e2e-tests duration
577-
# override to verify the perf delta before committing a full 3600s run.
575+
# model-prefix kimik2.7). Goal: get a throughput curve that scales with
576+
# concurrency instead of collapsing. Compares pure-TP8 (current, capacity-capped)
577+
# vs DEP (data-parallel attention TP1xDP8 + expert parallelism), each with an
578+
# LMCache/Mooncake KV tier. Dispatched at 900s via e2e-tests duration override to
579+
# verify the perf delta before committing a full 3600s run.
578580
kimik2.7-fp4-mi355x-vllm-agentic-tune:
579581
image: vllm/vllm-openai-rocm:v0.24.0
580582
model: amd/Kimi-K2.7-Code-MXFP4
@@ -588,8 +590,9 @@ kimik2.7-fp4-mi355x-vllm-agentic-tune:
588590
- dram-utilization: 0.80
589591
duration: 900
590592
search-space:
591-
- { tp: 8, ep: 1, kv-offloading: dram, kv-offload-backend: { name: lmcache, version: "aaf7c0d3" }, conc-list: [16, 32] }
592-
- { tp: 8, ep: 8, kv-offloading: dram, kv-offload-backend: { name: lmcache, version: "aaf7c0d3" }, conc-list: [16, 32] }
593+
- { tp: 8, dp-attn: false, ep: 1, kv-offloading: dram, kv-offload-backend: { name: lmcache, version: "aaf7c0d3" }, conc-list: [16, 32, 48] }
594+
- { tp: 8, dp-attn: true, ep: 8, kv-offloading: dram, kv-offload-backend: { name: lmcache, version: "aaf7c0d3" }, conc-list: [16, 32, 48] }
595+
- { tp: 8, dp-attn: true, ep: 8, kv-offloading: dram, kv-offload-backend: { name: mooncake, version: "source-main" }, conc-list: [16, 32, 48] }
593596

594597

595598
kimik2.5-fp4-mi355x-atom:

0 commit comments

Comments
 (0)