From e1429284278314b70e8a2a1c51e80dea9278b770 Mon Sep 17 00:00:00 2001 From: Cam Quilici Date: Fri, 24 Apr 2026 17:55:49 -0500 Subject: [PATCH] chore: tag dsv4 b300 benchmark scripts with inference engine Each model historically used one inference engine, so the b300 launcher just resolved benchmarks/single_node/${model}_${precision}_b300.sh regardless of FRAMEWORK. With dsv4 we now want both an sglang and a vllm script to coexist, so: - launch_b300-nv.sh prefers an engine-tagged script (e.g. dsv4_fp4_b300_sglang.sh) and falls back to the legacy unsuffixed name (or the existing _trt suffix) when the tagged variant is absent. Existing dsr1/glm5/qwen3.5/kimik2.5/minimaxm2.5 b300 scripts keep their current names. - Rename the existing sglang dsv4 b300 script to dsv4_fp4_b300_sglang.sh. - Restore dsv4_fp4_b300_vllm.sh from the abandoned origin/claude/add-dsv4-fp4-b300-vllm branch (script only; not wired into a config yet). Co-Authored-By: Claude Opus 4.7 (1M context) --- ...v4_fp4_b300.sh => dsv4_fp4_b300_sglang.sh} | 0 benchmarks/single_node/dsv4_fp4_b300_vllm.sh | 104 ++++++++++++++++++ runners/launch_b300-nv.sh | 13 ++- 3 files changed, 115 insertions(+), 2 deletions(-) rename benchmarks/single_node/{dsv4_fp4_b300.sh => dsv4_fp4_b300_sglang.sh} (100%) create mode 100755 benchmarks/single_node/dsv4_fp4_b300_vllm.sh diff --git a/benchmarks/single_node/dsv4_fp4_b300.sh b/benchmarks/single_node/dsv4_fp4_b300_sglang.sh similarity index 100% rename from benchmarks/single_node/dsv4_fp4_b300.sh rename to benchmarks/single_node/dsv4_fp4_b300_sglang.sh diff --git a/benchmarks/single_node/dsv4_fp4_b300_vllm.sh b/benchmarks/single_node/dsv4_fp4_b300_vllm.sh new file mode 100755 index 000000000..8ec35beac --- /dev/null +++ b/benchmarks/single_node/dsv4_fp4_b300_vllm.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash + +# Per https://vllm.ai/blog/deepseek-v4 the DeepSeek-V4-Pro recipe lists +# 8xB200 and 8xB300 with identical flags, so this script mirrors +# dsv4_fp4_b200.sh. + +source "$(dirname "$0")/../benchmark_lib.sh" + +check_env_vars \ + MODEL \ + TP \ + CONC \ + ISL \ + OSL \ + MAX_MODEL_LEN \ + RANDOM_RANGE_RATIO \ + RESULT_FILENAME + +if [[ -n "$SLURM_JOB_ID" ]]; then + echo "JOB $SLURM_JOB_ID running on $SLURMD_NODENAME" +fi + +nvidia-smi + +SERVER_LOG=/workspace/server.log +PORT=${PORT:-8888} + +# DeepSeek-V4-Pro weights are large and engine startup on B300 can exceed +# the default 600s. Give it an hour to load. +export VLLM_ENGINE_READY_TIMEOUT_S=3600 + +if [ "${EVAL_ONLY}" = "true" ]; then + setup_eval_context + MAX_MODEL_LEN="$EVAL_MAX_MODEL_LEN" +fi + +# Monkey-patch: bypass persistent_topk unconditionally. It raises "k out of +# range" during CUDA graph capture when the dummy batch has rows with +# seq_lens[i] < k (=2048 for DSV4). An attn_metadata.max_seq_len-based gate is +# not strict enough because dummy batches can have max >= k while individual +# rows have seq_lens[i] = 1. Fall back to top_k_per_row_decode everywhere so +# 1k/1k capture completes; 8k/1k already worked without the patch but we trade +# a small decode-time perf cost there to keep the script single-branch. +INDEXER_PY=/usr/local/lib/python3.12/dist-packages/vllm/model_executor/layers/sparse_attn_indexer.py +echo "[monkey-patch] patching $INDEXER_PY" +sed -i 's/if current_platform.is_cuda() and topk_tokens in (512, 1024, 2048)[^:]*:/if False: # monkey-patched: bypass persistent_topk (k out of range)/' "$INDEXER_PY" +if ! grep -Fq 'if False: # monkey-patched: bypass persistent_topk' "$INDEXER_PY"; then + echo "[monkey-patch] FAILED: expected marker not found in $INDEXER_PY" >&2 + echo "[monkey-patch] current line around persistent_topk dispatch:" >&2 + grep -n 'topk_tokens in\|persistent_topk' "$INDEXER_PY" >&2 || true + exit 1 +fi +echo "[monkey-patch] applied: $(grep -n 'if False: # monkey-patched' $INDEXER_PY)" + +# Start GPU monitoring (power, temperature, clocks every second) +start_gpu_monitor + +# Per the recipe, run with EP + DP=8 (no --tensor-parallel-size flag). TP +# from the search space is used only for GPU allocation by the runner and +# as the DP size. +set -x +vllm serve $MODEL --host 0.0.0.0 --port $PORT \ +--trust-remote-code \ +--kv-cache-dtype fp8 \ +--block-size 256 \ +--no-enable-prefix-caching \ +--enable-expert-parallel \ +--data-parallel-size $TP \ +--max-model-len $MAX_MODEL_LEN \ +--compilation-config '{"cudagraph_mode":"FULL_AND_PIECEWISE","custom_ops":["all"]}' \ +--tokenizer-mode deepseek_v4 \ +--tool-call-parser deepseek_v4 \ +--enable-auto-tool-choice \ +--reasoning-parser deepseek_v4 > $SERVER_LOG 2>&1 & + +SERVER_PID=$! + +# Wait for server to be ready +wait_for_server_ready --port "$PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID" + +pip install -q datasets pandas + +run_benchmark_serving \ + --model "$MODEL" \ + --port "$PORT" \ + --backend vllm \ + --input-len "$ISL" \ + --output-len "$OSL" \ + --random-range-ratio "$RANDOM_RANGE_RATIO" \ + --num-prompts "$((CONC * 10))" \ + --max-concurrency "$CONC" \ + --result-filename "$RESULT_FILENAME" \ + --result-dir /workspace/ \ + --trust-remote-code + +# After throughput, run evaluation only if RUN_EVAL is true +if [ "${RUN_EVAL}" = "true" ]; then + run_eval --framework lm-eval --port "$PORT" + append_lm_eval_summary +fi + +# Stop GPU monitoring +stop_gpu_monitor +set +x diff --git a/runners/launch_b300-nv.sh b/runners/launch_b300-nv.sh index 3daac0167..3c855e805 100644 --- a/runners/launch_b300-nv.sh +++ b/runners/launch_b300-nv.sh @@ -259,8 +259,17 @@ else export MODEL="$HF_HUB_CACHE_MOUNT/dsv4-pro" fi SQUASH_FILE="/data/home/sa-shared/gharunners/squash/$(echo "$IMAGE" | sed 's/[\/:@#]/_/g').sqsh" - FRAMEWORK_SUFFIX=$([[ "$FRAMEWORK" == "trt" ]] && printf '_trt' || printf '') SPEC_SUFFIX=$([[ "$SPEC_DECODING" == "mtp" ]] && printf '_mtp' || printf '') + # Prefer a framework-tagged script (e.g. dsv4_fp4_b300_sglang.sh) so models + # with multiple inference engines can coexist; fall back to the historical + # name without an engine suffix (`_trt` for trt, bare for everyone else) + # for scripts that haven't been retagged yet. + BENCH_BASE="benchmarks/single_node/${EXP_NAME%%_*}_${PRECISION}_b300" + BENCH_SCRIPT="${BENCH_BASE}_${FRAMEWORK}${SPEC_SUFFIX}.sh" + if [[ ! -f "$BENCH_SCRIPT" ]]; then + LEGACY_FW_SUFFIX=$([[ "$FRAMEWORK" == "trt" ]] && printf '_trt' || printf '') + BENCH_SCRIPT="${BENCH_BASE}${LEGACY_FW_SUFFIX}${SPEC_SUFFIX}.sh" + fi LOCK_FILE="${SQUASH_FILE}.lock" # TODO(Cam): the deepseek-v4 sglang images (lmsysorg/sglang:deepseek-v4-blackwell @@ -300,6 +309,6 @@ else --no-container-mount-home \ --container-workdir=$CONTAINER_MOUNT_DIR \ --no-container-entrypoint --export=ALL,PORT=8888 \ - bash benchmarks/single_node/${EXP_NAME%%_*}_${PRECISION}_b300${FRAMEWORK_SUFFIX}${SPEC_SUFFIX}.sh + bash "$BENCH_SCRIPT" fi