-
Notifications
You must be signed in to change notification settings - Fork 293
[Klaud Cold] Try TEP4 and DEP4 for DeepSeek V4.1 Flash AgentX on B300 / 在 B300 上尝试 DeepSeek V4.1 Flash AgentX 的 TEP4 与 DEP4 #3028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,13 @@ check_env_vars MODEL TP CONC KV_OFFLOADING TOTAL_CPU_DRAM_GB RESULT_DIR DURATION | |
| require_agentic_kv_offload_none | ||
| export GPU_COUNT="$TP" | ||
|
|
||
| # Parallelism arms. The matrix always sets EP_SIZE and DP_ATTENTION; stand-alone | ||
| # runs default to the pure-TP recipe. TEP keeps TP attention and shards the | ||
| # routed experts (--enable-expert-parallel). DEP runs one attention rank per | ||
| # GPU (--data-parallel-size TP) behind vllm-router with session affinity. | ||
| EP_SIZE="${EP_SIZE:-1}" | ||
| DP_ATTENTION="${DP_ATTENTION:-false}" | ||
|
|
||
| # Complete/resume partial downloads instead of trusting nonempty directories. | ||
| if [[ -n "${MODEL_PATH:-}" && "$MODEL_PATH" != "$MODEL" ]]; then | ||
| hf download "$MODEL" --local-dir "$MODEL_PATH" | ||
|
|
@@ -21,21 +28,42 @@ resolve_trace_source | |
| install_agentic_deps | ||
| mkdir -p "$RESULT_DIR" | ||
| SERVER_LOG="$RESULT_DIR/server.log" | ||
| ROUTER_LOG="$RESULT_DIR/router.log" | ||
| export VLLM_ENGINE_READY_TIMEOUT_S="${VLLM_ENGINE_READY_TIMEOUT_S:-3600}" | ||
| export VLLM_USE_RUST_FRONTEND=1 | ||
| export PYTHONUNBUFFERED=1 | ||
|
|
||
| # Preserve the upstream scheduler defaults; size graph capture for the sweep. | ||
| # Each DEP rank sees about CONC/TP sequences; capture for twice that so | ||
| # consistent-hash imbalance across ranks still lands on captured graphs. | ||
| NUM_SPEC_TOKENS=5 | ||
| if [[ "$DP_ATTENTION" == "true" ]]; then | ||
| CAPTURE_TARGET=$(( 2 * ((CONC + TP - 1) / TP) * (1 + NUM_SPEC_TOKENS) )) | ||
| else | ||
| CAPTURE_TARGET=$(( CONC * (1 + NUM_SPEC_TOKENS) )) | ||
| fi | ||
| CAPTURE_SIZE=1 | ||
| while (( CAPTURE_SIZE < CONC * (1 + NUM_SPEC_TOKENS) && CAPTURE_SIZE < 2048 )); do | ||
| while (( CAPTURE_SIZE < CAPTURE_TARGET && CAPTURE_SIZE < 2048 )); do | ||
| CAPTURE_SIZE=$((CAPTURE_SIZE * 2)) | ||
| done | ||
|
|
||
| # Pyxis shares the host network; port 8888 can already belong to a host service. | ||
| select_available_server_port | ||
| VLLM_BACKEND_PORT="$PORT" | ||
| if [[ "$DP_ATTENTION" == "true" ]]; then | ||
| # vllm-router fronts the DP ranks on PORT and expands the one HTTP backend | ||
| # into one logical worker per rank. Bind every turn of a conversation to | ||
| # the same rank by mapping AIPerf's correlation ID to X-Session-ID. | ||
| VLLM_BACKEND_PORT=$((PORT + 1)) | ||
| VLLM_ROUTER_VERSION=0.1.14 | ||
| VLLM_ROUTER_METRICS_PORT=$((PORT + 10000)) | ||
|
Comment on lines
+57
to
+59
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 VLLM_BACKEND_PORT (PORT+1) and VLLM_ROUTER_METRICS_PORT (PORT+10000) are derived by pure arithmetic from PORT and never checked for availability or validity, unlike PORT itself which goes through select_available_server_port's bind-probe/fallback. When select_available_server_port falls back to an OS-assigned ephemeral port (its documented purpose, since "port 8888 can already belong to a host service"), that port can already be in the 50000-60999 range, pushing PORT+10000 past 65535 into an invalid port number, or PORT+1 into a port already bound by another process on the shared host. Fix: allocate/validate VLLM_BACKEND_PORT and VLLM_ROUTER_METRICS_PORT the same way PORT is (probe-and-bind or clamp+retry), not by fixed offset arithmetic on an already-randomized base port. Extended reasoning...select_available_server_port (benchmark_lib.sh:28-45) binds to 8888 or, on EADDRINUSE, to sock.bind(("0.0.0.0",0)) which the kernel satisfies from its local ephemeral range (commonly up to ~60999 on Linux). The new DEP4 code (lines 52-59) then sets VLLM_BACKEND_PORT=PORT+1 and VLLM_ROUTER_METRICS_PORT=PORT+10000 with no further check. If the OS assigns e.g. PORT=58000, VLLM_ROUTER_METRICS_PORT becomes 68000, an out-of-range port; vllm-router's --prometheus-port argument then fails to bind, crashing the router (and thus the whole DEP4 job) purely because PORT happened to fall back from 8888. Separately, PORT+1 can collide with any other process already listening there on the Pyxis-shared host network, which select_available_server_port would have caught for PORT itself but never checks for the derived port. Verification: normal (conditional). New DEP4-only code derives ports by pure arithmetic with no validation: dsv41flash_fp4_vllm_mtp.sh:57 |
||
| export AIPERF_HTTP_X_SESSION_ID_FROM_CORRELATION_ID=1 | ||
| agentic_pip_install --quiet "vllm-router==$VLLM_ROUTER_VERSION" | ||
| fi | ||
| export AIPERF_SERVER_URL="http://localhost:${PORT}" | ||
| export AIPERF_SERVER_METRICS_URLS="${AIPERF_SERVER_URL}/metrics" | ||
| # AIPerf scrapes the public endpoint's /metrics on its own; under DEP that is the | ||
| # router, so name the engine endpoint explicitly (deduplicated for pure TP). | ||
| export AIPERF_SERVER_METRICS_URLS="http://localhost:${VLLM_BACKEND_PORT}/metrics" | ||
| export AIPERF_REQUIRED_SERVER_METRIC_PREFIX="vllm:" | ||
| echo "Using vLLM endpoint ${AIPERF_SERVER_URL}" | ||
|
|
||
|
|
@@ -46,9 +74,23 @@ if [[ "${EVAL_ONLY:-false}" == true ]]; then | |
| else | ||
| SPEC_CONFIG='{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","rejection_sample_method":"synthetic","synthetic_acceptance_length":3.51,"enable_adaptive_verification":false}' | ||
| fi | ||
| PARALLEL_ARGS=(--tensor-parallel-size "$TP") | ||
| if [[ "$DP_ATTENTION" == "true" ]]; then | ||
| PARALLEL_ARGS=(--tensor-parallel-size 1 --data-parallel-size "$TP") | ||
| # Under DEP every rank's expert layer sees the tokens dispatched from all | ||
| # DP ranks, so the TRT-LLM FP4 MoE workspace is larger than under TP. With | ||
| # the image default of 0.92 the autotuner warmup died 4.45 GiB short after | ||
| # the KV cache was sized (run 34655656558, DEP4 c64); reserve headroom and | ||
| # let the allocator grow segments instead of fragmenting. | ||
| PARALLEL_ARGS+=(--gpu-memory-utilization 0.85) | ||
| export PYTORCH_ALLOC_CONF=expandable_segments:True | ||
| fi | ||
| if [[ "$EP_SIZE" -gt 1 ]]; then | ||
| PARALLEL_ARGS+=(--enable-expert-parallel) | ||
| fi | ||
| VLLM_CMD=( | ||
| vllm serve "$MODEL_PATH" --served-model-name "$MODEL" | ||
| --host 0.0.0.0 --port "$PORT" --tensor-parallel-size "$TP" | ||
| --host 0.0.0.0 --port "$VLLM_BACKEND_PORT" "${PARALLEL_ARGS[@]}" | ||
| --language-model-only | ||
| --tokenizer-mode deepseek_v41 | ||
| --tool-call-parser deepseek_v41 --enable-auto-tool-choice | ||
|
|
@@ -63,7 +105,21 @@ printf '%q ' "${VLLM_CMD[@]}" | tee "$RESULT_DIR/vllm_command.txt" | |
| printf '\n' | tee -a "$RESULT_DIR/vllm_command.txt" | ||
| "${VLLM_CMD[@]}" > "$SERVER_LOG" 2>&1 & | ||
| SERVER_PID=$! | ||
| wait_for_server_ready --port "$PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID" | ||
| wait_for_server_ready --port "$VLLM_BACKEND_PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID" | ||
|
|
||
| if [[ "$DP_ATTENTION" == "true" ]]; then | ||
| echo "Starting vllm-router on port $PORT for $TP DP ranks..." | ||
| vllm-router \ | ||
| --worker-urls "http://localhost:$VLLM_BACKEND_PORT" \ | ||
| --policy consistent_hash \ | ||
| --intra-node-data-parallel-size "$TP" \ | ||
| --host 0.0.0.0 --port "$PORT" \ | ||
| --prometheus-host 127.0.0.1 --prometheus-port "$VLLM_ROUTER_METRICS_PORT" \ | ||
| --request-timeout-secs 14400 \ | ||
| --disable-retries > "$ROUTER_LOG" 2>&1 & | ||
| ROUTER_PID=$! | ||
| wait_for_server_ready --port "$PORT" --server-log "$ROUTER_LOG" --server-pid "$ROUTER_PID" | ||
|
Comment on lines
+108
to
+121
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 In the new DEP4 path, Extended reasoning...wait_for_server_ready() (benchmark_lib.sh:499-528) does Verification: normal. In the new DEP4 path the script calls wait_for_server_ready twice: first for the engine (dsv41flash_fp4_vllm_mtp.sh:101, --server-pid $SERVER_PID) and then for the router (line 114, --server-pid |
||
| fi | ||
|
|
||
| if [[ "${EVAL_ONLY:-false}" == true ]]; then | ||
| run_eval --port "$PORT" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEP ports skip availability checks
Medium Severity
DEP assigns the engine to
PORT+1and router metrics toPORT+10000afterselect_available_server_portonly probesPORT. On the shared Pyxis host network this recipe already treats as contested,PORT+1can be occupied, and an ephemeralPORTabove 55535 makesPORT+10000an invalid TCP port, so the engine orvllm-routerfails to bind.Reviewed by Cursor Bugbot for commit 3d68f98. Configure here.