Skip to content
Merged
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
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
2 changes: 2 additions & 0 deletions .github/configs/platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ platforms:
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."
16 changes: 15 additions & 1 deletion .github/scripts/ascend/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,18 @@ 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 \
--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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,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
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
Loading
Loading