Skip to content

Commit 77bb42c

Browse files
authored
Add t.compile performance test to jenkins (vllm-project#998)
It adds performance benchmark to jenkins to early catch regression for torch.compile. One benchmark run produce to results (2 separate testcases). One compares throughput against given threshold, second warmup time
1 parent 6003eeb commit 77bb42c

File tree

2 files changed

+113
-2
lines changed

2 files changed

+113
-2
lines changed

.jenkins/benchmark/run-benchmark.sh

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/bash
2+
3+
model=/mnt/weka/data/pytorch/llama3.1/Meta-Llama-3.1-8B
4+
model_short=$(basename $model)
5+
#replace all '.' with '-'
6+
model_short=${model_short//./-}
7+
log_file=$(mktemp /tmp/_benchmark_${model_short}_XXXXXXX.log)
8+
9+
# Generate an empty result file.
10+
# This way in case of any crash it will be treated by jenkins as failure
11+
if [[ -n "$TEST_RESULTS_DIR" ]]; then
12+
mkdir -p ${TEST_RESULTS_DIR}
13+
LOG_PATH=$(mktemp ${TEST_RESULTS_DIR}/benchmark_${model_short}_XXXXXX.xml)
14+
fi
15+
16+
throughput_threshold=999999
17+
if [[ "${PERF_THRESHOLD}" ]]; then
18+
throughput_threshold=${PERF_THRESHOLD}
19+
fi
20+
warmup_threshold=1
21+
if [[ "${WARMUP_THRESHOLD}" ]]; then
22+
warmup_threshold=${WARMUP_THRESHOLD}
23+
fi
24+
25+
# Get the directory of the current script
26+
script_dir=$(dirname "$(readlink -f "$0")")
27+
28+
start=`date +%s`
29+
python $script_dir/../../benchmarks/benchmark_throughput.py \
30+
--model $model \
31+
--device hpu \
32+
--seed 2024 \
33+
--backend vllm \
34+
--dataset /mnt/weka/data/pytorch/llama2/ShareGPT_V3_unfiltered_cleaned_split.json \
35+
--num-prompts 1000 \
36+
--dtype bfloat16 \
37+
--max-model-len 4096 \
38+
--max-num-batched-tokens 8192 \
39+
--max-num-seqs 128 \
40+
--use-padding-aware-scheduling |& tee $log_file
41+
end=`date +%s`
42+
runtime=$((end-start))
43+
printf " -------------- \nBenchmark took: %2d:%02d\n\n" $((runtime/60)) $((runtime%60))
44+
45+
throughput=$(grep -oP 'Throughput: [0-9.]+ requests/s, \K[0-9]+' $log_file)
46+
warmup=$(grep -oP 'Warmup finished in +\K[0-9:]+' $log_file)
47+
48+
warmup_status="FAILED"
49+
warmup_fail=1
50+
if [[ "$warmup" ]]; then
51+
if ((warmup <= warmup_threshold)); then
52+
warmup_status="PASSED"
53+
warmup_fail=0
54+
fi
55+
fi
56+
echo "=== $warmup_status warmup MODEL: ${model_short} ($warmup <= $warmup_threshold) ==="
57+
throughput_status="FAILED"
58+
throughput_fail=1
59+
if [[ "$throughput" ]]; then
60+
if ((throughput >= throughput_threshold)); then
61+
throughput_status="PASSED"
62+
throughput_fail=0
63+
fi
64+
fi
65+
echo "=== $throughput_status throughput MODEL: ${model_short} ($throughput >= $throughput_threshold) ==="
66+
67+
if [[ -n "$TEST_RESULTS_DIR" ]]; then
68+
# Store full benchmark log
69+
chmod +r $log_file
70+
mv $log_file ${TEST_RESULTS_DIR}/
71+
72+
# Report results for jenkins
73+
cat <<EOF > ${LOG_PATH}
74+
<?xml version="1.0" encoding="utf-8"?>
75+
<testsuites><testsuite name="benchmark" errors="0" failures="$((throughput_fail + warmup_fail))" skipped="0" tests="2" time="$runtime">
76+
<testcase classname=".jenkins.benchmark.${model_short}-bf16" name="${model_short}-bf16-throughput" time="$runtime">
77+
<properties>
78+
<property name="throughput" value="$throughput"/>
79+
<property name="throughput threshold" value="$throughput_threshold"/>
80+
</properties>
81+
EOF
82+
if [[ "$throughput_fail" -eq 1 ]]; then
83+
cat <<EOF >> ${LOG_PATH}
84+
<failure message="Throughput did not meet the threshold ($throughput < $throughput_threshold)"></failure>
85+
EOF
86+
fi
87+
cat <<EOF >> ${LOG_PATH}
88+
</testcase>
89+
<testcase classname=".jenkins.benchmark.${model_short}-bf16" name="${model_short}-bf16-warmup" time="$warmup">
90+
<properties>
91+
<property name="warmup time" value="$warmup"/>
92+
<property name="warmup threshold" value="$warmup_threshold"/>
93+
</properties>
94+
EOF
95+
if [[ "$warmup_fail" -eq 1 ]]; then
96+
cat <<EOF >> ${LOG_PATH}
97+
<failure message="Warmup did not meet the threshold ($warmup > $warmup_threshold)"></failure>
98+
EOF
99+
fi
100+
cat <<EOF >> ${LOG_PATH}
101+
</testcase>
102+
</testsuite>
103+
</testsuites>
104+
EOF
105+
106+
fi

.jenkins/test_config_t_compile.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,10 @@ stages:
180180
- name: test_v1_entrypoints_g3
181181
flavor: g3
182182
command: export PT_HPU_LAZY_MODE=0 && export VLLM_T_COMPILE_FULLGRAPH=True && export VLLM_SKIP_WARMUP=true && pytest -v tests/v1/entrypoints -s -vvv --log-cli-level=INFO
183-
184-
183+
- name: benchmarks
184+
steps:
185+
- name: benchmark_llama_3_1_8b
186+
flavor: g3
187+
command: >
188+
export PT_HPU_LAZY_MODE=0 && export VLLM_T_COMPILE_FULLGRAPH=True &&
189+
bash .jenkins/benchmark/run-benchmark.sh

0 commit comments

Comments
 (0)