Skip to content
Merged
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
5 changes: 4 additions & 1 deletion Magpie/benchmark_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Format: framework -> gpu_arch -> docker_image
#
# GPU Architecture Identifiers:
# AMD: gfx942 (MI300X), gfx950 (MI355X)
# AMD: gfx942 (MI300X), gfx950 (MI355X), gfx1151 (Radeon 8060S)
# NVIDIA: sm_80 (A100), sm_90 (H100/H200), sm_100 (B200)
#
# Usage:
Expand All @@ -13,12 +13,15 @@ vllm:
# AMD GPUs
gfx942: "vllm/vllm-openai-rocm:v0.23.0"
gfx950: "vllm/vllm-openai-rocm:v0.23.0"
gfx1151: "vllm/vllm-openai-rocm:v0.23.0"
# NVIDIA GPUs
sm_80: "vllm/vllm-openai:v0.23.0"
sm_90: "vllm/vllm-openai:v0.23.0"
sm_100: "vllm/vllm-openai:v0.23.0"

sglang:
# No default upstream gfx1151 image is qualified here. Use --docker-image
# with a gfx1151-compatible build; do not fall back to an MI30x/MI35x image.
# AMD GPUs
gfx942: "lmsysorg/sglang:v0.5.12-rocm720-mi30x"
gfx950: "lmsysorg/sglang:v0.5.12-rocm720-mi35x"
Expand Down
7 changes: 5 additions & 2 deletions Magpie/modes/benchmark/benchmarker.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@
{
"vllm_mi300x.sh",
"vllm_mi355x.sh",
"vllm_radeon8060s.sh",
"sglang_mi300x.sh",
"sglang_mi355x.sh",
"sglang_radeon8060s.sh",
"atom_mi300x.sh",
"atom_mi355x.sh",
}
Expand Down Expand Up @@ -832,8 +834,9 @@ def _execute_local_benchmark_with_reuse(
result.success = False
result.errors.append(
"server_lifecycle requires a Magpie built-in InferenceX benchmark "
"script (vllm_mi300x.sh, vllm_mi355x.sh, sglang_mi300x.sh, "
"sglang_mi355x.sh, atom_mi300x.sh, atom_mi355x.sh). Current "
"script (vllm_mi300x.sh, vllm_mi355x.sh, vllm_radeon8060s.sh, "
"sglang_mi300x.sh, sglang_mi355x.sh, sglang_radeon8060s.sh, "
"atom_mi300x.sh, atom_mi355x.sh). Current "
f"resolved script={script_name}. Set benchmark_script accordingly "
"or omit server_lifecycle."
)
Expand Down
1 change: 1 addition & 0 deletions Magpie/modes/benchmark/image_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def get_runner_type(self, gpu_arch: Optional[str] = None) -> str:
"gfx942": "mi300x", # MI300X
"gfx950": "mi355x", # MI355X
"gfx1100": "mi325x", # MI325X
"gfx1151": "radeon8060s", # Radeon 8060S (Strix Halo APU, RDNA 3.5)
# NVIDIA GPUs
"sm_80": "a100", # A100
"sm_90": "h100", # H100
Expand Down
172 changes: 172 additions & 0 deletions Magpie/scripts/benchmark/sglang_radeon8060s.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
#!/usr/bin/env bash
###############################################################################
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
#
# See LICENSE for license information.
###############################################################################
#
# Magpie Generic SGLang Benchmark Script for Radeon 8060S / gfx1151
#
# Phases (via MAGPIE_RUN_PHASE): all | server | client (default all).
#
# Remote server (BENCHMARK_BASE_URL): when set, the client phase points
# benchmark_serving at an external SGLang-compatible HTTP endpoint
# instead of localhost:$PORT, and forces PHASE=client (no local server
# launch). See sglang_mi300x.sh for the full contract.

source "$(dirname "$0")/benchmark_lib.sh"
source "$(dirname "$0")/server_cleanup.sh"
# shellcheck source=magpie_bench_remote_compat.sh
source "$(dirname "$0")/magpie_bench_remote_compat.sh"

PHASE="${MAGPIE_RUN_PHASE:-all}"
case "$PHASE" in
all|server|client) ;;
*) echo "ERROR: Invalid MAGPIE_RUN_PHASE='$PHASE'. Must be all|server|client." >&2; exit 2 ;;
esac

if [[ -n "${BENCHMARK_BASE_URL:-}" ]]; then
if [[ "$PHASE" != "client" ]]; then
echo "[sglang_radeon8060s] BENCHMARK_BASE_URL set; forcing PHASE=client (was $PHASE)"
PHASE=client
fi
fi

if [[ "$PHASE" == "server" || "$PHASE" == "all" ]]; then
check_env_vars MODEL TP
fi
if [[ "$PHASE" == "client" || "$PHASE" == "all" ]]; then
check_env_vars MODEL CONC ISL OSL RANDOM_RANGE_RATIO RESULT_FILENAME
fi

for numeric in TP CONC ISL OSL PORT; do
value=${!numeric:-}
if [[ -n "$value" && ! "$value" =~ ^[0-9]+$ ]]; then
echo "ERROR: $numeric must be an unsigned integer, got '$value'." >&2
exit 2
fi
done

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

if [[ "$PHASE" != "client" ]]; then
hf download "$MODEL" 2>/dev/null || true
fi

# PYTORCH_ROCM_ARCH is build metadata, not a runtime GPU selector. Published
# ROCm images may list multiple targets; preserve a list containing gfx1151.
if [[ -n "${PYTORCH_ROCM_ARCH:-}" && ";$PYTORCH_ROCM_ARCH;" != *";gfx1151;"* ]]; then
echo "ERROR: sglang_radeon8060s requires PYTORCH_ROCM_ARCH=gfx1151 or a semicolon-separated list containing gfx1151." >&2
exit 2
fi
# Retain the default build hint when absent; this does not change kernel dispatch.
if [[ -z "${PYTORCH_ROCM_ARCH:-}" ]]; then
export PYTORCH_ROCM_ARCH=gfx1151
fi
export HSA_ENABLE_SDMA=${HSA_ENABLE_SDMA:-0}
unset HSA_OVERRIDE_GFX_VERSION

# The qualified gfx1151 route uses Triton attention. Current AITER CK prefill
# does not compile for this geometry and AITER paged decode device-asserts.
export SGLANG_USE_AITER=0
unset SGLANG_AITER_MLA_PERSIST
export HYPERLOOM_GFX1151_LOWBIT_BRIDGE=0

WORKSPACE_DIR=${RESULT_DIR:-/workspace}
SERVER_LOG=${SERVER_LOG:-$WORKSPACE_DIR/server.log}
PORT=${PORT:-8888}

if [[ "${PROFILE:-}" == "1" ]]; then
TRACE_DIR="${SGLANG_TORCH_PROFILER_DIR:-$WORKSPACE_DIR/torch_trace}"
mkdir -p "$TRACE_DIR"
export SGLANG_TORCH_PROFILER_DIR="$TRACE_DIR"
fi

# Pin the physically qualified route. Reject rather than silently override it.
DEFAULT_ARGS=("--mem-fraction-static=0.5" "--disable-radix-cache" "--attention-backend=triton" "--disable-cuda-graph")
read -r -a EXTRA_SGLANG_ARGV <<< "${EXTRA_SGLANG_ARGS:-}"
for arg in "${EXTRA_SGLANG_ARGV[@]}"; do
case "$arg" in
--attention-backend|--attention-backend=*|--prefill-attention-backend|--prefill-attention-backend=*|--decode-attention-backend|--decode-attention-backend=*|--disable-cuda-graph|--enable-cuda-graph*)
echo "ERROR: sglang_radeon8060s pins Triton attention with CUDA graphs disabled; conflicting arg '$arg'." >&2
exit 2
;;
esac
done

set -x
if [[ "$PHASE" == "server" || "$PHASE" == "all" ]]; then
SERVER_CMD=(
python3 -m sglang.launch_server
--model-path "$MODEL"
--host 0.0.0.0
--port "$PORT"
--trust-remote-code
--tensor-parallel-size "$TP"
)
SERVER_CMD+=("${DEFAULT_ARGS[@]}")
SERVER_CMD+=("${EXTRA_SGLANG_ARGV[@]}")
setsid "${SERVER_CMD[@]}" > "$SERVER_LOG" 2>&1 &

SERVER_PID=$!
if [[ "$PHASE" == "all" ]]; then
trap 'magpie_stop_benchmark_server_stack "$SERVER_PID"' EXIT INT TERM
fi

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

if [[ "$PHASE" == "server" ]]; then
if [[ -z "${MAGPIE_SERVER_PID_FILE:-}" ]]; then
echo "ERROR: MAGPIE_SERVER_PID_FILE must be set for MAGPIE_RUN_PHASE=server" >&2
kill -TERM "-$SERVER_PID" 2>/dev/null || true
exit 3
fi
printf '%s\n' "$SERVER_PID" > "$MAGPIE_SERVER_PID_FILE"
disown "$SERVER_PID" 2>/dev/null || true
exit 0
fi
fi

SERVER_MONITOR_ARGS=()
if [[ -n "${SERVER_PID:-}" ]]; then
SERVER_MONITOR_ARGS+=(--server-pid "$SERVER_PID")
fi

if [[ "$PHASE" == "client" || "$PHASE" == "all" ]]; then
if [[ -n "${BENCHMARK_BASE_URL:-}" ]]; then
SERVER_MONITOR_ARGS=()
magpie_run_benchmark_serving_remote_direct || exit $?
else
# InferenceX names its OpenAI-compatible completions client "vllm";
# SGLang serves that protocol, and this is the physically qualified path.
run_benchmark_serving \
--model "$MODEL" \
--port "$PORT" \
--backend vllm \
--input-len "$ISL" \
--output-len "$OSL" \
--random-range-ratio "$RANDOM_RANGE_RATIO" \
--num-prompts ${NUM_PROMPTS:-$(( $CONC * 10 ))} \
--max-concurrency "$CONC" \
--result-filename "$RESULT_FILENAME" \
"${SERVER_MONITOR_ARGS[@]}" \
--result-dir ${RESULT_DIR:-/workspace/} \
--trust-remote-code || exit $?
fi
fi

if [[ "$PHASE" != "server" && "${RUN_EVAL}" = "true" ]]; then
if [[ -n "${BENCHMARK_BASE_URL:-}" ]]; then
if declare -F magpie_run_eval_remote_direct &>/dev/null; then
magpie_run_eval_remote_direct || exit $?
else
echo "[sglang_radeon8060s] RUN_EVAL=true with BENCHMARK_BASE_URL but magpie_run_eval_remote_direct shim not available; skipping eval (results gate will see accuracy=None)."
fi
else
export EVAL_CONCURRENT_REQUESTS="${MAGPIE_EVAL_CONCURRENCY:-${EVAL_CONCURRENT_REQUESTS:-$CONC}}"
magpie_run_eval_persisted --framework lm-eval --port "$PORT" || exit $?
fi
fi
set +x
Loading