Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/format_pr_body.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
#
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
#
Expand All @@ -15,7 +16,6 @@
# This file is a part of the vllm-ascend project.
# Adapted from vllm/.github/scripts/cleanup_pr_body.sh

#!/bin/bash

set -eux

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/image_310p_openeuler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ on:
- 'CMakeLists.txt'
- 'csrc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: vllm-ascend image build
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/image_310p_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ on:
- 'cmake/**'
- 'CMakeLists.txt'
- 'csrc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:

build:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/image_a3_openeuler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ on:
- 'CMakeLists.txt'
- 'csrc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build:
name: vllm-ascend image build
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/image_a3_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ on:
- 'cmake/**'
- 'CMakeLists.txt'
- 'csrc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:

build:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/image_openeuler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ on:
- 'CMakeLists.txt'
- 'csrc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
name: vllm-ascend image build
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/image_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ on:
- 'cmake/**'
- 'CMakeLists.txt'
- 'csrc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:

build:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
pip config set global.index-url http://cache-service.nginx-pypi-cache.svc.cluster.local/pypi/simple
pip config set global.trusted-host cache-service.nginx-pypi-cache.svc.cluster.local
apt-get update -y
apt install git -y
apt install git wget -y
- name: Checkout vllm-project/vllm-ascend repo
uses: actions/checkout@v4
- run: echo "::add-matcher::.github/workflows/matchers/actionlint.json"
Expand All @@ -41,4 +41,5 @@ jobs:
env:
SHELLCHECK_OPTS: "--exclude=SC2046,SC2006,SC2086"
GOPROXY: "https://goproxy.cn,direct"
SHELLCHECK_PATH: "/root/.cache/tools/shellcheck-stable"
run: pre-commit run --all-files --hook-stage manual
11 changes: 5 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ repos:
language: system
types: [python]
stages: [manual] # Only run in CI
# FIXME: enable shellcheck
# - id: shellcheck
# name: Lint shell scripts
# entry: tools/shellcheck.sh
# language: script
# types: [shell]
- id: shellcheck
name: Lint shell scripts
entry: tools/shellcheck.sh
language: script
types: [shell]
- id: png-lint
name: Lint PNG exports from excalidraw
entry: tools/png-lint.sh
Expand Down
9 changes: 9 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# rules currently disabled:
#
# SC1091 (info): Not following: <sourced file> was not specified as input (see shellcheck -x)
# SC2004 (style): $/${} is unnecessary on arithmetic variables.
# SC2129 (style): Consider using { cmd1; cmd2; } >> file instead of individual redirects.
# SC2155 (warning): Declare and assign separately to avoid masking return values.
# SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
#
disable=SC1091,SC2004,SC2129,SC2155,SC2164
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Disabling SC2155 and SC2164 globally is discouraged as they can hide potential bugs.

  • SC2155: Warns about masking return values in assignments like VAR=$(command). If command fails, the script might not exit as expected, even with set -e. It's safer to declare and assign separately, or handle the error immediately.
  • SC2164: Warns about unsafe cd commands. A failed cd can cause subsequent commands to execute in the wrong directory, which can be very dangerous. It's better to use cd ... || exit.

Instead of disabling these checks globally, it would be better to address the warnings in the code, or disable them on a case-by-case basis using shellcheck disable=... comments where they are confirmed to be false positives.

disable=SC1091,SC2004,SC2129

1 change: 1 addition & 0 deletions benchmarks/scripts/run-performance-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ensure_sharegpt_downloaded() {
echo "$FILE not found, downloading from hf-mirror ..."
mkdir -p "$DIR"
wget -O "$FILE" https://hf-mirror.com/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
echo "Download failed!" >&2
return 1
Expand Down
26 changes: 13 additions & 13 deletions examples/disaggregated_prefill_v1/gen_ranktable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ while [[ $# -gt 0 ]]; do
;;
esac
done
LOCAL_HOSTS=($(hostname -I))
read -ra LOCAL_HOSTS <<< "$(hostname -I)"
LOCAL_HOST="127.0.0.1"
MASTER_ADDR=${IPs[0]}
MASTER_PORT=6657
Expand All @@ -63,14 +63,14 @@ if [[ $NODE_RANK == "" ]];then
fi

WORLD_SIZE=$(($NPUS_PER_NODE * $NNODES))
RANKSTART=`expr $NPUS_PER_NODE \* $NODE_RANK`
RANKSTART=$(( NPUS_PER_NODE * NODE_RANK ))

echo "========>param:"
echo "LOCAL_HOST": $LOCAL_HOST
echo "WORLD_SIZE: " $WORLD_SIZE
echo "RANKSTART": $RANKSTART
echo "NNODES": $NNODES
echo "NODE_RANK": $NODE_RANK
echo "========> param:"
echo "LOCAL_HOST: $LOCAL_HOST"
echo "WORLD_SIZE: $WORLD_SIZE"
echo "RANKSTART: $RANKSTART"
echo "NNODES: $NNODES"
echo "NODE_RANK: $NODE_RANK"
echo "==============="

if [ -n "$LOCAL_DEVICE_IDS" ]; then
Expand All @@ -80,9 +80,9 @@ fi
if [[ -n "${GEN_RANKTABLE}" || ! -e ${PWD}/ranktable.json ]]; then
GLOO_SOCKET_IFNAME=$NETWORK_CARD_NAME torchrun \
--nproc_per_node 1 \
--nnodes ${NNODES} \
--node_rank ${NODE_RANK} \
--master_addr ${MASTER_ADDR} \
--master_port ${MASTER_PORT} \
gen_ranktable.py --local-host $LOCAL_HOST --prefill-device-cnt $PREFILL_DEVICE_CNT --decode-device-cnt $DECODE_DEVICE_CNT $OPTIONAL_SECTION
--nnodes "${NNODES}" \
--node_rank "${NODE_RANK}" \
--master_addr "${MASTER_ADDR}" \
--master_port "${MASTER_PORT}" \
gen_ranktable.py --local-host "$LOCAL_HOST" --prefill-device-cnt "$PREFILL_DEVICE_CNT" --decode-device-cnt "$DECODE_DEVICE_CNT" "$OPTIONAL_SECTION"
fi
12 changes: 6 additions & 6 deletions examples/external_online_dp/run_dp_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export ASCEND_RT_VISIBLE_DEVICES=$1

vllm serve model_path \
--host 0.0.0.0 \
--port $2 \
--data-parallel-size $3 \
--data-parallel-rank $4 \
--data-parallel-address $5 \
--data-parallel-rpc-port $6 \
--tensor-parallel-size $7 \
--port "$2" \
--data-parallel-size "$3" \
--data-parallel-rank "$4" \
--data-parallel-address "$5" \
--data-parallel-rpc-port "$6" \
--tensor-parallel-size "$7" \
--enable-expert-parallel \
--seed 1024 \
--served-model-name dsv3 \
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function create_vllm_venv() {

function get_version() {
local VERSION_NAME="$1"
python3 "${SCRIPT_DIR}/../../docs/source/conf.py" | jq .${VERSION_NAME} | tr -d '"'
python3 "${SCRIPT_DIR}/../../docs/source/conf.py" | jq ."${VERSION_NAME}" | tr -d '"'
}

SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
12 changes: 6 additions & 6 deletions tests/e2e/pd_disaggreate/run_edge_case_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ RANKTABLE_PATH=${GIT_ROOT}/examples/disaggregate_prefill_v1/ranktable.json
if [ -f "$RANKTABLE_PATH" ]; then
rm "$RANKTABLE_PATH"
fi
cd ${GIT_ROOT}/examples/disaggregate_prefill_v1
LOCAL_HOST=`hostname -I|awk -F " " '{print$1}'`
bash gen_ranktable.sh --ips $LOCAL_HOST --network-card-name enp189s0f0 --prefill-device-cnt 1 --decode-device-cnt 1
cd "${GIT_ROOT}"/examples/disaggregate_prefill_v1
LOCAL_HOST=$(hostname -I | awk '{print $1}')
bash gen_ranktable.sh --ips "$LOCAL_HOST" --network-card-name enp189s0f0 --prefill-device-cnt 1 --decode-device-cnt 1
cd -
export DISAGGREGATED_PREFILL_RANK_TABLE_PATH="$RANKTABLE_PATH"

Expand Down Expand Up @@ -107,9 +107,9 @@ run_tests_for_model() {
eval "$FULL_CMD &"

# Wait for all instances to start
echo "Waiting for prefill instance on port $PORT to start..."
echo "Waiting for prefill instance on port $PREFILL_PORT to start..."
wait_for_server $PREFILL_PORT
echo "Waiting for decode instance on port $PORT to start..."
echo "Waiting for decode instance on port $DECODE_PORT to start..."
wait_for_server $DECODE_PORT

# Build the command for the proxy server with all the hosts and ports
Expand All @@ -126,7 +126,7 @@ run_tests_for_model() {

# Run lm eval for this model
echo "Running tests for $model_name"
PREFILL_PORT=$PREFILL_PORT DECODE_PORT=$DECODE_PORT PROXY_PORT=$PROXY_PORT python -m pytest -s -v ${GIT_ROOT}/tests/e2e/pd_disaggreate/test_edge_cases.py
PREFILL_PORT=$PREFILL_PORT DECODE_PORT=$DECODE_PORT PROXY_PORT=$PROXY_PORT python -m pytest -s -v "${GIT_ROOT}"/tests/e2e/pd_disaggreate/test_edge_cases.py

# Clean up before running next model
cleanup_instances
Expand Down
12 changes: 6 additions & 6 deletions tests/e2e/pd_disaggreate/setup_pd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ function run_prefill_instance() {
}')

# start prefill instance
ASCEND_RT_VISIBLE_DEVICES=0 vllm serve $model_name \
ASCEND_RT_VISIBLE_DEVICES=0 vllm serve "$model_name" \
--host 0.0.0.0 \
--port $prefill_port \
--tensor-parallel-size $tp_size \
--port "$prefill_port" \
--tensor-parallel-size "$tp_size" \
--served-model-name Deepseek \
--max-model-len 2000 \
--trust-remote-code \
Expand Down Expand Up @@ -110,10 +110,10 @@ function run_decode_instance() {
}')

# start decode instance
ASCEND_RT_VISIBLE_DEVICES=1 vllm serve $model_name \
ASCEND_RT_VISIBLE_DEVICES=1 vllm serve "$model_name" \
--host 0.0.0.0 \
--port $decode_port \
--tensor-parallel-size $tp_size \
--port "$decode_port" \
--tensor-parallel-size "$tp_size" \
--seed 1024 \
--served-model-name Deepseek \
--max-model-len 2000 \
Expand Down
12 changes: 6 additions & 6 deletions tests/e2e/run_disagg_pd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

set -eo errexit

. $(dirname "$0")/common.sh
. $(dirname "$0")/pd_disaggreate/setup_pd.sh
. "$(dirname "$0")"/common.sh
. "$(dirname "$0")"/pd_disaggreate/setup_pd.sh

export VLLM_USE_MODELSCOPE="True"

Expand All @@ -30,10 +30,10 @@ TP_SIZE=1

# TODO: support multi-card
prefill_ip=$(/usr/local/Ascend/driver/tools/hccn_tool -i 0 -ip -g | grep "ipaddr" | awk -F: '{print $2}' | xargs)
PREFILL_DEVICE_IPS="[\"$prefill_ip\"]"
PREFILL_DEVICE_IPS=$(printf '["%s"]' "$prefill_ip")

decode_ip=$(/usr/local/Ascend/driver/tools/hccn_tool -i 1 -ip -g | grep "ipaddr" | awk -F: '{print $2}' | xargs)
DECODE_DEVICE_IPS="[\"$decode_ip\"]"
DECODE_DEVICE_IPS=$(printf '["%s"]' "$decode_ip")

_info "====> Start pd disaggregated test"
REGISTER_PORT=10101
Expand All @@ -44,14 +44,14 @@ _info "Started pd disaggregated proxy server"
PREFILL_PROC_NAME="Prefill-instance"
PREFILL_PORT=8001
_info "Starting prefill instance"
run_prefill_instance $MODEL_NAME $TP_SIZE $PREFILL_PORT $REGISTER_PORT $PREFILL_DEVICE_IPS $DECODE_DEVICE_IPS &
run_prefill_instance $MODEL_NAME $TP_SIZE $PREFILL_PORT $REGISTER_PORT "$PREFILL_DEVICE_IPS" "$DECODE_DEVICE_IPS" &
_info "Waiting for prefill instance ready"
wait_url_ready $PREFILL_PROC_NAME "http://localhost:${PREFILL_PORT}/v1/completions"

DECODE_PROC_NAME="Decode-instance"
DECODE_PORT=8002
_info "Starting decode instance"
run_decode_instance $MODEL_NAME $TP_SIZE $DECODE_PORT $REGISTER_PORT $PREFILL_DEVICE_IPS $DECODE_DEVICE_IPS &
run_decode_instance $MODEL_NAME $TP_SIZE $DECODE_PORT $REGISTER_PORT "$PREFILL_DEVICE_IPS" "$DECODE_DEVICE_IPS" &
_info "Waiting for decode instance ready"
wait_url_ready $DECODE_PROC_NAME "http://localhost:${DECODE_PORT}/v1/completions"

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/run_doctests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

set -eo errexit

. $(dirname "$0")/common.sh
. "$(dirname "$0")"/common.sh

export VLLM_USE_MODELSCOPE=true
export VLLM_LOGGING_LEVEL=ERROR
Expand Down
2 changes: 1 addition & 1 deletion tools/mypy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if [ "$CI" -eq 1 ]; then
set -e
fi

if [ $PYTHON_VERSION == "local" ]; then
if [ "$PYTHON_VERSION" == "local" ]; then
PYTHON_VERSION=$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
fi

Expand Down
18 changes: 13 additions & 5 deletions tools/shellcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ if [ -d "shellcheck-${scversion}" ]; then
export PATH
fi

# Optionally set SHELLCHECK_PATH to a directory containing shellcheck binary for CI use.
if [ -d "$SHELLCHECK_PATH" ]; then
PATH="$PATH:$SHELLCHECK_PATH"
export PATH
fi

if ! [ -x "$(command -v shellcheck)" ]; then
if [ "$(uname -s)" != "Linux" ] || [ "$(uname -m)" != "x86_64" ]; then
echo "Please install shellcheck: https://github.com/koalaman/shellcheck?tab=readme-ov-file#installing"
Expand All @@ -36,10 +42,12 @@ if ! [ -x "$(command -v shellcheck)" ]; then

# automatic local install if linux x86_64
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
PATH="$PATH:$(pwd)/shellcheck-${scversion}"
export PATH
export PATH="$PATH:$(pwd)/shellcheck-${scversion}"
fi

# should enable this
# find . -path ./.git -prune -o -name "*.sh" -print0 \
# | xargs -0 -I {} sh -c 'git check-ignore -q "{}" || shellcheck -s bash "{}"'
while IFS= read -r -d '' file; do
git check-ignore -q "$file" || shellcheck -s bash "$file"
done < <(find . \
-path ./.git -prune -o \
-path ./vllm-empty -prune -o \
-name "*.sh" -print0)
Loading