Repository navigation
Add gfx11 (RDNA3/RDNA3.5) benchmark runner support #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| #!/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 AMD gfx11 (RDNA3 / RDNA3.5) | ||
| # | ||
| # 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) forces PHASE=client; 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_gfx11] 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.7} | ||
|
|
||
| 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 | ||
|
|
||
| # 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 ships kernels for gfx942/gfx950 only. | ||
| export VLLM_ROCM_USE_AITER=${VLLM_ROCM_USE_AITER:-0} | ||
|
|
||
| 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 | ||
|
|
||
| set -x | ||
| if [[ "$PHASE" == "server" || "$PHASE" == "all" ]]; then | ||
| setsid vllm serve $MODEL --port $PORT \ | ||
| --tensor-parallel-size=$TP \ | ||
| --gpu-memory-utilization "$GPU_MEMORY_UTILIZATION" \ | ||
| --max-model-len $MAX_MODEL_LEN \ | ||
| --trust-remote-code \ | ||
| "${PROFILER_ARGS[@]}" \ | ||
| $EXTRA_VLLM_ARGS > $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 | ||
|
|
||
| # After throughput, run evaluation only if RUN_EVAL is true | ||
| 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_gfx11] 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.