|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -eo pipefail |
| 3 | + |
| 4 | +# DeepSeek-V4-Pro FP8 single-node on MI325X (gfx942) via vLLM, MTP variant. |
| 5 | +# |
| 6 | +# MTP sibling of dsv4_fp8_mi325x.sh: adds --speculative-config |
| 7 | +# '{"method":"mtp","num_speculative_tokens":2}' (DeepSeek-V4 built-in MTP) |
| 8 | +# and --dsv4 chat-template encoding for run_benchmark_serving. |
| 9 | +# |
| 10 | +# EXTRAPOLATED bring-up recipe. The sglang path was abandoned: on gfx942 |
| 11 | +# (no native FP4) the dsv4 sglang backend's nvfp4 MoE / TileLang-MLA kernels |
| 12 | +# have no gfx942 equivalents (they exist only for gfx950/MI355X). vLLM instead |
| 13 | +# runs the checkpoint in FP8 via --quantization deepseek_v4_fp8, which |
| 14 | +# dequantizes the FP4 MoE experts to FP8 — the same path the H200 dsv4 vLLM |
| 15 | +# recipe uses (H200 is also a no-FP4 SKU). Derived from: |
| 16 | +# * same model + framework + AMD family: dsv4_fp4_mi355x_vllm.sh (ROCm vLLM |
| 17 | +# dsv4 structure: AITER MoE, deepseek_v4 tokenizer/parser, mp executor, |
| 18 | +# FULL_AND_PIECEWISE compile) |
| 19 | +# * same model, FP8 path: dsv4_fp8_h200.sh (--quantization deepseek_v4_fp8) |
| 20 | +# * same SKU, different model: minimaxm3_fp8_mi325x.sh (gfx942 vLLM/AITER) |
| 21 | +# |
| 22 | +# The FP4->FP8 dequant roughly doubles the MoE footprint (~1.05 TB total), |
| 23 | +# which fits 8x256 GB comfortably at TP8, so the sweep is TP8-only. |
| 24 | +# |
| 25 | +# MoE backend is left at auto (NOT --moe-backend aiter) — see dsv4_fp8_mi300x.sh: |
| 26 | +# on gfx942, forcing aiter selects AITER_MXFP4_MXFP4 (W4A4 native-mxfp4) which |
| 27 | +# the gfx942 kernel rejects; auto's ROCm+DeepseekV4 path prefers |
| 28 | +# AITER_MXFP4_BF16 (W4A16, dequant) with a TRITON_UNFUSED fallback. |
| 29 | + |
| 30 | +source "$(dirname "$0")/../../benchmark_lib.sh" |
| 31 | + |
| 32 | +check_env_vars \ |
| 33 | + MODEL \ |
| 34 | + TP \ |
| 35 | + DP_ATTENTION \ |
| 36 | + CONC \ |
| 37 | + ISL \ |
| 38 | + OSL \ |
| 39 | + MAX_MODEL_LEN \ |
| 40 | + RANDOM_RANGE_RATIO \ |
| 41 | + RESULT_FILENAME |
| 42 | + |
| 43 | +if [[ -n "$SLURM_JOB_ID" ]]; then |
| 44 | + echo "JOB $SLURM_JOB_ID running on $SLURMD_NODENAME" |
| 45 | +fi |
| 46 | + |
| 47 | +if [[ "$MODEL" != /* ]]; then hf download "$MODEL"; fi |
| 48 | + |
| 49 | +if [ -n "$ROCR_VISIBLE_DEVICES" ]; then |
| 50 | + export HIP_VISIBLE_DEVICES="$ROCR_VISIBLE_DEVICES" |
| 51 | +fi |
| 52 | + |
| 53 | +export VLLM_ROCM_USE_AITER=1 |
| 54 | +export VLLM_ROCM_USE_AITER_MOE=1 |
| 55 | + |
| 56 | +# gsm8k eval at high concurrency (8k1k) OOM-kills the server: hundreds of |
| 57 | +# concurrent 9472-token requests exceed the ~20x KV budget even on 256GB MI325X |
| 58 | +# (c128 fit, so this was originally left at the default, but c512 crashed the |
| 59 | +# EngineCore mid-eval). Cap the eval to a safe in-flight count; only run_eval is |
| 60 | +# affected (throughput jobs use CONC directly). Matches the MI300X script. |
| 61 | +export EVAL_CONCURRENT_REQUESTS=8 |
| 62 | + |
| 63 | +SERVER_LOG=/workspace/server.log |
| 64 | + |
| 65 | +if [ "${EVAL_ONLY}" = "true" ]; then |
| 66 | + setup_eval_context |
| 67 | + MAX_MODEL_LEN="$EVAL_MAX_MODEL_LEN" |
| 68 | +fi |
| 69 | + |
| 70 | +start_gpu_monitor |
| 71 | + |
| 72 | +PARALLEL_ARGS=(--tensor-parallel-size "$TP" --data-parallel-size 1) |
| 73 | +if [ "${DP_ATTENTION}" = "true" ]; then |
| 74 | + PARALLEL_ARGS=(--tensor-parallel-size 1 --data-parallel-size "$TP") |
| 75 | +fi |
| 76 | + |
| 77 | +EP_ARGS=() |
| 78 | +if [ "${EP_SIZE:-1}" -gt 1 ]; then |
| 79 | + EP_ARGS=(--enable-expert-parallel) |
| 80 | +fi |
| 81 | + |
| 82 | +# Use 2 speculative tokens (matches dsv4_fp4_mi355x_vllm_mtp.sh). |
| 83 | +NUM_SPEC_TOKENS=2 |
| 84 | + |
| 85 | +set -x |
| 86 | +vllm serve $MODEL --port $PORT \ |
| 87 | + "${PARALLEL_ARGS[@]}" \ |
| 88 | + "${EP_ARGS[@]}" \ |
| 89 | + --quantization deepseek_v4_fp8 \ |
| 90 | + --async-scheduling \ |
| 91 | + --no-enable-prefix-caching \ |
| 92 | + --distributed-executor-backend mp \ |
| 93 | + --gpu-memory-utilization 0.9 \ |
| 94 | + --max-model-len "$MAX_MODEL_LEN" \ |
| 95 | + --kv-cache-dtype fp8 \ |
| 96 | + --trust-remote-code \ |
| 97 | + --tokenizer-mode deepseek_v4 \ |
| 98 | + --reasoning-parser deepseek_v4 \ |
| 99 | + --speculative-config "{\"method\": \"mtp\", \"num_speculative_tokens\": $NUM_SPEC_TOKENS}" \ |
| 100 | + --compilation-config '{"mode":3,"cudagraph_mode":"FULL_AND_PIECEWISE"}' > $SERVER_LOG 2>&1 & |
| 101 | + |
| 102 | +SERVER_PID=$! |
| 103 | + |
| 104 | +wait_for_server_ready --port "$PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID" |
| 105 | + |
| 106 | +run_benchmark_serving \ |
| 107 | + --model "$MODEL" \ |
| 108 | + --port "$PORT" \ |
| 109 | + --backend vllm \ |
| 110 | + --input-len "$ISL" \ |
| 111 | + --output-len "$OSL" \ |
| 112 | + --random-range-ratio "$RANDOM_RANGE_RATIO" \ |
| 113 | + --num-prompts "$((CONC * 10))" \ |
| 114 | + --max-concurrency "$CONC" \ |
| 115 | + --result-filename "$RESULT_FILENAME" \ |
| 116 | + --result-dir /workspace/ \ |
| 117 | + --trust-remote-code \ |
| 118 | + --dsv4 |
| 119 | + |
| 120 | +if [ "${RUN_EVAL}" = "true" ]; then |
| 121 | + run_eval --framework lm-eval --port "$PORT" |
| 122 | + append_lm_eval_summary |
| 123 | +fi |
| 124 | + |
| 125 | +stop_gpu_monitor |
| 126 | +set +x |
0 commit comments