diff --git a/.github/configs/nvidia-master.yaml b/.github/configs/nvidia-master.yaml index 1d467308f..e659a8662 100644 --- a/.github/configs/nvidia-master.yaml +++ b/.github/configs/nvidia-master.yaml @@ -1705,6 +1705,40 @@ dsv4-fp4-b200-sglang: # max-throughput - { tp: 8, ep: 8, dp-attn: true, conc-start: 256, conc-end: 512 } +dsv4-fp4-b200-sglang-mtp: + image: lmsysorg/sglang:deepseek-v4-blackwell + model: deepseek-ai/DeepSeek-V4-Pro + model-prefix: dsv4 + runner: b200-dsv4 + precision: fp4 + framework: sglang + multinode: false + # Mirrors the dsv4-fp4-b200-sglang baseline split (low-latency / balanced / + # max-throughput selected inside benchmarks/single_node/dsv4_fp4_b200_mtp.sh + # by CONC) so result filenames (ep=, dpa=) reflect the recipe. EAGLE/MTP is + # tuned per recipe in the script per + # https://docs.sglang.io/cookbook/autoregressive/DeepSeek/DeepSeek-V4 + # (max-throughput omits MTP since the verify cost exceeds savings at saturation). + seq-len-configs: + - isl: 1024 + osl: 1024 + search-space: + # low-latency + - { tp: 8, ep: 1, conc-start: 4, conc-end: 32, spec-decoding: "mtp" } + # balanced + - { tp: 8, ep: 8, dp-attn: true, conc-start: 64, conc-end: 128, spec-decoding: "mtp" } + # max-throughput + - { tp: 8, ep: 8, dp-attn: true, conc-start: 256, conc-end: 1024, spec-decoding: "mtp" } + - isl: 8192 + osl: 1024 + search-space: + # low-latency + - { tp: 8, ep: 1, conc-start: 4, conc-end: 32, spec-decoding: "mtp" } + # balanced + - { tp: 8, ep: 8, dp-attn: true, conc-start: 64, conc-end: 128, spec-decoding: "mtp" } + # max-throughput + - { tp: 8, ep: 8, dp-attn: true, conc-start: 256, conc-end: 512, spec-decoding: "mtp" } + # NOTE: At the time of submission, https://cookbook.sglang.io/autoregressive/DeepSeek/DeepSeek-R1 # does not have a B300-specific recipe, so this config reuses the existing DSR1 FP4 # B200 SGLang recipe as-is until B300-specific tuning is available. diff --git a/benchmarks/single_node/dsv4_fp4_b200_mtp.sh b/benchmarks/single_node/dsv4_fp4_b200_mtp.sh new file mode 100755 index 000000000..cc9cdca51 --- /dev/null +++ b/benchmarks/single_node/dsv4_fp4_b200_mtp.sh @@ -0,0 +1,137 @@ +#!/usr/bin/env bash + +source "$(dirname "$0")/../benchmark_lib.sh" + +check_env_vars \ + MODEL \ + TP \ + CONC \ + ISL \ + OSL \ + RANDOM_RANGE_RATIO \ + RESULT_FILENAME + +if [[ -n "$SLURM_JOB_ID" ]]; then + echo "JOB $SLURM_JOB_ID running on $SLURMD_NODENAME" +fi + +hf download "$MODEL" + +nvidia-smi + +export SGLANG_JIT_DEEPGEMM_PRECOMPILE=0 +export SGLANG_ENABLE_SPEC_V2=1 +export SGLANG_OPT_USE_CUSTOM_ALL_REDUCE_V2=1 +export SGLANG_OPT_USE_TOPK_V2=1 + +# TODO(Cam): the lmsysorg/sglang:deepseek-v4-blackwell image installs sglang +# editable at /workspace/sglang/python; prior sglang tags used /sgl-workspace/sglang. +# The runner mounts our repo at a non-/workspace path for this image so the editable +# install stays visible. Paths in this script are $PWD-relative for that reason. +# Drop the runner conditional once lmsys moves sglang back out of /workspace. + +SERVER_LOG="$PWD/server.log" +PORT=${PORT:-8888} + +echo "TP: $TP, CONC: $CONC, ISL: $ISL, OSL: $OSL" + +EVAL_CONTEXT_ARGS="" +if [ "${EVAL_ONLY}" = "true" ]; then + setup_eval_context + EVAL_CONTEXT_ARGS="--context-length $EVAL_MAX_MODEL_LEN" +fi + +start_gpu_monitor --output "$PWD/gpu_metrics.csv" + +# Three recipes from https://docs.sglang.io/cookbook/autoregressive/DeepSeek/DeepSeek-V4 +# with EAGLE / MTP speculative decoding tuned per recipe: +# - low-latency (CONC <= 32): TP-only, MTP num-steps=3 / draft-tokens=4 +# - balanced (32 < CONC <= 128): + DP-attn, MTP num-steps=1 / draft-tokens=2 +# - max-throughput (CONC > 128): + DP-attn, MTP disabled (verify cost > savings at saturation) +DEEPEP_CONFIG='{"normal_dispatch":{"num_sms":96},"normal_combine":{"num_sms":96}}' + +SPEC_FLAGS=() + +if [[ $CONC -le 32 ]]; then + RECIPE=low-latency + RECIPE_FLAGS=( + --moe-runner-backend flashinfer_mxfp4 + --chunked-prefill-size 4096 + --disable-flashinfer-autotune + --mem-fraction-static 0.82 + ) + SPEC_FLAGS=( + --speculative-algo EAGLE + --speculative-num-steps 3 + --speculative-eagle-topk 1 + --speculative-num-draft-tokens 4 + ) +elif [[ $CONC -le 128 ]]; then + RECIPE=balanced + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256 + RECIPE_FLAGS=( + --dp-size "$TP" + --enable-dp-attention + --moe-a2a-backend deepep + --deepep-config "$DEEPEP_CONFIG" + --mem-fraction-static 0.82 + --cuda-graph-max-bs 64 + --max-running-requests 128 + ) + SPEC_FLAGS=( + --speculative-algo EAGLE + --speculative-num-steps 1 + --speculative-eagle-topk 1 + --speculative-num-draft-tokens 2 + ) +else + RECIPE=max-throughput + export SGLANG_DEEPEP_NUM_MAX_DISPATCH_TOKENS_PER_RANK=256 + RECIPE_FLAGS=( + --dp-size "$TP" + --enable-dp-attention + --moe-a2a-backend deepep + --deepep-config "$DEEPEP_CONFIG" + --mem-fraction-static 0.82 + --cuda-graph-max-bs 64 + --max-running-requests 256 + ) +fi +echo "Recipe: $RECIPE (CONC=$CONC)" + +set -x +PYTHONNOUSERSITE=1 sglang serve \ + --model-path $MODEL \ + --host 0.0.0.0 \ + --port $PORT \ + --trust-remote-code \ + --tp $TP \ + --disable-radix-cache \ + "${RECIPE_FLAGS[@]}" "${SPEC_FLAGS[@]}" $EVAL_CONTEXT_ARGS > $SERVER_LOG 2>&1 & + +SERVER_PID=$! + +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 "$PWD/" \ + --use-chat-template + +if [ "${RUN_EVAL}" = "true" ]; then + run_eval --framework lm-eval --port "$PORT" + append_lm_eval_summary +fi + +stop_gpu_monitor +set +x diff --git a/perf-changelog.yaml b/perf-changelog.yaml index a6c811748..da0d77613 100644 --- a/perf-changelog.yaml +++ b/perf-changelog.yaml @@ -8,6 +8,14 @@ - "Prefix caching and speculative decoding disabled for baseline numbers" pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/1131 +- config-keys: + - dsv4-fp4-b200-sglang-mtp + description: + - "Add DeepSeek-V4-Pro single-node B200 SGLang benchmark with EAGLE / MTP speculative decoding" + - "Mirrors the dsv4-fp4-b200-sglang baseline recipes (low-latency / balanced / max-throughput)" + - "MTP tuned per https://docs.sglang.io/cookbook/autoregressive/DeepSeek/DeepSeek-V4: num-steps=3/4 (low-latency), 1/2 (balanced), disabled at max-throughput" + pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/1145 + - config-keys: - dsr1-fp8-h100-dynamo-trt - dsr1-fp8-h100-dynamo-sglang