From f25176b855aad86e38ac06442f2a5d2b8e4da21f Mon Sep 17 00:00:00 2001 From: TomPettyFlacko <267776105+hstolte11-collab@users.noreply.github.com> Date: Wed, 2 Sep 2026 18:41:16 -0500 Subject: [PATCH 1/3] feat(benchmark): add Radeon 8060S gfx1151 runners --- Magpie/modes/benchmark/benchmarker.py | 7 +- .../scripts/benchmark/sglang_radeon8060s.sh | 168 +++++++++++++++++ Magpie/scripts/benchmark/vllm_radeon8060s.sh | 177 ++++++++++++++++++ docs/how-to/benchmarking/benchmark.md | 2 +- docs/reference/compatibility-matrix.md | 3 + tests/test_eval_concurrency_scripts.py | 86 +++++++++ 6 files changed, 440 insertions(+), 3 deletions(-) create mode 100755 Magpie/scripts/benchmark/sglang_radeon8060s.sh create mode 100755 Magpie/scripts/benchmark/vllm_radeon8060s.sh diff --git a/Magpie/modes/benchmark/benchmarker.py b/Magpie/modes/benchmark/benchmarker.py index f4a32de..79638ca 100644 --- a/Magpie/modes/benchmark/benchmarker.py +++ b/Magpie/modes/benchmark/benchmarker.py @@ -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", } @@ -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." ) diff --git a/Magpie/scripts/benchmark/sglang_radeon8060s.sh b/Magpie/scripts/benchmark/sglang_radeon8060s.sh new file mode 100755 index 0000000..6a28509 --- /dev/null +++ b/Magpie/scripts/benchmark/sglang_radeon8060s.sh @@ -0,0 +1,168 @@ +#!/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 + +# Radeon 8060S / RDNA 3.5: pin native gfx1151 without architecture spoofing. +if [[ -n "${PYTORCH_ROCM_ARCH:-}" && "$PYTORCH_ROCM_ARCH" != "gfx1151" ]]; then + echo "ERROR: sglang_radeon8060s requires PYTORCH_ROCM_ARCH=gfx1151." >&2 + exit 2 +fi +export PYTORCH_ROCM_ARCH=gfx1151 +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 diff --git a/Magpie/scripts/benchmark/vllm_radeon8060s.sh b/Magpie/scripts/benchmark/vllm_radeon8060s.sh new file mode 100755 index 0000000..379bc7a --- /dev/null +++ b/Magpie/scripts/benchmark/vllm_radeon8060s.sh @@ -0,0 +1,177 @@ +#!/usr/bin/env bash +############################################################################### +# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved. +# +# See LICENSE for license information. +############################################################################### + +# Magpie Generic vLLM Benchmark Script for Radeon 8060S / gfx1151 +# +# Phases (via MAGPIE_RUN_PHASE): all | server | client (default all). +# Server-only writes PID to MAGPIE_SERVER_PID_FILE then disowns and exits. +# +# Remote server (BENCHMARK_BASE_URL): when set, the client phase points +# benchmark_serving at an external vLLM-compatible HTTP endpoint +# instead of localhost:$PORT, and forces PHASE=client (no local server +# launch). See vllm_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 "[vllm_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 + +MAX_MODEL_LEN=${MAX_MODEL_LEN:-4096} +GPU_MEMORY_UTILIZATION=${GPU_MEMORY_UTILIZATION:-0.95} +for numeric in TP CONC ISL OSL MAX_MODEL_LEN 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 [[ "$MODEL" == -* ]]; then + echo "ERROR: MODEL cannot begin with '-'." >&2 + exit 2 +fi + +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 + +# Radeon 8060S / RDNA 3.5: pin native gfx1151 without architecture spoofing. +if [[ -n "${PYTORCH_ROCM_ARCH:-}" && "$PYTORCH_ROCM_ARCH" != "gfx1151" ]]; then + echo "ERROR: vllm_radeon8060s requires PYTORCH_ROCM_ARCH=gfx1151." >&2 + exit 2 +fi +export PYTORCH_ROCM_ARCH=gfx1151 +export HSA_ENABLE_SDMA=${HSA_ENABLE_SDMA:-0} +unset HSA_OVERRIDE_GFX_VERSION + +# ROCR_VISIBLE_DEVICES already re-indexes visible GPUs to 0..N-1, so HIP +# must use the logical range, not the original physical ids. +if [ -n "$ROCR_VISIBLE_DEVICES" ] && [ -z "$HIP_VISIBLE_DEVICES" ]; then + n=$(echo "$ROCR_VISIBLE_DEVICES" | awk -F, '{print NF}') + export HIP_VISIBLE_DEVICES=$(seq -s, 0 $((n-1))) +fi + +# AITER attention is not qualified for the tested gfx1151 geometry. +export VLLM_ROCM_USE_AITER=0 +export VLLM_ROCM_USE_AITER_MHA=0 +export VLLM_ROCM_USE_AITER_RMSNORM=0 +unset VLLM_USE_AITER + +WORKSPACE_DIR=${RESULT_DIR:-/workspace} +SERVER_LOG=${SERVER_LOG:-$WORKSPACE_DIR/server.log} +PORT=${PORT:-8888} + +# Build profiler args for vLLM >= 0.15 (env var VLLM_TORCH_PROFILER_DIR is deprecated) +PROFILER_ARGS=() +if [[ "${PROFILE:-}" == "1" ]]; then + TRACE_DIR="${VLLM_TORCH_PROFILER_DIR:-$WORKSPACE_DIR/torch_trace}" + mkdir -p "$TRACE_DIR" + PROFILER_ARGS+=(--profiler-config.profiler torch) + PROFILER_ARGS+=(--profiler-config.torch_profiler_dir "$TRACE_DIR") + PROFILER_ARGS+=(--profiler-config.torch_profiler_record_shapes True) + PROFILER_ARGS+=(--profiler-config.torch_profiler_with_memory True) + PROFILER_ARGS+=(--profiler-config.torch_profiler_with_flops True) + PROFILER_ARGS+=(--profiler-config.torch_profiler_use_gzip True) +fi + +read -r -a EXTRA_VLLM_ARGV <<< "${EXTRA_VLLM_ARGS:-}" + +set -x +if [[ "$PHASE" == "server" || "$PHASE" == "all" ]]; then + SERVER_CMD=( + vllm serve "$MODEL" + --port "$PORT" + --tensor-parallel-size "$TP" + --gpu-memory-utilization "$GPU_MEMORY_UTILIZATION" + --max-model-len "$MAX_MODEL_LEN" + --trust-remote-code + ) + SERVER_CMD+=("${PROFILER_ARGS[@]}") + SERVER_CMD+=("${EXTRA_VLLM_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 trust || exit $? + else + 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" \ + --result-dir "$WORKSPACE_DIR/" \ + "${SERVER_MONITOR_ARGS[@]}" \ + --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 "[vllm_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 diff --git a/docs/how-to/benchmarking/benchmark.md b/docs/how-to/benchmarking/benchmark.md index 499de8b..d849194 100644 --- a/docs/how-to/benchmarking/benchmark.md +++ b/docs/how-to/benchmarking/benchmark.md @@ -11,7 +11,7 @@ Magpie's benchmark mode runs end-to-end performance tests against LLM inference TraceLens is an AMD tool for visualizing profiler traces; it installs automatically on first use, but can also be installed manually—see [TraceLens installation](../../reference/troubleshooting.md#benchmarking-mode) if the auto-install fails. -Magpie uses [InferenceX](https://github.com/SemiAnalysisAI/InferenceX) as its benchmarking backend; InferenceX is a collection of benchmark scripts for LLM inference frameworks and is cloned automatically on first run. Use this mode to measure inference performance on AMD Instinct™ GPUs and identify the GPU kernels that dominate runtime. +Magpie uses [InferenceX](https://github.com/SemiAnalysisAI/InferenceX) as its benchmarking backend; InferenceX is a collection of benchmark scripts for LLM inference frameworks and is cloned automatically on first run. Use this mode to measure inference performance on AMD Instinct™ GPUs or the Radeon 8060S (`gfx1151`) and identify the GPU kernels that dominate runtime. Review these topics for more information: diff --git a/docs/reference/compatibility-matrix.md b/docs/reference/compatibility-matrix.md index a20dfcd..cdfc5c2 100644 --- a/docs/reference/compatibility-matrix.md +++ b/docs/reference/compatibility-matrix.md @@ -14,11 +14,14 @@ tested. | GPU | ROCm | Python | Ubuntu | PyYAML | NumPy | MCP | | -------------------------------- | ------------------------------------ | --------- | ------------ | ------ | --------- | -------- | | MI300X,
MI325X,
MI355X | 7.0.x,
7.1.x,
7.2.x,
10.0.0 | 3.10–3.13 | 22.04, 24.04 | >= 6.0 | >= 1.24.0 | >= 1.0.0 | +| Radeon 8060S (`gfx1151`, bounded vLLM/SGLang runner qualification) | 10.0.0 | 3.14 | 24.04 | >= 6.0 | >= 1.24.0 | >= 1.0.0 | - GPUs are verified using the bundled benchmark scripts in `Magpie/scripts/benchmark/`. - Python versions are declared in `pyproject.toml`; the minimum is 3.10. - MCP (`mcp`) is required only for the MCP server. - IntelliKit integrations are optional (pinned commit `2f61453a779980b00504ea3b772ff4a1a1c3f4ad`). +- The Radeon 8060S row records bounded runner/serving/evaluation qualification only, not every profiler or precision route. +- The Radeon 8060S SGLang route is qualified with Triton attention, CUDA graphs disabled, and AITER disabled. The vLLM route also pins AITER off. ## Profilers and optional tools diff --git a/tests/test_eval_concurrency_scripts.py b/tests/test_eval_concurrency_scripts.py index 3c4dbd0..8989704 100644 --- a/tests/test_eval_concurrency_scripts.py +++ b/tests/test_eval_concurrency_scripts.py @@ -1,5 +1,6 @@ import json import os +import shutil import subprocess from pathlib import Path @@ -11,8 +12,10 @@ "atom_mi355x.sh", "sglang_mi300x.sh", "sglang_mi355x.sh", + "sglang_radeon8060s.sh", "vllm_mi300x.sh", "vllm_mi355x.sh", + "vllm_radeon8060s.sh", ] CONCURRENCY_EXPORT = ( 'export EVAL_CONCURRENT_REQUESTS="${MAGPIE_EVAL_CONCURRENCY:-' @@ -20,6 +23,89 @@ ) +def test_radeon_scripts_are_registered_for_server_lifecycle(): + from Magpie.modes.benchmark.benchmarker import MAGPIE_BUILTIN_SCRIPTS + + assert {"vllm_radeon8060s.sh", "sglang_radeon8060s.sh"}.issubset(MAGPIE_BUILTIN_SCRIPTS) + + +def test_radeon_scripts_pin_the_qualified_attention_routes(): + scripts = ROOT / "Magpie" / "scripts" / "benchmark" + vllm = (scripts / "vllm_radeon8060s.sh").read_text(encoding="utf-8") + sglang = (scripts / "sglang_radeon8060s.sh").read_text(encoding="utf-8") + + for contents in (vllm, sglang): + assert "export PYTORCH_ROCM_ARCH=gfx1151" in contents + assert "unset HSA_OVERRIDE_GFX_VERSION" in contents + assert "export VLLM_ROCM_USE_AITER=0" in vllm + assert '"--attention-backend=triton"' in sglang + assert '"--disable-cuda-graph"' in sglang + assert "export HYPERLOOM_GFX1151_LOWBIT_BRIDGE=0" in sglang + + +def _run_radeon_client(tmp_path: Path, script_name: str, **overrides: str) -> subprocess.CompletedProcess[str]: + source = ROOT / "Magpie" / "scripts" / "benchmark" / script_name + script = tmp_path / script_name + shutil.copy2(source, script) + (tmp_path / "benchmark_lib.sh").write_text( + "check_env_vars() { :; }\n" + "run_benchmark_serving() { printf 'ARCH=%s VLLM_AITER=%s SGLANG_AITER=%s BRIDGE=%s\\n' " + '"${PYTORCH_ROCM_ARCH:-}" "${VLLM_ROCM_USE_AITER:-}" "${SGLANG_USE_AITER:-}" ' + '"${HYPERLOOM_GFX1151_LOWBIT_BRIDGE:-}"; }\n', + encoding="utf-8", + ) + (tmp_path / "server_cleanup.sh").write_text("magpie_stop_benchmark_server_stack() { :; }\n", encoding="utf-8") + (tmp_path / "magpie_bench_remote_compat.sh").write_text("", encoding="utf-8") + env = { + **os.environ, + "MAGPIE_RUN_PHASE": "client", + "MODEL": "test-model", + "TP": "1", + "CONC": "1", + "ISL": "64", + "OSL": "16", + "RANDOM_RANGE_RATIO": "1.0", + "RESULT_FILENAME": "result", + "RESULT_DIR": str(tmp_path), + "RUN_EVAL": "false", + "BENCHMARK_BASE_URL": "", + "EXTRA_VLLM_ARGS": "", + "EXTRA_SGLANG_ARGS": "", + "SLURM_JOB_ID": "", + **overrides, + } + return subprocess.run(["bash", str(script)], env=env, capture_output=True, text=True, check=False) + + +def test_radeon_clients_force_qualified_environment(tmp_path: Path): + vllm = _run_radeon_client(tmp_path, "vllm_radeon8060s.sh", VLLM_ROCM_USE_AITER="1") + assert vllm.returncode == 0, vllm.stderr + assert "ARCH=gfx1151 VLLM_AITER=0" in vllm.stdout + + sglang = _run_radeon_client( + tmp_path, + "sglang_radeon8060s.sh", + SGLANG_USE_AITER="1", + HYPERLOOM_GFX1151_LOWBIT_BRIDGE="1", + ) + assert sglang.returncode == 0, sglang.stderr + assert "ARCH=gfx1151 VLLM_AITER= SGLANG_AITER=0 BRIDGE=0" in sglang.stdout + + +def test_radeon_clients_reject_wrong_arch_and_conflicting_attention(tmp_path: Path): + wrong_arch = _run_radeon_client(tmp_path, "vllm_radeon8060s.sh", PYTORCH_ROCM_ARCH="gfx950") + assert wrong_arch.returncode == 2 + assert "requires PYTORCH_ROCM_ARCH=gfx1151" in wrong_arch.stderr + + conflict = _run_radeon_client( + tmp_path, + "sglang_radeon8060s.sh", + EXTRA_SGLANG_ARGS="--attention-backend aiter", + ) + assert conflict.returncode == 2 + assert "conflicting arg '--attention-backend'" in conflict.stderr + + @pytest.mark.parametrize("script_name", LOCAL_EVAL_SCRIPTS) def test_local_eval_scripts_use_environment_for_concurrency(script_name: str): script = ROOT / "Magpie" / "scripts" / "benchmark" / script_name From 25681df93ba21a1a6b0bdd4151884f42eead1063 Mon Sep 17 00:00:00 2001 From: TomPettyFlacko <267776105+hstolte11-collab@users.noreply.github.com> Date: Fri, 4 Sep 2026 00:28:35 -0500 Subject: [PATCH 2/3] fix(benchmark): select the radeon8060s runner for gfx1151 f25176b added vllm_radeon8060s.sh / sglang_radeon8060s.sh but ImageSelector.get_runner_type() still only mapped gfx942/gfx950/gfx1100 and raised "No runner type found for gfx1151", so a detected Strix Halo never reached those scripts. Map gfx1151 -> radeon8060s. Tests: parametrized runner mapping extended; new tests/test_gfx1151_runner_selection.py proves arch -> runner -> built-in script (both frameworks, MAGPIE_RUN_PHASE honoured). Full suite 407 passed. --- Magpie/modes/benchmark/image_selector.py | 1 + tests/test_benchmark_unit_coverage.py | 1 + tests/test_gfx1151_runner_selection.py | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 tests/test_gfx1151_runner_selection.py diff --git a/Magpie/modes/benchmark/image_selector.py b/Magpie/modes/benchmark/image_selector.py index 8e0fceb..2932b0d 100644 --- a/Magpie/modes/benchmark/image_selector.py +++ b/Magpie/modes/benchmark/image_selector.py @@ -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 diff --git a/tests/test_benchmark_unit_coverage.py b/tests/test_benchmark_unit_coverage.py index 601750a..aac898b 100644 --- a/tests/test_benchmark_unit_coverage.py +++ b/tests/test_benchmark_unit_coverage.py @@ -238,6 +238,7 @@ def test_image_selector_loads_mapping_and_selects_images(tmp_path, monkeypatch): ("gfx942", "mi300x"), ("gfx950", "mi355x"), ("gfx1100", "mi325x"), + ("gfx1151", "radeon8060s"), ("sm_80", "a100"), ("sm_90", "h100"), ("sm_90a", "h200"), diff --git a/tests/test_gfx1151_runner_selection.py b/tests/test_gfx1151_runner_selection.py new file mode 100644 index 0000000..84c2c77 --- /dev/null +++ b/tests/test_gfx1151_runner_selection.py @@ -0,0 +1,20 @@ +"""gfx1151 (Radeon 8060S) is selected end to end, not only shipped as scripts.""" + +from pathlib import Path + +from Magpie.modes.benchmark.image_selector import ImageSelector + +SCRIPTS = Path(__file__).resolve().parents[1] / "Magpie" / "scripts" / "benchmark" + + +def test_gfx1151_maps_to_radeon8060s_runner(tmp_path): + selector = ImageSelector(str(tmp_path / "missing.yaml")) + assert selector.get_runner_type("gfx1151") == "radeon8060s" + + +def test_radeon8060s_runner_has_a_builtin_script_for_each_framework(): + for framework in ("vllm", "sglang"): + script = SCRIPTS / f"{framework}_radeon8060s.sh" + assert script.is_file(), script + text = script.read_text() + assert "MAGPIE_RUN_PHASE" in text, "runner must honour the server/client split like the MI scripts" From ebcbed02f8717848a9ba3adc93f3177b63f9152b Mon Sep 17 00:00:00 2001 From: TomPettyFlacko <267776105+hstolte11-collab@users.noreply.github.com> Date: Wed, 9 Sep 2026 17:00:03 -0500 Subject: [PATCH 3/3] [verified] fix(benchmark): support multi-arch gfx1151 images Map the published ROCm vLLM image for Radeon 8060S and preserve semicolon-delimited build architecture lists in both Radeon runners. Document custom SGLang image requirements and distinguish original qualification from collaborator results. Tests: 470 passed; 63 new container compatibility cases. Coverage 90.06%. Shell syntax, Ruff, CLI smoke, and independent review passed. Existing tests byte-preserved; no new GPU benchmark claimed. --- Magpie/benchmark_images.yaml | 5 +- .../scripts/benchmark/sglang_radeon8060s.sh | 12 +- Magpie/scripts/benchmark/vllm_radeon8060s.sh | 12 +- docs/how-to/benchmarking/benchmark.md | 16 +++ docs/reference/compatibility-matrix.md | 3 +- tests/test_gfx1151_container_compatibility.py | 117 ++++++++++++++++++ 6 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 tests/test_gfx1151_container_compatibility.py diff --git a/Magpie/benchmark_images.yaml b/Magpie/benchmark_images.yaml index 46720ff..fe495f8 100644 --- a/Magpie/benchmark_images.yaml +++ b/Magpie/benchmark_images.yaml @@ -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: @@ -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" diff --git a/Magpie/scripts/benchmark/sglang_radeon8060s.sh b/Magpie/scripts/benchmark/sglang_radeon8060s.sh index 6a28509..c84c7eb 100755 --- a/Magpie/scripts/benchmark/sglang_radeon8060s.sh +++ b/Magpie/scripts/benchmark/sglang_radeon8060s.sh @@ -55,12 +55,16 @@ if [[ "$PHASE" != "client" ]]; then hf download "$MODEL" 2>/dev/null || true fi -# Radeon 8060S / RDNA 3.5: pin native gfx1151 without architecture spoofing. -if [[ -n "${PYTORCH_ROCM_ARCH:-}" && "$PYTORCH_ROCM_ARCH" != "gfx1151" ]]; then - echo "ERROR: sglang_radeon8060s requires PYTORCH_ROCM_ARCH=gfx1151." >&2 +# 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 -export PYTORCH_ROCM_ARCH=gfx1151 +# 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 diff --git a/Magpie/scripts/benchmark/vllm_radeon8060s.sh b/Magpie/scripts/benchmark/vllm_radeon8060s.sh index 379bc7a..e89caeb 100755 --- a/Magpie/scripts/benchmark/vllm_radeon8060s.sh +++ b/Magpie/scripts/benchmark/vllm_radeon8060s.sh @@ -62,12 +62,16 @@ if [[ "$PHASE" != "client" ]]; then hf download "$MODEL" 2>/dev/null || true fi -# Radeon 8060S / RDNA 3.5: pin native gfx1151 without architecture spoofing. -if [[ -n "${PYTORCH_ROCM_ARCH:-}" && "$PYTORCH_ROCM_ARCH" != "gfx1151" ]]; then - echo "ERROR: vllm_radeon8060s requires PYTORCH_ROCM_ARCH=gfx1151." >&2 +# 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: vllm_radeon8060s requires PYTORCH_ROCM_ARCH=gfx1151 or a semicolon-separated list containing gfx1151." >&2 exit 2 fi -export PYTORCH_ROCM_ARCH=gfx1151 +# 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 diff --git a/docs/how-to/benchmarking/benchmark.md b/docs/how-to/benchmarking/benchmark.md index d849194..dce9a0f 100644 --- a/docs/how-to/benchmarking/benchmark.md +++ b/docs/how-to/benchmarking/benchmark.md @@ -62,6 +62,22 @@ python -m Magpie benchmark --benchmark-config examples/benchmarks/benchmark_sgla python -m Magpie benchmark vllm --model deepseek-ai/DeepSeek-R1-0528 --torch-profiler ``` +### Radeon 8060S / Strix Halo images + +For `gfx1151`, vLLM automatically selects `vllm/vllm-openai-rocm:v0.23.0` +and the `vllm_radeon8060s.sh` runner. Both Radeon runners accept a +semicolon-separated `PYTORCH_ROCM_ARCH` list containing `gfx1151` without +rewriting it. This variable describes build targets, not runtime GPU dispatch; +the runners continue to unset `HSA_OVERRIDE_GFX_VERSION`. + +SGLang has no default upstream `gfx1151` image in `benchmark_images.yaml`. +Supply a compatible custom image with `--docker-image` (or `docker_image` in +the benchmark YAML), or use `run_mode: local` with a qualified installation. +The `sglang_radeon8060s.sh` runner uses Triton attention with CUDA graphs +disabled and AITER disabled; the MI30x/MI35x image mappings are not a gfx1151 fallback. +See the [compatibility matrix](../../reference/compatibility-matrix.md) for +the scope of the original custom-build qualification. + ## Output structure A successful benchmark run creates a timestamped workspace directory with the following layout. diff --git a/docs/reference/compatibility-matrix.md b/docs/reference/compatibility-matrix.md index cdfc5c2..7a035fe 100644 --- a/docs/reference/compatibility-matrix.md +++ b/docs/reference/compatibility-matrix.md @@ -20,7 +20,8 @@ tested. - Python versions are declared in `pyproject.toml`; the minimum is 3.10. - MCP (`mcp`) is required only for the MCP server. - IntelliKit integrations are optional (pinned commit `2f61453a779980b00504ea3b772ff4a1a1c3f4ad`). -- The Radeon 8060S row records bounded runner/serving/evaluation qualification only, not every profiler or precision route. +- The Radeon 8060S row records bounded runner/serving/evaluation qualification of custom ROCm 10 builds (vLLM `0.27.0+hyperloom.gfx1151.rocm10`, SGLang `0.5.15`), not every profiler or precision route. It does not describe the software versions in the default published vLLM image. +- The default gfx1151 vLLM image is `vllm/vllm-openai-rocm:v0.23.0`, separately [tested on a Radeon 8060S by a collaborator](https://github.com/AMD-AGI/Magpie/pull/90#issuecomment-5600409716). SGLang requires an explicit compatible custom image or local installation; no default upstream gfx1151 image is mapped. - The Radeon 8060S SGLang route is qualified with Triton attention, CUDA graphs disabled, and AITER disabled. The vLLM route also pins AITER off. ## Profilers and optional tools diff --git a/tests/test_gfx1151_container_compatibility.py b/tests/test_gfx1151_container_compatibility.py new file mode 100644 index 0000000..f130b7b --- /dev/null +++ b/tests/test_gfx1151_container_compatibility.py @@ -0,0 +1,117 @@ +"""Container metadata must not exclude a multi-architecture gfx1151 build.""" + +import shutil +import subprocess +from pathlib import Path + +import pytest + +from Magpie.modes.benchmark.image_selector import ImageSelector + +SCRIPTS = Path(__file__).resolve().parents[1] / "Magpie" / "scripts" / "benchmark" +PUBLISHED_ARCHES = ( + "gfx90a;gfx942;gfx950;gfx1100;gfx1101;gfx1200;gfx1201;gfx1150;gfx1151" +) + + +@pytest.fixture(params=("vllm", "sglang")) +def runner(tmp_path, request): + """Run the real shell script with CPU-only serving/benchmark boundaries.""" + framework = request.param + script = tmp_path / f"{framework}_radeon8060s.sh" + shutil.copy2(SCRIPTS / script.name, script) + (tmp_path / "benchmark_lib.sh").write_text( + 'check_env_vars() { for name in "$@"; do ' + '[[ -n "${!name}" ]] || return 2; done; }\n' + 'wait_for_server_ready() { wait "${@: -1}"; }\n' + "run_benchmark_serving() { " + "printf 'CLIENT_ARCH=%s\\n' \"${PYTORCH_ROCM_ARCH:-}\"; }\n", + encoding="utf-8", + ) + (tmp_path / "server_cleanup.sh").write_text( + "magpie_stop_benchmark_server_stack() { :; }\n", encoding="utf-8" + ) + (tmp_path / "magpie_bench_remote_compat.sh").write_text("", encoding="utf-8") + bindir = tmp_path / "bin" + bindir.mkdir() + for name in ("vllm", "python3", "hf"): + command = bindir / name + command.write_text( + "#!/bin/bash\nprintf 'SERVER_ARCH=%s\\n' \"${PYTORCH_ROCM_ARCH:-}\"\n", + encoding="utf-8", + ) + command.chmod(0o755) + + def run(phase, arch): + # Deliberately do not inherit caller architecture, remote URL, or args. + env = { + "PATH": f"{bindir}:/usr/bin:/bin", + "MAGPIE_RUN_PHASE": phase, + "MAGPIE_SERVER_PID_FILE": str(tmp_path / "server.pid"), + "MODEL": "test-model", + "TP": "1", + "CONC": "1", + "ISL": "64", + "OSL": "16", + "RANDOM_RANGE_RATIO": "1.0", + "RESULT_FILENAME": "result", + "RESULT_DIR": str(tmp_path), + "RUN_EVAL": "false", + } + if arch is not None: + env["PYTORCH_ROCM_ARCH"] = arch + result = subprocess.run( + ["bash", str(script)], + env=env, + capture_output=True, + text=True, + timeout=10, + check=False, + ) + log = tmp_path / "server.log" + return result, log.read_text(encoding="utf-8") if log.exists() else "" + + return run + + +@pytest.mark.parametrize("phase", ("server", "client", "all")) +@pytest.mark.parametrize( + "arch", + (None, "", "gfx1151", PUBLISHED_ARCHES, "gfx1151;gfx950", "gfx950;gfx1151;gfx942"), +) +def test_runner_accepts_and_preserves_gfx1151_build_lists(runner, phase, arch): + result, log = runner(phase, arch) + assert result.returncode == 0, result.stderr + expected_arch = arch or "gfx1151" + if phase in ("server", "all"): + assert f"SERVER_ARCH={expected_arch}\n" in log + if phase in ("client", "all"): + assert f"CLIENT_ARCH={expected_arch}\n" in result.stdout + + +@pytest.mark.parametrize("phase", ("server", "client", "all")) +@pytest.mark.parametrize("arch", ("gfx950", "gfx11510", "notgfx1151", "gfx950;gfx942")) +def test_runner_rejects_build_lists_without_exact_gfx1151_entry(runner, phase, arch): + result, log = runner(phase, arch) + assert result.returncode == 2, result.stderr + assert "requires PYTORCH_ROCM_ARCH=gfx1151" in result.stderr + assert "SERVER_ARCH=" not in log + assert "CLIENT_ARCH=" not in result.stdout + + +def test_default_vllm_image_supports_gfx1151(): + selector = ImageSelector() + assert selector.select_image("vllm", "gfx1151") == "vllm/vllm-openai-rocm:v0.23.0" + assert selector.get_runner_type("gfx1151") == "radeon8060s" + + +def test_sglang_gfx1151_requires_explicit_image(): + with pytest.raises(ValueError, match="use --docker-image to override"): + ImageSelector().select_image("sglang", "gfx1151") + + +def test_sglang_gfx1151_accepts_explicit_image(): + image = "example/sglang-gfx1151:test" + assert ( + ImageSelector().select_image("sglang", "gfx1151", override_image=image) == image + )