Skip to content

Commit d9fb027

Browse files
authored
[CI] Add benchmark workflows (#1014)
### What this PR does / why we need it? Add benchmark workflows ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Run locally --------- Signed-off-by: wangli <wangli858794774@gmail.com>
1 parent 5a1689f commit d9fb027

File tree

5 files changed

+217
-31
lines changed

5 files changed

+217
-31
lines changed
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
#
2+
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
3+
# This file is a part of the vllm-ascend project.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
name: 'run benchmarks main'
19+
20+
on:
21+
schedule:
22+
- cron: '00 16 * * *'
23+
workflow_dispatch:
24+
25+
# after merged, secrets will be available
26+
# pull_request:
27+
# branches:
28+
# - 'main'
29+
# - '*-dev'
30+
# paths:
31+
# - '.github/workflows/nightly_benchmarks.yaml'
32+
33+
34+
# Bash shells do not use ~/.profile or ~/.bashrc so these shells need to be explicitly
35+
# declared as "shell: bash -el {0}" on steps that need to be properly activated.
36+
# It's used to activate ascend-toolkit environment variables.
37+
defaults:
38+
run:
39+
shell: bash -el {0}
40+
41+
jobs:
42+
test:
43+
name: run benchmarks main
44+
runs-on: 'linux-arm64-npu-static-8'
45+
strategy:
46+
matrix:
47+
include:
48+
- vllm_branch: v0.9.0
49+
vllm_ascend_branch: main
50+
container:
51+
image: m.daocloud.io/quay.io/ascend/cann:8.1.rc1-910b-ubuntu22.04-py3.10
52+
volumes:
53+
- /usr/local/dcmi:/usr/local/dcmi
54+
- /usr/local/bin/npu-smi:/usr/local/bin/npu-smi
55+
- /usr/local/Ascend/driver/:/usr/local/Ascend/driver/
56+
# Use self-host cache speed up pip and model download
57+
- /home/action/.cache:/github/home/.cache/
58+
options: >-
59+
--device /dev/davinci0
60+
--device /dev/davinci1
61+
--device /dev/davinci_manager
62+
--device /dev/devmm_svm
63+
--device /dev/hisi_hdc
64+
env:
65+
HF_ENDPOINT: https://hf-mirror.com
66+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
67+
ES_OM_DOMAIN: ${{ secrets.ES_OM_DOMAIN }}
68+
ES_OM_AUTHORIZATION: ${{ secrets.ES_OM_AUTHORIZATION }}
69+
steps:
70+
- name: Check npu and CANN info
71+
run: |
72+
npu-smi info
73+
cat /usr/local/Ascend/ascend-toolkit/latest/"$(uname -i)"-linux/ascend_toolkit_install.info
74+
75+
- name: Config mirrors
76+
run: |
77+
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
78+
79+
- name: Install system dependencies
80+
run: |
81+
apt-get update -y
82+
apt-get -y install git jq wget curl lsof gcc g++ cmake libnuma-dev
83+
84+
- name: Config git
85+
run: |
86+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
87+
git config --global url."https://gh-proxy.test.osinfra.cn/https://github.com/".insteadOf https://github.com/
88+
89+
90+
- name: Checkout vllm-project/vllm-ascend repo
91+
uses: actions/checkout@v4
92+
with:
93+
ref: ${{ matrix.vllm_ascend_branch }}
94+
95+
- name: Checkout vllm-project/vllm repo
96+
uses: actions/checkout@v4
97+
with:
98+
repository: vllm-project/vllm
99+
path: ./vllm-empty
100+
ref: ${{ matrix.vllm_branch }}
101+
102+
- name: Install vllm-project/vllm from source
103+
working-directory: ./vllm-empty
104+
run: |
105+
VLLM_TARGET_DEVICE=empty pip install -e .
106+
107+
- name: Install vllm-project/vllm-ascend
108+
run: |
109+
pip install -e .
110+
pip install -r benchmarks/requirements-bench.txt
111+
112+
- name: Checkout cosdt/elastic-tool
113+
uses: actions/checkout@v4
114+
with:
115+
repository: cosdt/elastic-tool
116+
path: ./elastic_tool
117+
ref: 0.1.0-dev
118+
119+
- name: Install elastic_tool
120+
working-directory: ./elastic_tool
121+
run: |
122+
pip install -e .
123+
124+
- name: Collect pr info from vllm-project/vllm-ascend
125+
run: |
126+
# Only get the pull request which may influences performance
127+
git log --pretty=format:"%H %s" -- '**/*.py' ':!docs/*' ':!tests/*' ':!examples/*' > commit_log.txt
128+
escli check commit_log.txt
129+
130+
- name: Run benchmark iteration
131+
run: |
132+
while IFS= read -r line || [[ -n "$line" ]]; do
133+
commit_id=${line%% *}
134+
commit_title=${line#* }
135+
commit_time=$(git show -s --format=%cd $commit_hash --date=iso-strict)
136+
commit_time_no_tz=${commit_time::19}
137+
138+
git checkout $commit_id
139+
pip install -e .
140+
141+
echo "------------------------"
142+
echo "commit_id: $commit_id"
143+
echo "commit_title: $commit_title"
144+
echo "commit_time: $commit_time_no_tz"
145+
echo "vllm branch: ${{ matrix.vllm_branch }}"
146+
echo "vllm-ascend branch: ${{ matrix.vllm_ascend_branch }}"
147+
echo "------------------------"
148+
149+
bash benchmarks/scripts/run-performance-benchmarks.sh
150+
# send the result to es
151+
if [[ "${{ github.event_name }}" != "pull request" ]]; then
152+
escli add --vllm_branch ${{ matrix.vllm_branch }} \
153+
--vllm_ascend_branch ${{ matrix.vllm_ascend_branch }} \
154+
--commit_id $commit_id \
155+
--commit_title "$commit_title" \
156+
--created_at "$commit_time_no_tz" \
157+
--res_dir ./benchmarks/results
158+
rm -rf ./benchmarks/results
159+
fi
160+
done < commit_log.txt

benchmarks/scripts/run-performance-benchmarks.sh

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22

3+
set -e
34

45
check_npus() {
56
# shellcheck disable=SC2155
@@ -48,7 +49,7 @@ wait_for_server() {
4849
# wait for vllm server to start
4950
# return 1 if vllm server crashes
5051
timeout 1200 bash -c '
51-
until curl -X POST localhost:8000/v1/completions; do
52+
until curl -s -X POST localhost:8000/v1/completions || curl -s -X POST localhost:8000/v1/chat/completions; do
5253
sleep 1
5354
done' && return 0 || return 1
5455
}
@@ -67,6 +68,16 @@ kill_npu_processes() {
6768

6869
}
6970

71+
update_json_field() {
72+
local json_file="$1"
73+
local field_name="$2"
74+
local field_value="$3"
75+
76+
jq --arg value "$field_value" \
77+
--arg key "$field_name" \
78+
'.[$key] = $value' "$json_file" > "${json_file}.tmp" && \
79+
mv "${json_file}.tmp" "$json_file"
80+
}
7081

7182
run_latency_tests() {
7283
# run latency tests using `benchmark_latency.py`
@@ -103,7 +114,9 @@ run_latency_tests() {
103114

104115
# run the benchmark
105116
eval "$latency_command"
106-
117+
# echo model_name to result file
118+
model_name=$(echo "$latency_params" | jq -r '.model')
119+
update_json_field "$RESULTS_FOLDER/${test_name}.json" "model_name" "$model_name"
107120
kill_npu_processes
108121

109122
done
@@ -144,7 +157,9 @@ run_throughput_tests() {
144157

145158
# run the benchmark
146159
eval "$throughput_command"
147-
160+
# echo model_name to result file
161+
model_name=$(echo "$throughput_params" | jq -r '.model')
162+
update_json_field "$RESULTS_FOLDER/${test_name}.json" "model_name" "$model_name"
148163
kill_npu_processes
149164

150165
done
@@ -242,8 +257,13 @@ cleanup() {
242257
rm -rf ./vllm_benchmarks
243258
}
244259

260+
cleanup_on_error() {
261+
echo "An error occurred. Cleaning up results folder..."
262+
rm -rf $RESULTS_FOLDER
263+
}
264+
245265
get_benchmarks_scripts() {
246-
git clone -b main --depth=1 git@github.com:vllm-project/vllm.git && \
266+
git clone -b main --depth=1 https://github.com/vllm-project/vllm.git && \
247267
mv vllm/benchmarks vllm_benchmarks
248268
rm -rf ./vllm
249269
}
@@ -263,9 +283,8 @@ main() {
263283
export VLLM_HOST_IP=$(hostname -I | awk '{print $1}')
264284
# turn of the reporting of the status of each request, to clean up the terminal output
265285
export VLLM_LOG_LEVEL="WARNING"
266-
286+
267287
# set env
268-
export VLLM_USE_MODELSCOPE="True"
269288
export HF_ENDPOINT="https://hf-mirror.com"
270289

271290
# prepare for benchmarking
@@ -278,6 +297,7 @@ main() {
278297
declare -g RESULTS_FOLDER=results
279298
mkdir -p $RESULTS_FOLDER
280299

300+
trap cleanup_on_error ERR
281301
ensure_sharegpt_downloaded
282302
# benchmarks
283303
run_serving_tests $QUICK_BENCHMARK_ROOT/tests/serving-tests.json

benchmarks/tests/latency-tests.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
[
22
{
3-
"test_name": "latency_llama8B_tp1",
3+
"test_name": "latency_qwen2_5vl_7B_tp1",
44
"parameters": {
5-
"model": "LLM-Research/Meta-Llama-3.1-8B-Instruct",
5+
"model": "Qwen/Qwen2.5-VL-7B-Instruct",
66
"tensor_parallel_size": 1,
7-
"load_format": "dummy",
7+
"max_model_len": 16384,
88
"num_iters_warmup": 5,
99
"num_iters": 15
1010
}
1111
},
1212
{
13-
"test_name": "latency_qwen2_5_7B_tp1",
13+
"test_name": "latency_qwen3_8B_tp1",
1414
"parameters": {
15-
"model": "Qwen/Qwen2.5-7B-Instruct",
15+
"model": "Qwen/Qwen3-8B",
1616
"tensor_parallel_size": 1,
1717
"load_format": "dummy",
18+
"max_model_len": 16384,
1819
"num_iters_warmup": 5,
1920
"num_iters": 15
2021
}

benchmarks/tests/serving-tests.json

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,52 @@
11
[
22
{
3-
"test_name": "serving_llama8B_tp1",
3+
"test_name": "serving_qwen2_5vl_7B_tp1",
44
"qps_list": [
55
1,
66
4,
77
16,
88
"inf"
99
],
1010
"server_parameters": {
11-
"model": "LLM-Research/Meta-Llama-3.1-8B-Instruct",
11+
"model": "Qwen/Qwen2.5-VL-7B-Instruct",
1212
"tensor_parallel_size": 1,
1313
"swap_space": 16,
1414
"disable_log_stats": "",
1515
"disable_log_requests": "",
16-
"load_format": "dummy"
16+
"trust_remote_code": "",
17+
"max_model_len": 16384
1718
},
1819
"client_parameters": {
19-
"model": "LLM-Research/Meta-Llama-3.1-8B-Instruct",
20-
"backend": "vllm",
21-
"dataset_name": "sharegpt",
22-
"dataset_path": "./ShareGPT_V3_unfiltered_cleaned_split.json",
20+
"model": "Qwen/Qwen2.5-VL-7B-Instruct",
21+
"backend": "openai-chat",
22+
"dataset_name": "hf",
23+
"hf_split": "train",
24+
"endpoint": "/v1/chat/completions",
25+
"dataset_path": "lmarena-ai/vision-arena-bench-v0.1",
2326
"num_prompts": 200
2427
}
2528
},
2629
{
27-
"test_name": "serving_qwen2_5_7B_tp1",
30+
"test_name": "serving_qwen3_8B_tp1",
2831
"qps_list": [
2932
1,
3033
4,
3134
16,
3235
"inf"
3336
],
3437
"server_parameters": {
35-
"model": "Qwen/Qwen2.5-7B-Instruct",
38+
"model": "Qwen/Qwen3-8B",
3639
"tensor_parallel_size": 1,
3740
"swap_space": 16,
3841
"disable_log_stats": "",
3942
"disable_log_requests": "",
4043
"load_format": "dummy"
4144
},
4245
"client_parameters": {
43-
"model": "Qwen/Qwen2.5-7B-Instruct",
46+
"model": "Qwen/Qwen3-8B",
4447
"backend": "vllm",
4548
"dataset_name": "sharegpt",
46-
"dataset_path": "./ShareGPT_V3_unfiltered_cleaned_split.json",
49+
"dataset_path": "/root/.cache/datasets/sharegpt/ShareGPT_V3_unfiltered_cleaned_split.json",
4750
"num_prompts": 200
4851
}
4952
}

benchmarks/tests/throughput-tests.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
[
22
{
3-
"test_name": "throughput_llama8B_tp1",
3+
"test_name": "throughput_qwen3_8B_tp1",
44
"parameters": {
5-
"model": "LLM-Research/Meta-Llama-3.1-8B-Instruct",
5+
"model": "Qwen/Qwen3-8B",
66
"tensor_parallel_size": 1,
77
"load_format": "dummy",
8-
"dataset_path": "./ShareGPT_V3_unfiltered_cleaned_split.json",
8+
"dataset_path": "/root/.cache/datasets/sharegpt/ShareGPT_V3_unfiltered_cleaned_split.json",
99
"num_prompts": 200,
1010
"backend": "vllm"
1111
}
1212
},
1313
{
14-
"test_name": "throughput_qwen2_5_7B_tp1",
14+
"test_name": "throughput_qwen2_5vl_7B_tp1",
1515
"parameters": {
16-
"model": "Qwen/Qwen2.5-7B-Instruct",
16+
"model": "Qwen/Qwen2.5-VL-7B-Instruct",
1717
"tensor_parallel_size": 1,
18-
"load_format": "dummy",
19-
"dataset_path": "./ShareGPT_V3_unfiltered_cleaned_split.json",
20-
"num_prompts": 200,
21-
"backend": "vllm"
18+
"backend": "vllm-chat",
19+
"dataset_name": "hf",
20+
"hf_split": "train",
21+
"max_model_len": 16384,
22+
"dataset_path": "lmarena-ai/vision-arena-bench-v0.1",
23+
"num_prompts": 200
2224
}
2325
}
2426
]

0 commit comments

Comments
 (0)