Skip to content

Commit f552c9d

Browse files
YanguanYanguan
authored andcommitted
[ascend]: add qwen3next
1 parent 088820f commit f552c9d

185 files changed

Lines changed: 28946 additions & 2604 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### PR Category
2+
<!-- One of [Core | Vendor | OP | Tools | Others ] -->
3+
4+
### PR Types
5+
<!-- One of [ User Experience | New Features | Bug Fixes | Improvements | Performance | Breaking Change| Deprecations | Test Case | Docs | Others ] -->
6+
7+
### PR Description
8+
<!-- Describe what you’ve done -->

.github/labeler.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# PR Labeler configuratoin file
2+
# Automatically add labels based on modified file paths
3+
4+
docs:
5+
- changed-files:
6+
- any-glob-to-any-file: '**/*.md'
7+
8+
ci:
9+
- changed-files:
10+
- any-glob-to-any-file:
11+
- '.github/**/*'
12+
- '.pre-commit-config.yaml'
13+
14+
tests:
15+
- changed-files:
16+
- any-glob-to-any-file: 'tests/**/*'
17+
18+
core:
19+
- changed-files:
20+
- any-glob-to-any-file: 'vllm_fl/**/*'
21+
22+
examples:
23+
- changed-files:
24+
- any-glob-to-any-file: 'examples/**/*'
25+
26+
benchmarks:
27+
- changed-files:
28+
- any-glob-to-any-file: 'benchmarks/**/*'
29+
30+
build:
31+
- changed-files:
32+
- any-glob-to-any-file:
33+
- 'setup.py'
34+
- 'requirements*.txt'
35+
- 'pyproject.toml'

.github/workflows/labeler.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Pull Request Labeler"
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
label:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Apply labels
20+
uses: actions/labeler@v5
21+
continue-on-error: true # Don't fail if config not yet on main branch
22+
with:
23+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
24+
sync-labels: true

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.egg-info
2+
__pycache__/
3+
build/
4+
5+
# Coverage
6+
.coverage
7+
.coverage.*
8+
htmlcov/

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-merge-conflict
6+
- id: check-symlinks
7+
- id: detect-private-key
8+
- id: end-of-file-fixer
9+
- id: trailing-whitespace
10+
- repo: https://github.com/astral-sh/ruff-pre-commit
11+
rev: v0.14.0
12+
hooks:
13+
- id: ruff-check
14+
args: ["--ignore=E731", --output-format, github, --fix]
15+
# E731 : Do not assign a lambda expression, use a def
16+
- id: ruff-format
17+
# - repo: https://github.com/crate-ci/typos
18+
# rev: v1.38.1
19+
# hooks:
20+
# - id: typos
21+
# args: [--force-exclude]

README.md

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,65 +5,73 @@ A vLLM plugin built on the FlagOS unified multi-chip backend.
55

66
### Setup
77

8-
0. Install vllm from the official [v0.11.0](https://github.com/vllm-project/vllm/tree/v0.11.0) (optional if the correct version is installed) or from the fork [vllm-FL](https://github.com/flagos-ai/vllm-FL).
8+
0. Install vllm from the official [v0.13.0](https://github.com/vllm-project/vllm/tree/v0.13.0) (optional if the correct version is installed) or from the fork [vllm-FL](https://github.com/flagos-ai/vllm-FL).
99

1010

11-
1. Install FlagGems
11+
1. Install vllm-plugin-FL
1212

13-
1.1 Install Build Dependencies
13+
1.1 Clone the repository:
14+
15+
```sh
16+
git clone https://github.com/flagos-ai/vllm-plugin-FL
17+
```
18+
19+
1.2 install
20+
```sh
21+
cd vllm-plugin-FL
22+
pip install -r requirements.txt
23+
pip install --no-build-isolation .
24+
# or editble install
25+
pip install --no-build-isolation -e .
26+
```
27+
28+
2. Install [FlagGems](https://github.com/flagos-ai/FlagGems/blob/master/docs/getting-started.md#quick-installation)
29+
30+
2.1 Install Build Dependencies
1431

1532
```sh
1633
pip install -U scikit-build-core==0.11 pybind11 ninja cmake
1734
```
1835

19-
1.2 Installation FlagGems
36+
2.2 Installation FlagGems
2037

21-
```shell
38+
```sh
2239
git clone https://github.com/flagos-ai/FlagGems
2340
cd FlagGems
2441
pip install --no-build-isolation .
2542
# or editble install
2643
pip install --no-build-isolation -e .
2744
```
2845

29-
2. Install FlagCX
46+
3. Install [FlagCX](https://github.com/flagos-ai/FlagCX/blob/main/docs/getting_started.md#build-and-installation)
3047

31-
2.1 Clone the repository:
48+
3.1 Clone the repository:
3249
```sh
3350
git clone https://github.com/flagos-ai/FlagCX.git
3451
cd FlagCX
35-
git checkout v0.3.0
52+
git checkout -b v0.9.0
53+
git submodule update --init --recursive
3654
```
3755

38-
2.2 Build the library with different flags targeting to different platforms:
56+
3.2 Build the library with different flags targeting to different platforms:
3957
```sh
4058
make USE_NVIDIA=1
4159
```
4260

43-
2.3 Set environment
61+
3.3 Set environment
4462
```sh
45-
export FLAGCX_PATH="$pwd"
63+
export FLAGCX_PATH="$PWD"
4664
```
4765

48-
2.4 Installation FlagGems
66+
3.4 Installation FlagCX
4967
```sh
5068
cd plugin/torch/
51-
python setup.py develop --adaptor nvidia/ascend
52-
```
53-
54-
3. Install vllm-plugin-fl
55-
56-
3.1 Clone the repository:
57-
58-
```sh
59-
git clone https://github.com/flagos-ai/vllm-plugin-FL
69+
FLAGCX_ADAPTOR=[xxx] pip install . --no-build-isolation
70+
# or editable install
71+
FLAGCX_ADAPTOR=[xxx] pip install -e . --no-build-isolation
6072
```
73+
Note: [xxx] should be selected according to the current platform, e.g., nvidia, ascend, etc.
6174

62-
3.2 install
63-
```sh
64-
cd vllm-plugin-fl
65-
pip install --no-build-isolation -e .
66-
```
6775

6876
If there are multiple plugins in the current environment, you can specify use vllm-plugin-fl via VLLM_PLUGINS='fl'.
6977

@@ -92,3 +100,19 @@ if __name__ == '__main__':
92100
generated_text = output.outputs[0].text
93101
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
94102
```
103+
104+
## Advanced use
105+
106+
For dispatch environment variable usage, see [environment variables usage](./vllm_fl/dispatch/README.md#environment-variables).
107+
108+
### Using Cuda Communication library
109+
If you want to use the original Cuda Communication, you can unset the following environment variables.
110+
```sh
111+
unset FLAGCX_PATH
112+
```
113+
114+
### Using native CUDA operators
115+
If you want to use the original CUDA operators, you can set the following environment variables.
116+
```sh
117+
export USE_FLAGGEMS=0
118+
```

benchmarks/README.md

Lines changed: 67 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,83 @@
1-
To use the benchmark_throughput_flagos feature from vllm-plugin-fl, you must first complete the following preliminary steps:
1+
## Benchmark Overview
22

3-
1. Start an LLM inference service compliant with the OpenAI API protocol using the --served-model-name Qwen3-Next argument, or use a different name and update the string on line 11 of benchmark_throughput_flagos.py to match your chosen --served-model-name exactly (character-for-character).
3+
This directory provides two workflows:
4+
- `benchmark_throughput_flagos.py`: throughput benchmarking for a served model.
5+
- `benchmark_throughput_autotune.py`: auto-tune FlagGems operator selection by throughput.
46

5-
2. Run the benchmark_throughput_flagos script on the same machine where the inference service is hosted.
7+
---
68

7-
3. Ensure the host machine has stable global network bandwidth of at least 10 Mbps, with 100 Mbps recommended for reliable benchmarking.
9+
## benchmark_throughput_flagos.py
810

9-
4. The benchmark_throughput_flagos feature has been validated in environments using vLLM versions 0.11.0 and 0.12.0. Using higher or lower vLLM versions—or serving the model with alternative frameworks such as SGLang—may result in compatibility issues.
10-
11-
Once the above prerequisites are met, you can simply run the following command from the directory containing this file:
11+
### Note
12+
- Start an OpenAI-compatible inference service with `--served-model-name Qwen3-Next`.
13+
If you use a different name, update the string in `benchmark_throughput_flagos.py`.
14+
- Run the benchmark on the same host as the service.
1215

16+
### Run
1317
```bash
1418
python3 benchmark_throughput_flagos.py
1519
```
1620

17-
If the command runs successfully, it will generate a directory named vllm_bench_logs in the current working directory. After the execution completes, follow these two steps to verify the benchmark ran correctly and to obtain the performance evaluation results:
18-
19-
1. Check for failed requests by running the following command in the current directory:
21+
### Verify Results
22+
1) Check failed requests:
2023
```bash
2124
grep "Fail" -rn vllm_bench_logs
2225
```
26+
All matches should show `Fail: 0`.
2327

24-
All matching lines should report zero failed requests (i.e., Fail: 0).
25-
26-
2. Generate performance statistics by executing:
28+
2) Generate statistics:
2729
```bash
2830
python3 benchmark_throughput_flagos_statistics.py
2931
```
30-
This will output the final performance evaluation results based on the collected logs.
32+
33+
---
34+
35+
## benchmark_throughput_autotune.py
36+
37+
38+
### Command
39+
```bash
40+
python benchmarks/benchmark_throughput_autotune.py [vllm args] [autotune options]
41+
```
42+
43+
### vLLM Args
44+
All arguments are passed directly to `vllm bench throughput`.
45+
46+
### Autotune Options
47+
- `--background` (true/false): run in background mode, default `false`.
48+
- `--ops`: comma-separated list of operator names to tune. If empty, auto-discovers ops.
49+
- `--num-runs`: number of runs per configuration, default `2` (uses the second round to skip warmup).
50+
- `--csv-path`: output CSV filename, default `history.csv` under the run directory.
51+
52+
Example:
53+
```bash
54+
python benchmarks/benchmark_throughput_autotune.py \
55+
--model /models/Qwen3-Next-80B-A3B-Instruct \
56+
--tensor-parallel-size 4 \
57+
--dataset-name random \
58+
--input-len 6144 \
59+
--output-len 1024 \
60+
--num-prompts 1000 \
61+
--max-num-batched-tokens 16384 \
62+
--max-num-seqs 2048 \
63+
--load-format "dummy" \
64+
--gpu-memory-utilization 0.85 \
65+
--compilation-config '{"cudagraph_mode": "FULL_AND_PIECEWISE"}' \
66+
--background true
67+
```
68+
69+
### Environment Variables
70+
See [environment variables usage](../vllm_fl/dispatch/README.md#environment-variables) for the full dispatch and FlagGems configuration reference.
71+
72+
### Outputs
73+
Each run creates a directory under `autotune_logs/autotune_xxx` with:
74+
- `autotune.log`: full run log when setting `background` as `true`
75+
- `history.csv`: throughput results for all rounds
76+
- `autotune_ops.yaml`: final op list used for tuning
77+
- `autotune_configs/`: per-round config snapshots
78+
- `best_config.yaml`: selected best config
79+
80+
### Notes
81+
- Round 1 runs baseline throughput without FlagGems.
82+
- Round 2 benchmarks each op in isolation (whitelist).
83+
- Round 3 validates the best-performing set.

0 commit comments

Comments
 (0)