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
8 changes: 2 additions & 6 deletions .github/configs/ascend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@
platform: ascend

# Docker image for this hardware
ci_image: harbor.baai.ac.cn/flagscale/vllm-plugin-fl:v0.2.0-ascend-ci
ci_image: harbor.baai.ac.cn/flagscale/vllm-plugin-fl:ascend-vllm0.20.2-a3-ci

# Runner labels for this hardware
runner_labels:
- self-hosted
- Linux
- ARM64
- ascend
- npu-16
- flagcicd-910c

# Container volumes (hardware-specific paths)
container_volumes:
Expand Down
4 changes: 3 additions & 1 deletion .github/configs/platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ platforms:
cuda:
enabled: true
ascend:
enabled: false
# Ascend uses a scarce self-hosted NPU runner; keep it enabled when
# validating Ascend changes in PR CI.
enabled: true
hygon:
enabled: true
metax:
Expand Down
49 changes: 49 additions & 0 deletions .github/scripts/ascend/download_models.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
# Copyright 2026 FlagOS Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Provision models on the host-mounted /data volume. Images must not contain
# model weights; every platform test refers to the same host path convention.
set -euo pipefail

export FL_MODEL_BASE_PATH="${FL_MODEL_BASE_PATH:-/data/models}"
export HF_ENDPOINT="${HF_ENDPOINT:-https://hf-mirror.com}"

QWEN_ROOT="${FL_MODEL_BASE_PATH}/Qwen"
MODEL_ID="Qwen/Qwen3-0.6B"
MODEL_DIR="${QWEN_ROOT}/Qwen3-0.6B"

mkdir -p "${QWEN_ROOT}"

if [[ -f "${MODEL_DIR}/config.json" ]]; then
echo "Model already available: ${MODEL_DIR}"
exit 0
fi

export MODEL_ID MODEL_DIR
echo "Downloading ${MODEL_ID} from ${HF_ENDPOINT} to ${MODEL_DIR}"
python - <<'PY'
import os

from huggingface_hub import snapshot_download

snapshot_download(
repo_id=os.environ["MODEL_ID"],
local_dir=os.environ["MODEL_DIR"],
endpoint=os.environ["HF_ENDPOINT"],
)
PY

test -f "${MODEL_DIR}/config.json"
echo "Model ready: ${MODEL_DIR}"
17 changes: 16 additions & 1 deletion .github/scripts/ascend/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,19 @@ set -euo pipefail
git config --global --add safe.directory "$(pwd)"

pip install --upgrade pip "setuptools>=77.0.3"
pip install --no-build-isolation -e ".[test]"
pip install \
--constraint requirements/ascend.txt \
--no-build-isolation \
--no-deps \
-e .

python - <<'PY'
import numpy

expected = "1.26.4"
if numpy.__version__ != expected:
raise RuntimeError(
f"Unexpected NumPy version: {numpy.__version__}; expected {expected}"
)
print(f"NumPy version: {numpy.__version__}")
PY
7 changes: 7 additions & 0 deletions .github/workflows/_e2e_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ jobs:
- name: Check device availability
run: bash .github/scripts/${{ inputs.platform }}/check.sh

- name: Prepare host models
run: |
model_script=".github/scripts/${{ inputs.platform }}/download_models.sh"
if [ -f "${model_script}" ]; then
bash "${model_script}"
fi

- name: Install project
run: bash .github/scripts/${{ inputs.platform }}/setup.sh

Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/ascend-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2026 FlagOS Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Ascend runners are scarce shared resources. Validate the image and selected
# cases directly on the host first, then dispatch this workflow when a recorded
# full CI result is needed.
name: Ascend Manual CI

on:
workflow_dispatch:
pull_request:
types: [labeled]

concurrency:
group: ascend-manual-${{ github.ref }}
cancel-in-progress: false

jobs:
test-ascend:
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.label.name == 'run-ascend-ci'
uses: ./.github/workflows/_platform_test.yml
with:
platform: ascend
secrets: inherit
2 changes: 1 addition & 1 deletion benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ All arguments are passed directly to `vllm bench throughput`.
Example:
```bash
python benchmarks/benchmark_throughput_autotune.py \
--model /models/Qwen3-Next-80B-A3B-Instruct \
--model /data/models/Qwen/Qwen3-Next-80B-A3B-Instruct \
--tensor-parallel-size 4 \
--dataset-name random \
--input-len 6144 \
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmark_throughput_autotune.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def main() -> None:
"No throughput arguments provided. "
"Pass them after the script args, e.g.: "
'python benchmark_gems_autotune.py --ops "silu_and_mul" -- '
"--model /models/Qwen3-Next-80B-A3B-Instruct --tensor-parallel-size 4 ..."
"--model /data/models/Qwen/Qwen3-Next-80B-A3B-Instruct --tensor-parallel-size 4 ..."
)

if args.background and not os.environ.get("FLAGGEMS_AUTOTUNE_BACKGROUND"):
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/benchmark_throughput_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# Usage:
# 1. Start the server as follows (adjust model path and args as needed):
# vllm serve /models/Qwen3.6-27B --tensor-parallel-size 2 --max-model-len 262144 --no-enable-log-requests --no-enable-prefix-caching
# vllm serve /data/models/Qwen/Qwen3.6-27B --tensor-parallel-size 2 --max-model-len 262144 --no-enable-log-requests --no-enable-prefix-caching

# 2. Run this benchmark script (default: 4 test cases):
# python benchmarks/benchmark_throughput_serve.py
Expand All @@ -35,7 +35,7 @@
from datetime import datetime
from statistics import mean

MODEL = "/models/Qwen3.6-27B"
MODEL = "/data/models/Qwen/Qwen3.6-27B"

# total runs for each case
RUNS = 4
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/flagos_eval/run_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
set -e

# Arguments
MODEL_PATH=${1:?"Please provide model path, e.g.: ./run_benchmark.sh /workspace/Qwen3-4B/"}
MODEL_PATH=${1:?"Please provide model path, e.g.: ./run_benchmark.sh /data/models/Qwen/Qwen3-4B/"}

# Output directory
OUTPUT_DIR=bench_results
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/flagos_eval/run_eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
set -e

# Arguments
MODEL_PATH=${1:?"Please provide model path, e.g.: ./run_eval.sh /workspace/Qwen3-4B/ hf_xxx"}
HF_TOKEN=${2:?"Please provide HF_TOKEN, e.g.: ./run_eval.sh /workspace/Qwen3-4B/ hf_xxx"}
MODEL_PATH=${1:?"Please provide model path, e.g.: ./run_eval.sh /data/models/Qwen/Qwen3-4B/ hf_xxx"}
HF_TOKEN=${2:?"Please provide HF_TOKEN, e.g.: ./run_eval.sh /data/models/Qwen/Qwen3-4B/ hf_xxx"}

# Environment variables
export HF_ENDPOINT=https://hf-mirror.com # China mirror (can be removed for overseas)
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/flagos_eval/run_mixed_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ set -e
# seed: Random seed for shuffle (default: 42)
#
# Example:
# ./run_mixed_benchmark.sh /workspace/Qwen3-4B/
# ./run_mixed_benchmark.sh /workspace/Qwen3-4B/ 123
# ./run_mixed_benchmark.sh /data/models/Qwen/Qwen3-4B/
# ./run_mixed_benchmark.sh /data/models/Qwen/Qwen3-4B/ 123
# ============================================================================

# Arguments
MODEL_PATH=${1:?"Please provide model path, e.g.: ./run_mixed_benchmark.sh /workspace/Qwen3-4B/"}
MODEL_PATH=${1:?"Please provide model path, e.g.: ./run_mixed_benchmark.sh /data/models/Qwen/Qwen3-4B/"}
SEED=${2:-42}

# Output directory
Expand Down
137 changes: 26 additions & 111 deletions docker/ascend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,143 +12,58 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG VLLM_VERSION=0.19.0
ARG CANN_VERSION=8.5.1
ARG CANN_CHIP=a3
ARG UBUNTU_VERSION=22.04
ARG PYTHON_VERSION=3.11
# Keep the chip image aligned with the environment validated on Ascend 910C.
ARG ASCEND_BASE_IMAGE=quay.io/ascend/vllm-ascend:v0.20.2rc1-a3

# ---------- base stage ----------
FROM quay.io/ascend/cann:${CANN_VERSION}-${CANN_CHIP}-ubuntu${UBUNTU_VERSION}-py${PYTHON_VERSION} AS base
FROM ${ASCEND_BASE_IMAGE} AS base

ARG MOONCAKE_TAG=v0.3.8.post1
ARG SOC_VERSION=ascend910_9391
ENV DEBIAN_FRONTEND=noninteractive
ENV SOC_VERSION=${SOC_VERSION} \
TASK_QUEUE_ENABLE=1 \
OMP_NUM_THREADS=1
ARG FLAGGEMS_VERSION=3e6528cf04f5f964a7b0fa6628de6f0410dbfd02

RUN pip install --upgrade pip setuptools
ENV DEBIAN_FRONTEND=noninteractive \
VLLM_PLUGINS=fl \
VLLM_FL_PLATFORM=ascend \
HF_ENDPOINT=https://hf-mirror.com \
FL_MODEL_BASE_PATH=/data/models

# Add BiShengIR compiler to PATH
ENV PATH="${ASCEND_TOOLKIT_HOME}/tools/bishengir/bin:${PATH}"

# Install system deps (clang-15 for triton-ascend, jemalloc for memory alloc)
RUN apt-get update -y && \
apt-get install -y git \
vim \
wget \
net-tools \
gcc \
g++ \
RUN python -m pip install --upgrade pip "setuptools>=77.0.3" \
&& python -m pip install --no-cache-dir \
scikit-build-core==0.11 \
pybind11 \
ninja \
cmake \
numactl \
libnuma-dev \
libjemalloc2 \
clang-15 \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 20 \
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-15 20 && \
rm -rf /var/cache/apt/* /var/lib/apt/lists/*

# Build & install Mooncake (distributed KV cache)
COPY ./scripts/mooncake_installer.sh /tmp/mooncake_installer.sh
RUN git clone --depth 1 --branch ${MOONCAKE_TAG} https://github.com/kvcache-ai/Mooncake /tmp/Mooncake \
&& mv /tmp/mooncake_installer.sh /tmp/Mooncake/ \
&& cd /tmp/Mooncake \
&& bash mooncake_installer.sh -y \
&& ARCH=$(uname -m) \
&& source /usr/local/Ascend/ascend-toolkit/set_env.sh \
&& export LD_LIBRARY_PATH=/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/devlib:/usr/local/Ascend/ascend-toolkit/latest/${ARCH}-linux/lib64:$LD_LIBRARY_PATH \
&& mkdir -p build \
&& cd build \
&& cmake .. -DUSE_ASCEND_DIRECT=ON \
&& make -j$(nproc) && make install \
&& rm -rf /tmp/Mooncake

# Install triton-ascend, ray, protobuf
RUN pip install triton-ascend==3.2.0 \
'ray>=2.47.1,<=2.48.0' \
'protobuf>3.20.0' && \
pip cache purge

# jemalloc preload + devlib LD_LIBRARY_PATH
RUN echo "export LD_PRELOAD=/usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2:${LD_PRELOAD}" >> ~/.bashrc && \
echo "export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib" >> ~/.bashrc
&& git clone https://github.com/flagos-ai/FlagGems.git /workspace/FlagGems \
&& git -C /workspace/FlagGems checkout "${FLAGGEMS_VERSION}" \
&& python -m pip install --no-build-isolation /workspace/FlagGems \
&& python -m pip cache purge

WORKDIR /workspace

# ---------- dev stage ----------
FROM base AS dev

ARG VLLM_VERSION=0.19.0

RUN pip install \
RUN python -m pip install --no-cache-dir \
pytest \
pytest-cov \
pytest-json-report \
ruff \
pre-commit \
ninja \
cmake

# Install vLLM (uninstall triton pulled by vllm on x86 — conflicts on Ascend)
RUN VLLM_TARGET_DEVICE="empty" pip install "vllm[audio]==${VLLM_VERSION}" \
--extra-index-url https://download.pytorch.org/whl/cpu/ && \
pip uninstall -y triton && \
pip cache purge
pre-commit

# ---------- ci stage ----------
FROM base AS ci
FROM dev AS ci

ARG VLLM_VERSION=0.19.0

# Install dev/test tools
RUN pip install \
pytest \
pytest-cov \
RUN python -m pip install --no-cache-dir \
pytest-timeout \
pytest-json-report \
pytest-metadata \
numpy \
numpy==1.26.4 \
requests \
openai \
decorator \
pyyaml \
"modelscope>=1.18.1" \
ruff \
pre-commit \
ninja \
cmake

# Install vLLM (uninstall triton pulled by vllm on x86 — conflicts on Ascend)
RUN VLLM_TARGET_DEVICE="empty" pip install "vllm[audio]==${VLLM_VERSION}" \
--extra-index-url https://download.pytorch.org/whl/cpu/ && \
pip uninstall -y triton && \
pip cache purge

# Install FlagGems (NPU backend)
ARG FLAGGEMS_VERSION=v5.0.0
RUN pip install -U scikit-build-core==0.11 pybind11 \
&& git clone --branch ${FLAGGEMS_VERSION} --depth 1 https://github.com/flagos-ai/FlagGems /workspace/FlagGems \
&& pip install --no-build-isolation \
--config-settings=cmake.define.FLAGGEMS_BACKEND=NPU \
/workspace/FlagGems

# Install FlagTree
RUN pip install flagtree==0.4.0+ascend3.2 \
--index-url=https://resource.flagos.net/repository/flagos-pypi-hosted/simple \
--trusted-host=resource.flagos.net

# Set environment variables for vLLM and Triton
ENV VLLM_PLUGINS=fl
ENV TRITON_ALL_BLOCKS_PARALLEL=1
"huggingface_hub>=0.34"

# ---------- release stage ----------
FROM base AS release

ARG INDEX_URL
ARG EXTRA_INDEX_URL
ARG VLLM_VERSION=0.19.0

# Install vLLM
# Todo

WORKDIR /workspace
Loading
Loading