Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions benchmarks/single_node/agentic/dsv4_fp4_mi355x_atom_mtp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/env bash
set -euo pipefail
set -x

# Agentic trace replay benchmark for DeepSeek-V4-Pro FP4 on MI355X using ATOM.
#
# Serving flags follow the validated MI355X recipe from
# https://github.com/ROCm/ATOM/blob/main/recipes/DeepSeek-V4-Agentic-Benchmark.md
# Image is configured in amd-master.yaml.
#
# Required env vars:
# MODEL, TP, CONC, KV_OFFLOADING, TOTAL_CPU_DRAM_GB, RESULT_DIR
#
# KV_OFFLOADING=dram is not enabled.

source "$(dirname "$0")/../../benchmark_lib.sh"

check_env_vars MODEL TP CONC KV_OFFLOADING TOTAL_CPU_DRAM_GB RESULT_DIR DURATION EP_SIZE DP_ATTENTION

if [[ -n "${SLURM_JOB_ID:-}" ]]; then
echo "JOB $SLURM_JOB_ID running on ${SLURMD_NODENAME:-unknown}"
fi

# `hf download` creates the target dir if missing and is itself idempotent.
# When MODEL_PATH is unset (stand-alone runs), fall back to the HF_HUB_CACHE
# Either way, MODEL_PATH is what the server is launched with.
if [[ -n "${MODEL_PATH:-}" ]]; then
if [[ ! -d "$MODEL_PATH" || -z "$(ls -A "$MODEL_PATH" 2>/dev/null)" ]]; then
hf download "$MODEL" --local-dir "$MODEL_PATH"
fi
else
hf download "$MODEL"
export MODEL_PATH="$MODEL"
fi

if [ -n "${ROCR_VISIBLE_DEVICES:-}" ]; then
export HIP_VISIBLE_DEVICES="$ROCR_VISIBLE_DEVICES"
fi

# ---- Resolve traces and install deps ----------------------------------------
resolve_trace_source
install_agentic_deps

# Nightly ROCm image may be missing runtime deps; ensure they are present.
agentic_pip_install --quiet Pillow fastapi uvicorn

export AIPERF_HTTP_TCP_USER_TIMEOUT=900000

# DeepSeek-V4-Pro weights are large; engine startup can exceed default 600s.
export VLLM_ENGINE_READY_TIMEOUT_S=3600

# vllm-project/vllm#43447 keeps local SWA prefix-cache tails sparsely, while
# vllm-project/vllm#44774 applies the same reachability policy to Mooncake's
# store mask. 32k matches the trace-replay tuning validated for this workload.
export VLLM_PREFIX_CACHE_RETENTION_INTERVAL=32768

# VLLM_PREFIX_CACHE_RETENTION_INTERVAL only applies to sliding-window/Mamba
# models; this vLLM build raises ValueError if it is set for DSv4.

# ---- LLM server config ----------------------------------------------------------
SERVER_LOG="$RESULT_DIR/server.log"
VLLM_BACKEND_PORT="$PORT"
mkdir -p "$RESULT_DIR"

SERVER_PID=""
ROUTER_PID=""
MOONCAKE_MASTER_PID=""

PARALLEL_ARGS=(-tp "$TP")
SPEC_ARGS=(--method mtp --num-speculative-tokens 3 )
OFFLOAD_ARGS=()
if [ "$DP_ATTENTION" = "true" ]; then
PARALLEL_ARGS=(-tp "$TP" --enable-dp-attention)
fi
if [ "$EP_SIZE" -gt 1 ]; then
PARALLEL_ARGS+=(--enable-expert-parallel)
fi

# AgentX concurrency counts live session trees, not individual requests.
Comment on lines +68 to +79

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 The ATOM_CMD server launch omits --trust-remote-code, which every other DeepSeek-V4-Pro launch script in the repo (both sibling fixed_seq_len/dsv4_fp4_mi355x_atom_mtp.sh and dsv4_fp4_mi355x_atom.sh on the same atom.entrypoints.openai_server entrypoint, plus the agentic vLLM/SGLang/H200 DSv4 scripts) passes. DeepSeek-V4-Pro requires custom remote modeling code, so without this flag the ATOM server will fail to load the model/tokenizer at startup, causing wait_for_server_ready to time out and the entire recipe to fail.

Extended reasoning...

The bug: benchmarks/single_node/agentic/dsv4_fp4_mi355x_atom_mtp.sh builds ATOM_CMD (lines 68-79 in the diff, the python3 -m atom.entrypoints.openai_server ... array) without the --trust-remote-code flag. This is the exact command that gets exec'd to start the model server, and its readiness is polled by wait_for_server_ready a few lines later.

Why this breaks the recipe: DeepSeek-V4-Pro is a custom architecture that ships remote modeling/tokenizer code on the Hugging Face Hub. Loaders (transformers/AITER/ATOM) require trust_remote_code=True (surfaced here via the --trust-remote-code CLI flag) to load such checkpoints; omitting it causes the loader to refuse to proceed at startup rather than silently falling back. This isn't speculative — every other launch script in the repo serving the exact same model through the exact same entrypoint passes the flag:

  • benchmarks/single_node/fixed_seq_len/dsv4_fp4_mi355x_atom_mtp.sh (same atom.entrypoints.openai_server, same model, same --method mtp) — passes --trust-remote-code at line 49 (and again at line 74 in a second invocation).
  • benchmarks/single_node/fixed_seq_len/dsv4_fp4_mi355x_atom.sh — passes it at line 63 (and line 85).
  • The agentic vLLM, SGLang, and H200 DSv4-Pro launch scripts all pass their framework's equivalent flag as well.

I verified both fixed_seq_len sibling scripts directly and confirmed the flag is present at those exact lines, and it is conspicuously the only DSv4-Pro launch script in the repo missing it.

Why nothing else catches this: There's no schema/lint validation on these ATOM_CMD argument arrays, and set -euo pipefail only fails on non-zero exit of the foreground shell — the server is launched in the background ("${ATOM_CMD[@]}" > "$SERVER_LOG" 2>&1 &), so a crash-on-load failure surfaces only via wait_for_server_ready timing out after polling the port, not as an immediate script error. That makes the omission easy to introduce (e.g. by adapting a different framework's agentic launch script as a template) and easy to miss in review, since the script is otherwise syntactically valid and passes bash -n.

Step-by-step proof of impact:

  1. CI (or a manual run) invokes this script with MODEL=deepseek-ai/DeepSeek-V4-Pro.
  2. The script downloads the model, sets env vars, and builds ATOM_CMD without --trust-remote-code.
  3. "${ATOM_CMD[@]}" > "$SERVER_LOG" 2>&1 & launches the ATOM openai_server process in the background.
  4. Because DeepSeek-V4-Pro requires remote code execution to instantiate its model/tokenizer classes, the ATOM/transformers loader raises an error demanding trust_remote_code=True and the process exits, logging the failure to $SERVER_LOG.
  5. wait_for_server_ready --port "$VLLM_BACKEND_PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID" polls the port, finds it never opens (and/or detects the dead PID), and eventually times out/fails.
  6. The whole benchmark run for every entry in dsv4-fp4-mi355x-atom-agentic-mtp's search-space (all 7 concurrency levels in configs/amd-master.yaml) fails at the server-start step — no benchmark data is ever collected.

Fix: Add --trust-remote-code to the ATOM_CMD array, matching the sibling fixed_seq_len/dsv4_fp4_mi355x_atom_mtp.sh script, e.g. inserting it alongside --kv_cache_dtype fp8 or near --served-model-name "$MODEL".

# Subagent fan-out can push instantaneous request concurrency above CONC, so
# leave 2x headroom rather than clipping those bursts at the scheduler.
MAX_NUM_SEQS=$((2 * CONC))

echo "Starting atom server..."
set -x
export AITER_BF16_FP8_MOE_BOUND=0
export ATOM_MOE_GU_ITLV=1
export AITER_LOG_LEVEL=WARNING
export ATOM_DISABLE_MMAP=true
export MEM_FRAC_STATIC=0.9

{ set +x; } 2>/dev/null
ATOM_CMD=(
python3 -m atom.entrypoints.openai_server
--model "$MODEL_PATH"
--server-port "$VLLM_BACKEND_PORT"
"${PARALLEL_ARGS[@]}"
"${SPEC_ARGS[@]}"
--kv_cache_dtype fp8
--trust-remote-code
--enable_prefix_caching
--max-num-seqs "$MAX_NUM_SEQS"
--gpu-memory-utilization "$MEM_FRAC_STATIC"
"${OFFLOAD_ARGS[@]}"
)

printf '%q ' "${ATOM_CMD[@]}" | tee "$RESULT_DIR/atom_command.txt"
printf '\n' | tee -a "$RESULT_DIR/atom_command.txt"
"${ATOM_CMD[@]}" > "$SERVER_LOG" 2>&1 &
SERVER_PID=$!
echo "Server PID: $SERVER_PID"

wait_for_server_ready --port "$VLLM_BACKEND_PORT" --server-log "$SERVER_LOG" --server-pid "$SERVER_PID"

if [ "${EVAL_ONLY}" = "true" ]; then
run_eval --port "$PORT"
else
build_replay_cmd "$RESULT_DIR"
run_agentic_replay_and_write_outputs "$RESULT_DIR"
fi
14 changes: 14 additions & 0 deletions configs/amd-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1356,6 +1356,20 @@ dsv4-fp4-mi355x-atom-mtp:
search-space:
- { tp: 8, ep: 1, conc-start: 1, conc-end: 1024, spec-decoding: mtp }

dsv4-fp4-mi355x-atom-agentic-mtp:
image: rocm/atom-dev:nightly_202607211523
model: deepseek-ai/DeepSeek-V4-Pro
model-prefix: dsv4
runner: cluster:mi355x-amds
precision: fp4
framework: atom
multinode: false
scenarios:
agentic-coding:
- dram-utilization: 0.60
search-space:
Comment thread
claude[bot] marked this conversation as resolved.
Comment on lines +1359 to +1370

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 This PR's title and description (Summary/Test plan) are English-only, but AGENTS.md mandates that every PR title and body include a Simplified Chinese counterpart (title format <English title> / <中文标题>, plus a Chinese section like ## 中文说明 in the body). Recent merged PRs (#2314, #2343) follow this convention, so please add the Chinese title suffix and a mirroring Chinese section to the description before merge.

Extended reasoning...

AGENTS.md (linked from the repo's root CLAUDE.md) states verbatim: "PR and GitHub-issue titles & descriptions must be bilingual — include a Simplified Chinese version in addition to English. Title format: <English title> / <中文标题>. In the PR/issue body, follow the English content with its Chinese translation (e.g. a ## 中文说明 section) ... This applies to every PR and every issue." This is an explicit, repository-mandated convention rather than a subjective style preference, which is why it is being flagged here.

This PR's title, [AMD][AgentX] Add DeepSeek-V4-Pro FP4 MI355X ATOM + MTP agentic-coding recipe, has no trailing / <中文标题> segment, and the body contains only English ## Summary and ## Test plan sections with no ## 中文说明 (or equivalent) mirroring them. Both the title and the description are fully English-only.

The convention is not aspirational — it is actively followed in this repository's recent history. git log on this branch shows PR #2343 titled "...docs: add MODELS.md model & scenario support matrix / 新增 MODELS.md 模型与场景支持矩阵 (#2343)" and PR #2314 titled "Refresh MiniMax-M3 NVFP4 B300 8k1k disaggregated EAGLE Dynamo-vLLM / 刷新 MiniMax-M3 NVFP4 B300 8k1k 分离式 EAGLE Dynamo-vLLM 配置 (#2314)", both carrying the bilingual title format required by AGENTS.md. This confirms the convention is enforced in practice for merged PRs in this exact repo, not a stale or unused guideline.

Step-by-step proof:

  1. Open AGENTS.md at the repo root — line 7 defines the bilingual title/description requirement, applying to "every PR and every issue."
  2. Compare against this PR's actual title: [AMD][AgentX] Add DeepSeek-V4-Pro FP4 MI355X ATOM + MTP agentic-coding recipe" — no / <中文标题>` suffix is present.
  3. Compare against this PR's body: only ## Summary and ## Test plan sections exist, both English; no ## 中文说明 section mirrors the summary.
  4. Cross-check against recently merged sibling PRs (Refresh MiniMax-M3 NVFP4 B300 8k1k disaggregated EAGLE Dynamo-vLLM / 刷新 MiniMax-M3 NVFP4 B300 8k1k 分离式 EAGLE Dynamo-vLLM 配置 #2314, [Klaud Cold] docs: add MODELS.md model & scenario support matrix / 新增 MODELS.md 模型与场景支持矩阵 #2343) in git log — both include the bilingual title suffix, confirming the convention is actively enforced rather than aspirational or abandoned.
  5. Conclusion: this PR's title and description do not comply with the mandated bilingual format.

Fix: Rename the PR title to append a Chinese translation (e.g. [AMD][AgentX] Add DeepSeek-V4-Pro FP4 MI355X ATOM + MTP agentic-coding recipe / 新增 DeepSeek-V4-Pro FP4 MI355X ATOM + MTP agentic-coding 配方), and add a ## 中文说明 section to the PR body mirroring the English Summary/Test plan content.

This is a metadata/process issue only — it does not affect the benchmark config, the launch script, or CI behavior, so it should not block merge on its own, but it should be corrected to keep the repository's PR history consistent with its own documented convention.

- { tp: 8, ep: 1, dp-attn: false, kv-offloading: none, conc-list: [1, 2, 4, 8, 16, 32, 48], spec-decoding: mtp }

qwen3.5-bf16-mi325x-sglang-mtp:
image: lmsysorg/sglang:v0.5.12-rocm720-mi30x
model: Qwen/Qwen3.5-397B-A17B
Expand Down
7 changes: 7 additions & 0 deletions perf-changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5085,3 +5085,10 @@
description:
- "Bump SGLang container image from lmsysorg/sglang:v0.5.12-cu130 to lmsysorg/sglang:v0.5.15.post1-cu130 (https://github.com/sgl-project/sglang/releases/tag/v0.5.15.post1)"
pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/2313

- config-keys:
- dsv4-fp4-mi355x-atom-agentic-mtp
description:
- "Add DeepSeek-V4-Pro FP4 MI355X ATOM agentic-coding MTP benchmark serving via the ATOM openai_server entrypoint with speculative decoding (--method mtp --num-speculative-tokens 3), following the ROCm ATOM DeepSeek-V4-Agentic recipe (https://github.com/ROCm/ATOM/blob/main/recipes/DeepSeek-V4-Agentic-Benchmark.md)"
- "Register the dsv4-fp4-mi355x-atom-agentic-mtp config in configs/amd-master.yaml on rocm/atom-dev:nightly_202607211523 (TP8/EP1, conc list [1,2,4,8,16,32,48], spec-decoding mtp, no KV offload)"
pr-link: https://github.com/SemiAnalysisAI/InferenceX/pull/2346
Loading