Skip to content

Commit 1291544

Browse files
committed
Add MUSA Docker image build flow
1 parent d445de0 commit 1291544

12 files changed

Lines changed: 491 additions & 37 deletions

File tree

.dockerignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.git
2+
.gitignore
3+
.pytest_cache
4+
.ruff_cache
5+
__pycache__
6+
*.py[cod]
7+
build
8+
dist
9+
*.egg-info
10+
vllm_musa.egg-info
11+
.coverage
12+
htmlcov
13+
14+
# setup.py clones and pins third_party sources inside the image. Copying a local
15+
# checkout makes the build context large and can hide drift from the pinned refs.
16+
third_party/vllm
17+
third_party/flashinfer
18+
19+
# Local/editor artifacts.
20+
.claude
21+
.humanize
22+
assets

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The plugin leverages the following key components:
4444

4545
| vLLM Version | PyTorch Version | Engine | Status |
4646
|--------------|-----------------|---------|--------------|
47-
| v0.22.0 | 2.7.1 | V1 only | ✅ Supported |
47+
| v0.22.0 | 2.9.x | V1 only | ✅ Supported |
4848

4949
> **Note**: This plugin uses vLLM's V1 engine architecture. V0 engine is not supported.
5050
@@ -57,7 +57,15 @@ The plugin leverages the following key components:
5757
cd vllm-musa
5858
```
5959

60-
2. Install vLLM Hardware Plugin for Moore Threads MUSA:
60+
2. Install Python dependencies before installing `vllm-musa`. The MUSA
61+
requirements entrypoint includes common dependencies and MUSA-private pins
62+
such as `torch` and `torch_musa`.
63+
64+
```bash
65+
pip install -r requirements/build.txt -r requirements/musa.txt
66+
```
67+
68+
3. Install vLLM Hardware Plugin for Moore Threads MUSA:
6169

6270
```bash
6371
# Standard installation (installs vLLM MUSA plugin and vLLM)
@@ -67,7 +75,7 @@ The plugin leverages the following key components:
6775
pip install -e . --no-build-isolation -v
6876
```
6977

70-
3. Verify the installation:
78+
4. Verify the installation:
7179

7280
```bash
7381
# Check plugin registration
@@ -105,6 +113,7 @@ Useful commands:
105113

106114
```bash
107115
ccache --zero-stats
116+
pip install -r requirements/build.txt -r requirements/musa.txt
108117
pip install -e . --no-build-isolation -v
109118
ccache --show-stats
110119
```

README_CN.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
| vLLM 版本 | PyTorch 版本 | 引擎 | 状态 |
4646
|-----------|--------------|---------|--------------|
47-
| v0.22.0 | 2.7.1 | 仅 V1 | ✅ 已支持 |
47+
| v0.22.0 | 2.9.x | 仅 V1 | ✅ 已支持 |
4848

4949
> **注意**:本插件使用 vLLM 的 V1 引擎架构,不支持 V0 引擎。
5050
@@ -57,7 +57,14 @@
5757
cd vllm-musa
5858
```
5959

60-
2. 安装摩尔线程 MUSA 的 vLLM 硬件插件:
60+
2. 安装 `vllm-musa` 前先安装 Python 依赖。MUSA requirements 入口包含通用依赖
61+
`torch``torch_musa` 等 MUSA private 版本约束:
62+
63+
```bash
64+
pip install -r requirements/build.txt -r requirements/musa.txt
65+
```
66+
67+
3. 安装摩尔线程 MUSA 的 vLLM 硬件插件:
6168

6269
```bash
6370
# 标准安装(安装 vLLM MUSA 插件和 vLLM)
@@ -67,7 +74,7 @@
6774
pip install -e . --no-build-isolation -v
6875
```
6976

70-
3. 验证安装:
77+
4. 验证安装:
7178

7279
```bash
7380
# 检查插件注册

docker/build_image.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
6+
cd "${REPO_ROOT}"
7+
8+
PYTHON_VERSION="${PYTHON_VERSION:-3.10}"
9+
BASE_IMAGE="${BASE_IMAGE:-ubuntu:22.04}"
10+
11+
MUSA_APT_SOURCE="${MUSA_APT_SOURCE:-https://dl.mthreads.com/repo/repository/ubuntu2204/}"
12+
INSTALL_MUSA_STACK="${INSTALL_MUSA_STACK:-auto}"
13+
MUSA_RUNTIME_VERSION="${MUSA_RUNTIME_VERSION:-5.1}"
14+
MCCL_VERSION="${MCCL_VERSION:-2.3.0}"
15+
16+
PYTORCH_RELEASE="$(
17+
awk -F'==' '/^torch==/ {gsub(/\.\*/, "", $2); print $2; exit}' \
18+
requirements/musa_private.txt
19+
)"
20+
if [[ -z "${PYTORCH_RELEASE}" ]]; then
21+
echo "Failed to derive PyTorch release from requirements/musa_private.txt" >&2
22+
exit 1
23+
fi
24+
25+
BUILD_MOONCAKE="${BUILD_MOONCAKE:-1}"
26+
MOONCAKE_REPO="${MOONCAKE_REPO:-https://github.com/kvcache-ai/Mooncake.git}"
27+
MOONCAKE_COMMIT="${MOONCAKE_COMMIT:-b6a841dc78c707ec655a563453277d969fb8f38d}"
28+
29+
IMAGE_REPOSITORY="${IMAGE_REPOSITORY:-vllm-musa}"
30+
IMAGE_FLAVOR="${IMAGE_FLAVOR:-ubuntu22.04_py${PYTHON_VERSION}_musa_runtime_${MUSA_RUNTIME_VERSION}_pytorch_release_${PYTORCH_RELEASE}}"
31+
IMAGE_TAG="${IMAGE_TAG:-${IMAGE_REPOSITORY}:${IMAGE_FLAVOR}}"
32+
33+
docker build \
34+
--network host \
35+
-f docker/musa.Dockerfile \
36+
-t "${IMAGE_TAG}" \
37+
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
38+
--build-arg PYTHON_VERSION="${PYTHON_VERSION}" \
39+
--build-arg MUSA_APT_SOURCE="${MUSA_APT_SOURCE}" \
40+
--build-arg INSTALL_MUSA_STACK="${INSTALL_MUSA_STACK}" \
41+
--build-arg MUSA_RUNTIME_VERSION="${MUSA_RUNTIME_VERSION}" \
42+
--build-arg MCCL_VERSION="${MCCL_VERSION}" \
43+
--build-arg BUILD_MOONCAKE="${BUILD_MOONCAKE}" \
44+
--build-arg MOONCAKE_REPO="${MOONCAKE_REPO}" \
45+
--build-arg MOONCAKE_COMMIT="${MOONCAKE_COMMIT}" \
46+
"$@" \
47+
.

0 commit comments

Comments
 (0)