diff --git a/.github/configs/amd-master.yaml b/.github/configs/amd-master.yaml index 1faf3682b..3c6c7e815 100644 --- a/.github/configs/amd-master.yaml +++ b/.github/configs/amd-master.yaml @@ -1497,8 +1497,8 @@ dsr1-fp4-mi355x-sglang-disagg-mtp: - "DECODE_MTP_SIZE=1" dsv4-fp8-mi355x-sglang: - image: rocm/sgl-dev:deepseek-v4-mi35x - model: sgl-project/DeepSeek-V4-Pro-FP8 + image: rocm/sgl-dev:v0.5.10.post1-rocm700-mi35x-20260428 + model: deepseek-ai/DeepSeek-V4-Pro model-prefix: dsv4 runner: mi355x precision: fp8 @@ -1514,6 +1514,29 @@ dsv4-fp8-mi355x-sglang: search-space: - { tp: 8, conc-start: 4, conc-end: 64 } +# FP4-experts variant of dsv4-fp8-mi355x-sglang. Same image and sglang overlay +# (amd/deepseek_v4 branch pinned at runtime by dsv4_fp4_mi355x_sglang.sh); +# differs only in SGLANG_DSV4_FP4_EXPERTS=True / SGLANG_FORCE_TRITON_MOE_FP8=0 +# and uses the bf16 DeepSeek-V4-Pro checkpoint (FP4 quantization is applied +# at expert-runtime by sglang). +dsv4-fp4-mi355x-sglang: + image: rocm/sgl-dev:v0.5.10.post1-rocm700-mi35x-20260428 + model: deepseek-ai/DeepSeek-V4-Pro + model-prefix: dsv4 + runner: mi355x + precision: fp4 + framework: sglang + multinode: false + seq-len-configs: + - isl: 1024 + osl: 1024 + search-space: + - { tp: 8, conc-start: 4, conc-end: 64 } + - isl: 8192 + osl: 1024 + search-space: + - { tp: 8, conc-start: 4, conc-end: 64 } + # vLLM with AITER MLA decode for DSv4 on MI355X (vllm-project/vllm#40889, # stacked on #40871). Uses the ATOM MI355X image (ROCm 7.2.2, aiter with # MLA decode, MI355X GPU detection); vLLM is rebuilt from the PR branch diff --git a/benchmarks/single_node/dsv4_fp4_mi355x_sglang.sh b/benchmarks/single_node/dsv4_fp4_mi355x_sglang.sh new file mode 100755 index 000000000..e6ed57b5c --- /dev/null +++ b/benchmarks/single_node/dsv4_fp4_mi355x_sglang.sh @@ -0,0 +1,153 @@ +#!/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" + +# Overlay sglang from the amd/deepseek_v4 branch on top of whatever the +# rocm/sgl-dev:v0.5.10.post1-rocm700-mi35x-20260428 image ships with. We +# stay on the rocm700 (ROCm 7.0.0a) line because rocm720 hit +# hipErrorInvalidConfiguration on use_symmetric_memory-allocated dp_attention +# buffers (RCCL symmetric-memory bug; SGLANG_USE_ROCM700A WA only covers the +# cuda-graph path, not eager mode that we use via --disable-cuda-graph). +# Bump SGL_PR_SHA when the branch advances. +SGL_PR_SHA="18afbf151a2992b06a089191769b299629ed73dd" +SGL_PR_DIR="/tmp/sglang-amd-dsv4" + +if [ ! -d "$SGL_PR_DIR/.git" ]; then + git clone --filter=blob:none https://github.com/sgl-project/sglang.git "$SGL_PR_DIR" +fi +( + cd "$SGL_PR_DIR" + git fetch --depth=1 origin "$SGL_PR_SHA" 2>/dev/null \ + || git fetch --depth=1 origin amd/deepseek_v4 + git checkout --force "$SGL_PR_SHA" + test "$(git rev-parse HEAD)" = "$SGL_PR_SHA" + + # Reinstall just the Python package; the image already has the ROCm + # kernel deps (aiter, triton, tilelang, torch) at versions matched to + # this branch, so --no-deps avoids pip resolving them against PyPI. + pip install --no-build-isolation --no-deps --force-reinstall -e python/ +) + +python3 -c "import sglang; print(f'sglang {sglang.__version__} from {sglang.__path__[0]}')" + +# Transformers in the container doesn't recognize the `deepseek_v4` model_type. +# PR #23608's fallback in hf_transformers_utils.get_config tries to handle this +# by writing a patched config to /tmp, but in practice isn't catching the error +# in this image. Patch the cached config.json directly instead: set model_type +# to `deepseek_v3` so AutoConfig.from_pretrained succeeds, and keep +# architectures=['DeepseekV4ForCausalLM'] so SGLang dispatches to its native +# DSv4 model class (python/sglang/srt/models/deepseek_v4.py). +python3 << PYEOF +import json +from huggingface_hub import hf_hub_download +path = hf_hub_download(repo_id="$MODEL", filename="config.json") +with open(path) as f: + config = json.load(f) +if config.get("model_type") == "deepseek_v4": + config["model_type"] = "deepseek_v3" + with open(path, "w") as f: + json.dump(config, f, indent=2) + print(f"Patched {path}: model_type deepseek_v4 -> deepseek_v3") +else: + print(f"No patch needed: model_type is {config.get('model_type')!r}") +PYEOF + +# DSv4 FP4-experts path. Mirrors the active path of python/run_dsv4.sh on +# the amd/deepseek_v4 branch at SGL_PR_SHA: +# SGLANG_DSV4_FP4_EXPERTS=True -> route experts through the FP4 kernels +# SGLANG_FORCE_TRITON_MOE_FP8=0 -> dispatch MoE through aiter (gating +# switch added in commit 33de1e64); +# also enables swiglu_limit clamp in the +# triton MoE fallback path. +export SGLANG_REASONING_EFFORT=max +export SGLANG_OPT_USE_FUSED_COMPRESS=false +export SGLANG_OPT_USE_OLD_COMPRESSOR=true +export SGLANG_OPT_USE_TILELANG_SWA_PREPARE=false +export SGLANG_OPT_USE_JIT_KERNEL_FUSED_TOPK=false +export SGLANG_OPT_USE_FUSED_HASH_TOPK=false +export SGLANG_HACK_FLASHMLA_BACKEND=torch +export SGLANG_OPT_DEEPGEMM_HC_PRENORM=false +export SGLANG_OPT_USE_TILELANG_MHC_PRE=false +export SGLANG_OPT_USE_TILELANG_MHC_POST=false +export SGLANG_ENABLE_THINKING=1 +export SGLANG_USE_AITER=1 +export SGLANG_USE_ROCM700A=1 +export SGLANG_TOPK_TRANSFORM_512_TORCH=1 +export SGLANG_FP8_PAGED_MQA_LOGITS_TORCH=1 +export SGLANG_DSV4_FP4_EXPERTS=True +export SGLANG_OPT_DPSK_V4_RADIX=0 +export SGLANG_OPT_USE_OVERLAP_STORE_CACHE=false +export SGLANG_OPT_USE_FUSED_STORE_CACHE=false +export SGLANG_FORCE_TRITON_MOE_FP8=0 + +SERVER_LOG=/workspace/server.log +PORT=${PORT:-8888} + +EVAL_CONTEXT_ARGS="" +if [ "${EVAL_ONLY}" = "true" ]; then + setup_eval_context + EVAL_CONTEXT_ARGS="--context-length $EVAL_MAX_MODEL_LEN" +fi +# Start GPU monitoring (power, temperature, clocks every second) +start_gpu_monitor + +python3 -m sglang.launch_server \ + --model-path $MODEL \ + --host=0.0.0.0 \ + --port $PORT \ + --tensor-parallel-size $TP \ + --dp $TP \ + --enable-dp-attention \ + --trust-remote-code \ + --disable-radix-cache \ + --attention-backend compressed \ + --max-running-request 256 \ + --page-size 256 \ + --chunked-prefill-size 8192 \ + --disable-shared-experts-fusion \ + --disable-cuda-graph \ + --tool-call-parser deepseekv4 \ + --reasoning-parser deepseek-v4 \ + --watchdog-timeout 1800 $EVAL_CONTEXT_ARGS > $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" + +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/ + +# 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/benchmarks/single_node/dsv4_fp8_mi355x.sh b/benchmarks/single_node/dsv4_fp8_mi355x.sh index 971b18b6a..afb6d0fef 100755 --- a/benchmarks/single_node/dsv4_fp8_mi355x.sh +++ b/benchmarks/single_node/dsv4_fp8_mi355x.sh @@ -17,6 +17,34 @@ fi hf download "$MODEL" +# Overlay sglang from the amd/deepseek_v4 branch on top of whatever the +# rocm/sgl-dev:v0.5.10.post1-rocm700-mi35x-20260428 image ships with. We +# stay on the rocm700 (ROCm 7.0.0a) line because rocm720 hit +# hipErrorInvalidConfiguration on use_symmetric_memory-allocated dp_attention +# buffers (RCCL symmetric-memory bug; SGLANG_USE_ROCM700A WA only covers the +# cuda-graph path, not eager mode that we use via --disable-cuda-graph). +# Bump SGL_PR_SHA when the branch advances. +SGL_PR_SHA="18afbf151a2992b06a089191769b299629ed73dd" +SGL_PR_DIR="/tmp/sglang-amd-dsv4" + +if [ ! -d "$SGL_PR_DIR/.git" ]; then + git clone --filter=blob:none https://github.com/sgl-project/sglang.git "$SGL_PR_DIR" +fi +( + cd "$SGL_PR_DIR" + git fetch --depth=1 origin "$SGL_PR_SHA" 2>/dev/null \ + || git fetch --depth=1 origin amd/deepseek_v4 + git checkout --force "$SGL_PR_SHA" + test "$(git rev-parse HEAD)" = "$SGL_PR_SHA" + + # Reinstall just the Python package; the image already has the ROCm + # kernel deps (aiter, triton, tilelang, torch) at versions matched to + # this branch, so --no-deps avoids pip resolving them against PyPI. + pip install --no-build-isolation --no-deps --force-reinstall -e python/ +) + +python3 -c "import sglang; print(f'sglang {sglang.__version__} from {sglang.__path__[0]}')" + # Transformers in the container doesn't recognize the `deepseek_v4` model_type. # PR #23608's fallback in hf_transformers_utils.get_config tries to handle this # by writing a patched config to /tmp, but in practice isn't catching the error @@ -39,7 +67,12 @@ else: print(f"No patch needed: model_type is {config.get('model_type')!r}") PYEOF -# DSv4-specific SGLang env vars (from sgl-project/sglang#23608) +# DSv4-specific SGLang env vars. Mirrors python/run_dsv4.sh on the +# amd/deepseek_v4 branch (commented FP8 path) at SGL_PR_SHA. The branch's +# FP4 Models integration commit (33de1e64) flipped SGLANG_FORCE_TRITON_MOE_FP8 +# from 1 to 0; with it set to 0, FP8 MoE dispatches through aiter (shuffled +# weights + aiter fused_moe) instead of the triton MoE fallback. +export SGLANG_REASONING_EFFORT=max export SGLANG_OPT_USE_FUSED_COMPRESS=false export SGLANG_OPT_USE_OLD_COMPRESSOR=true export SGLANG_OPT_USE_TILELANG_SWA_PREPARE=false @@ -58,7 +91,7 @@ export SGLANG_DSV4_FP4_EXPERTS=false export SGLANG_OPT_DPSK_V4_RADIX=0 export SGLANG_OPT_USE_OVERLAP_STORE_CACHE=false export SGLANG_OPT_USE_FUSED_STORE_CACHE=false -export SGLANG_FORCE_TRITON_MOE_FP8=1 +export SGLANG_FORCE_TRITON_MOE_FP8=0 SERVER_LOG=/workspace/server.log PORT=${PORT:-8888} diff --git a/perf-changelog.yaml b/perf-changelog.yaml index 422d5347f..85bca5bd0 100644 --- a/perf-changelog.yaml +++ b/perf-changelog.yaml @@ -2006,3 +2006,15 @@ - "Change image to vllm/vllm-openai:v0.20.0-cu130" - "Use Mega MoE for DEP configs" pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/1221 + +- config-keys: + - dsv4-fp8-mi355x-sglang + - dsv4-fp4-mi355x-sglang + description: + - "Pin sglang at runtime to amd/deepseek_v4 branch SHA 18afbf15 via clone+reinstall in the benchmark scripts" + - "Bump dsv4-fp8-mi355x-sglang image to rocm/sgl-dev:v0.5.10.post1-rocm700-mi35x-20260428" + - "Switch dsv4-fp8-mi355x-sglang model from sgl-project/DeepSeek-V4-Pro-FP8 to deepseek-ai/DeepSeek-V4-Pro" + - "Set SGLANG_FORCE_TRITON_MOE_FP8=0 in dsv4_fp8_mi355x.sh so FP8 MoE dispatches through aiter (matches branch run_dsv4.sh after FP4 Models commit 33de1e64)" + - "Add SGLANG_REASONING_EFFORT=max to both scripts" + - "Add dsv4-fp4-mi355x-sglang variant: SGLANG_DSV4_FP4_EXPERTS=True, SGLANG_FORCE_TRITON_MOE_FP8=0, model deepseek-ai/DeepSeek-V4-Pro" + pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/1231