Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 4 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 All @@ -44,6 +40,8 @@ container_options: >-
--hostname vllm-plugin-fl
--ipc=host
--privileged
--env ASCEND_RT_VISIBLE_DEVICES=14,15
--env VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=1800
--device /dev/davinci0
--device /dev/davinci1
--device /dev/davinci2
Expand Down
35 changes: 35 additions & 0 deletions .github/configs/musa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.

# MUSA Hardware Configuration
# This file defines CI/CD settings for MUSA testing.

platform: musa

ci_image: harbor.baai.ac.cn/flagos-dev/vllm-plugin-fl:v0.20.2-musa-ci

runner_labels:
- mt-cicd-vllm-plugin

container_volumes:
- /data:/data

container_options: >-
--hostname vllm-plugin-fl
--privileged
--ipc=host
--shm-size=64g
--env GEMS_VENDOR=mthreads
--env VLLM_PLUGINS=fl
--env MTHREADS_VISIBLE_DEVICES=all
6 changes: 5 additions & 1 deletion .github/configs/platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ 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:
enabled: true
musa:
enabled: true
38 changes: 36 additions & 2 deletions .github/scripts/ascend/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,40 @@
# Copyright (c) 2025 BAAI. All rights reserved.
# Check Huawei Ascend NPU availability.
set -euo pipefail

echo "=== Checking Ascend NPU availability ==="
# TODO: Replace with actual Ascend device check command.
npu-smi info || echo "WARNING: npu-smi not found. Ascend device check skipped."

if ! command -v npu-smi >/dev/null 2>&1; then
echo "::error::npu-smi is required but was not found in PATH."
exit 1
fi

if [[ -z "${ASCEND_RT_VISIBLE_DEVICES:-}" ]]; then
echo "::error::ASCEND_RT_VISIBLE_DEVICES is not set."
exit 1
fi

required_devices=(
"/dev/davinci_manager"
"/dev/devmm_svm"
"/dev/hisi_hdc"
)

IFS=',' read -r -a visible_devices <<< "${ASCEND_RT_VISIBLE_DEVICES}"
for device_id in "${visible_devices[@]}"; do
device_id="${device_id//[[:space:]]/}"
if [[ -z "${device_id}" ]]; then
continue
fi
required_devices+=("/dev/davinci${device_id}")
done

for device_path in "${required_devices[@]}"; do
if [[ ! -e "${device_path}" ]]; then
echo "::error::Missing Ascend device path: ${device_path}"
exit 1
fi
done

npu-smi info
echo "Ascend device check passed."
69 changes: 69 additions & 0 deletions .github/scripts/ascend/download_models.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/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"
HF_MODEL_ID="Qwen/Qwen3-0.6B"
MODELSCOPE_MODEL_IDS=(
"Qwen/Qwen3.6-27B"
"Qwen/Qwen3.6-35B-A3B"
)

mkdir -p "${QWEN_ROOT}"

MODEL_DIR="${QWEN_ROOT}/${HF_MODEL_ID#Qwen/}"
if [[ -f "${MODEL_DIR}/config.json" ]]; then
echo "Model already available: ${MODEL_DIR}"
else
export MODEL_ID="${HF_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}"
fi

if ! command -v modelscope >/dev/null 2>&1; then
pip install modelscope --break-system-packages
fi

for MODEL_ID in "${MODELSCOPE_MODEL_IDS[@]}"; do
MODEL_DIR="${QWEN_ROOT}/${MODEL_ID#Qwen/}"
if [[ -f "${MODEL_DIR}/config.json" ]]; then
echo "Model already available: ${MODEL_DIR}"
continue
fi

echo "Downloading ${MODEL_ID} from ModelScope to ${MODEL_DIR}"
modelscope download --model "${MODEL_ID}" --local_dir "${MODEL_DIR}"
test -f "${MODEL_DIR}/config.json"
echo "Model ready: ${MODEL_DIR}"
done
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
12 changes: 11 additions & 1 deletion .github/scripts/generate_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ def resolve_task_dir(task_key: str) -> str:
return TASK_DIR_MAP.get(task_key, task_key)


def resolve_e2e_timeout(config: dict, device: str, task_dir: str) -> int:
"""Return timeout for an E2E task, allowing platform YAML overrides."""
default = DEFAULT_TIMEOUT.get(task_dir, 60)
timeouts = (
config.get(device, {}).get("tests", {}).get("timeouts", {}).get("e2e", {})
)
value = timeouts.get(task_dir, default)
return int(value)


def get_device_sections(config: dict) -> list[str]:
"""Return device section names present in the config.

Expand Down Expand Up @@ -108,7 +118,7 @@ def build_e2e_matrix(
# Build one matrix entry per (task, device) group
entries = []
for (task_dir, device), case_list in groups.items():
timeout = DEFAULT_TIMEOUT.get(task_dir, 60)
timeout = resolve_e2e_timeout(config, device, task_dir)
entries.append(
{
"task": task_dir,
Expand Down
28 changes: 28 additions & 0 deletions .github/scripts/musa/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Copyright (c) 2026 BAAI. All rights reserved.
# Check Moore Threads MUSA availability.
set -euo pipefail

echo "Current time: $(date '+%Y-%m-%d %H:%M:%S')"
echo "=== Checking Moore Threads MUSA availability ==="

if command -v mthreads-gmi >/dev/null 2>&1; then
mthreads-gmi
else
echo "::warning::mthreads-gmi not found; checking through torch_musa."
fi

python - <<'PY'
import torch
import torch_musa

assert torch.musa.is_available(), "MUSA accelerator is unavailable"
count = torch.musa.device_count()
assert count > 0, "No MUSA devices detected"

tensor = torch.ones((32, 32), device="musa:0")
torch.musa.synchronize()

print(f"MUSA devices: {count}")
print(f"Tensor smoke: {tensor.device} {tuple(tensor.shape)}")
PY
33 changes: 33 additions & 0 deletions .github/scripts/musa/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Copyright (c) 2026 BAAI. All rights reserved.
# Setup script for Moore Threads MUSA CI environment.
set -euo pipefail

git config --global --add safe.directory "$(pwd)"

: "${GEMS_VENDOR:?GEMS_VENDOR is not set}"
: "${VLLM_PLUGINS:?VLLM_PLUGINS is not set}"
: "${MTHREADS_VISIBLE_DEVICES:?MTHREADS_VISIBLE_DEVICES is not set}"

python -m pip install --no-build-isolation --no-deps -e .

python - <<'PY'
import flag_gems
import torch
import torch_musa
import vllm
import vllm_fl
from vllm.platforms import current_platform

assert torch.musa.is_available(), "MUSA accelerator is unavailable"
assert torch.musa.device_count() > 0, "No MUSA devices detected"
assert current_platform.device_type == "musa", current_platform.device_type

print(f"vLLM import ok: {vllm.__version__}")
print(f"vLLM-FL import ok: {vllm_fl.__file__}")
print(f"FlagGems import ok: {getattr(flag_gems, '__version__', 'unknown')}")
print(f"Torch import ok: {torch.__version__}")
print(f"MUSA available: {torch.musa.is_available()}")
print(f"MUSA devices: {torch.musa.device_count()}")
print(f"Platform: {current_platform}")
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Check test 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why we need this workflow

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

need to remove this workflows

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
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ jobs:
platform: hygon
secrets: inherit

# ============================================================

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why we remove this line

# Job 4d: MetaX platform testing
# ============================================================
test-metax:
Expand All @@ -144,3 +143,14 @@ jobs:
with:
platform: metax
secrets: inherit

# ============================================================
# Job 4e: MUSA platform testing
# ============================================================
test-musa:
needs: discover
if: contains(fromJson(needs.discover.outputs.platforms), 'musa')
uses: ./.github/workflows/_platform_test.yml
with:
platform: musa
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
Loading
Loading