[NPU] Adapt cann 8.5: use sfa and lightning indexer op from cann and CI update (#17615)
Co-authored-by: Kelon <kelonlu@163.com>
This commit is contained in:
12
.github/workflows/nightly-test-npu.yml
vendored
12
.github/workflows/nightly-test-npu.yml
vendored
@@ -35,7 +35,7 @@ jobs:
|
||||
matrix:
|
||||
part: [0, 1]
|
||||
container:
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.3.rc2-a3-ubuntu22.04-py3.11
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.5.0-a3-ubuntu22.04-py3.11
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -70,7 +70,6 @@ jobs:
|
||||
PYTORCH_NPU_ALLOC_CONF: "expandable_segments:True"
|
||||
STREAMS_PER_DEVICE: 32
|
||||
run: |
|
||||
export PATH="/usr/local/Ascend/8.3.RC1/compiler/bishengir/bin:${PATH}"
|
||||
pip install sentence_transformers accelerate
|
||||
cd test
|
||||
python3 run_suite.py --hw npu --suite nightly-1-npu-a3 --nightly --continue-on-error --timeout-per-file 3600 --auto-partition-id ${{ matrix.part }} --auto-partition-size 2
|
||||
@@ -83,7 +82,7 @@ jobs:
|
||||
matrix:
|
||||
part: [0]
|
||||
container:
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.3.rc2-a3-ubuntu22.04-py3.11
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.5.0-a3-ubuntu22.04-py3.11
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -118,7 +117,6 @@ jobs:
|
||||
PYTORCH_NPU_ALLOC_CONF: "expandable_segments:True"
|
||||
STREAMS_PER_DEVICE: 32
|
||||
run: |
|
||||
export PATH="/usr/local/Ascend/8.3.RC1/compiler/bishengir/bin:${PATH}"
|
||||
pip install sentence_transformers accelerate
|
||||
cd test
|
||||
python3 run_suite.py --hw npu --suite nightly-2-npu-a3 --nightly --continue-on-error --timeout-per-file 3600 --auto-partition-id ${{ matrix.part }} --auto-partition-size 1
|
||||
@@ -131,7 +129,7 @@ jobs:
|
||||
matrix:
|
||||
part: [0]
|
||||
container:
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.3.rc2-a3-ubuntu22.04-py3.11
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.5.0-a3-ubuntu22.04-py3.11
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -144,8 +142,7 @@ jobs:
|
||||
CACHING_URL="cache-service.nginx-pypi-cache.svc.cluster.local"
|
||||
sed -Ei "s@(ports|archive).ubuntu.com@${CACHING_URL}:8081@g" /etc/apt/sources.list
|
||||
pip config set global.index-url http://${CACHING_URL}/pypi/simple
|
||||
pip config set global.extra-index-url "https://pypi.tuna.tsinghua.edu.cn/simple"
|
||||
pip config set global.trusted-host "${CACHING_URL} pypi.tuna.tsinghua.edu.cn"
|
||||
pip config set global.trusted-host "${CACHING_URL}"
|
||||
|
||||
bash scripts/ci/npu/npu_ci_install_dependency.sh a3
|
||||
# copy required file from our daily cache
|
||||
@@ -167,7 +164,6 @@ jobs:
|
||||
PYTORCH_NPU_ALLOC_CONF: "expandable_segments:True"
|
||||
STREAMS_PER_DEVICE: 32
|
||||
run: |
|
||||
export PATH="/usr/local/Ascend/8.3.RC1/compiler/bishengir/bin:${PATH}"
|
||||
hf download lmms-lab/MMMU --repo-type dataset
|
||||
pip install sentence_transformers torchaudio==2.8.0 torch_npu==2.8.0
|
||||
pip install protobuf==6.31.1 zss pre-commit wandb>=0.16.0 tenacity==8.3.0 loguru openpyxl latex2sympy2 zstandard transformers-stream-generator tqdm-multiprocess pycocoevalcap
|
||||
|
||||
12
.github/workflows/pr-test-npu.yml
vendored
12
.github/workflows/pr-test-npu.yml
vendored
@@ -79,7 +79,7 @@ jobs:
|
||||
if: needs.check-changes.outputs.main_package == 'true'
|
||||
runs-on: linux-aarch64-a2-1
|
||||
container:
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.3.rc2-910b-ubuntu22.04-py3.11
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.5.0-910b-ubuntu22.04-py3.11
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -111,7 +111,6 @@ jobs:
|
||||
PYTORCH_NPU_ALLOC_CONF: "expandable_segments:True"
|
||||
STREAMS_PER_DEVICE: 32
|
||||
run: |
|
||||
export PATH="/usr/local/Ascend/8.3.RC1/compiler/bishengir/bin:${PATH}"
|
||||
cd test/srt
|
||||
python3 run_suite.py --suite per-commit-1-npu-a2
|
||||
|
||||
@@ -124,7 +123,7 @@ jobs:
|
||||
matrix:
|
||||
part: [0, 1, 2]
|
||||
container:
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.3.rc2-910b-ubuntu22.04-py3.11
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.5.0-910b-ubuntu22.04-py3.11
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -156,7 +155,6 @@ jobs:
|
||||
PYTORCH_NPU_ALLOC_CONF: "expandable_segments:True"
|
||||
STREAMS_PER_DEVICE: 32
|
||||
run: |
|
||||
export PATH="/usr/local/Ascend/8.3.RC1/compiler/bishengir/bin:${PATH}"
|
||||
cd test/srt
|
||||
python3 run_suite.py --suite per-commit-2-npu-a2 --auto-partition-id ${{ matrix.part }} --auto-partition-size 3
|
||||
|
||||
@@ -165,7 +163,7 @@ jobs:
|
||||
if: needs.check-changes.outputs.main_package == 'true'
|
||||
runs-on: linux-aarch64-a2-4
|
||||
container:
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.3.rc2-910b-ubuntu22.04-py3.11
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.5.0-910b-ubuntu22.04-py3.11
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -197,7 +195,6 @@ jobs:
|
||||
PYTORCH_NPU_ALLOC_CONF: "expandable_segments:True"
|
||||
STREAMS_PER_DEVICE: 32
|
||||
run: |
|
||||
export PATH="/usr/local/Ascend/8.3.RC1/compiler/bishengir/bin:${PATH}"
|
||||
cd test/srt
|
||||
python3 run_suite.py --suite per-commit-4-npu-a2 --timeout-per-file 3600
|
||||
|
||||
@@ -210,7 +207,7 @@ jobs:
|
||||
matrix:
|
||||
part: [0, 1]
|
||||
container:
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.3.rc2-a3-ubuntu22.04-py3.11
|
||||
image: swr.cn-southwest-2.myhuaweicloud.com/base_image/ascend-ci/cann:8.5.0-a3-ubuntu22.04-py3.11
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -242,6 +239,5 @@ jobs:
|
||||
PYTORCH_NPU_ALLOC_CONF: "expandable_segments:True"
|
||||
STREAMS_PER_DEVICE: 32
|
||||
run: |
|
||||
export PATH="/usr/local/Ascend/8.3.RC1/compiler/bishengir/bin:${PATH}"
|
||||
cd test/srt
|
||||
python3 run_suite.py --suite per-commit-16-npu-a3 --timeout-per-file 3600 --auto-partition-id ${{ matrix.part }} --auto-partition-size 2
|
||||
|
||||
@@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04-arm
|
||||
strategy:
|
||||
matrix:
|
||||
cann_version: ["8.3.rc2"]
|
||||
cann_version: ["8.5.0"]
|
||||
device_type: ["910b", "a3"]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -67,6 +67,6 @@ jobs:
|
||||
push: ${{ github.repository == 'sgl-project/sglang' && github.event_name != 'pull_request' }}
|
||||
provenance: false
|
||||
build-args: |
|
||||
SGLANG_KERNEL_NPU_TAG=2025.12.31
|
||||
SGLANG_KERNEL_NPU_TAG=2026.01.21
|
||||
CANN_VERSION=${{ matrix.cann_version }}
|
||||
DEVICE_TYPE=${{ matrix.device_type }}
|
||||
|
||||
4
.github/workflows/release-docker-npu.yml
vendored
4
.github/workflows/release-docker-npu.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04-arm
|
||||
strategy:
|
||||
matrix:
|
||||
cann_version: ["8.3.rc2"]
|
||||
cann_version: ["8.5.0"]
|
||||
device_type: ["910b", "a3"]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
push: ${{ github.repository == 'sgl-project/sglang' && github.event_name != 'pull_request' }}
|
||||
provenance: false
|
||||
build-args: |
|
||||
SGLANG_KERNEL_NPU_TAG=2025.12.31
|
||||
SGLANG_KERNEL_NPU_TAG=2026.01.21
|
||||
CANN_VERSION=${{ matrix.cann_version }}
|
||||
DEVICE_TYPE=${{ matrix.device_type }}
|
||||
SGLANG_TAG=${{ steps.version.outputs.version }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ARG CANN_VERSION=8.3.rc2
|
||||
ARG CANN_VERSION=8.5.0
|
||||
ARG DEVICE_TYPE=a3
|
||||
ARG OS=ubuntu22.04
|
||||
ARG PYTHON_VERSION=py3.11
|
||||
@@ -6,14 +6,13 @@ ARG PYTHON_VERSION=py3.11
|
||||
FROM quay.io/ascend/cann:$CANN_VERSION-$DEVICE_TYPE-$OS-$PYTHON_VERSION
|
||||
|
||||
# Update pip & apt sources
|
||||
ARG CANN_VERSION
|
||||
ARG DEVICE_TYPE
|
||||
ARG PIP_INDEX_URL="https://pypi.org/simple/"
|
||||
ARG APTMIRROR=""
|
||||
ARG PYTORCH_VERSION="2.8.0"
|
||||
ARG TORCHVISION_VERSION="0.23.0"
|
||||
ARG PTA_URL="https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/sglang/torch_npu/torch_npu-2.8.0.post2.dev20251113-cp311-cp311-manylinux_2_28_aarch64.whl"
|
||||
ARG TRITON_ASCEND_URL="https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/sglang/triton_ascend/triton_ascend-3.2.0.dev2025112116-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl"
|
||||
ARG BISHENG_NAME="Ascend-BiSheng-toolkit_aarch64_20251121.run"
|
||||
ARG BISHENG_URL="https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/sglang/triton_ascend/${BISHENG_NAME}"
|
||||
ARG PTA_URL="https://gitcode.com/Ascend/pytorch/releases/download/v7.3.0-pytorch2.8.0/torch_npu-2.8.0.post2-cp311-cp311-manylinux_2_28_aarch64.whl"
|
||||
ARG SGLANG_TAG=main
|
||||
ARG ASCEND_CANN_PATH=/usr/local/Ascend/ascend-toolkit
|
||||
ARG SGLANG_KERNEL_NPU_TAG=main
|
||||
@@ -31,6 +30,7 @@ RUN if [ -n "$APTMIRROR" ];then sed -i "s|.*.ubuntu.com|$APTMIRROR|g" /etc/apt/s
|
||||
|
||||
# Install development tools and utilities
|
||||
RUN apt-get update -y && apt upgrade -y && apt-get install -y \
|
||||
unzip \
|
||||
build-essential \
|
||||
cmake \
|
||||
vim \
|
||||
@@ -57,7 +57,7 @@ ENV LC_ALL=en_US.UTF-8
|
||||
|
||||
|
||||
### Install MemFabric
|
||||
RUN ${PIP_INSTALL} memfabric-hybrid==1.0.0
|
||||
RUN ${PIP_INSTALL} memfabric-hybrid==1.0.5
|
||||
### Install SGLang Model Gateway
|
||||
RUN ${PIP_INSTALL} sglang-router
|
||||
|
||||
@@ -69,7 +69,7 @@ RUN (${PIP_INSTALL} torch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION
|
||||
|
||||
# TODO: install from pypi released triton-ascend
|
||||
RUN (${PIP_INSTALL} pybind11) \
|
||||
&& (${PIP_INSTALL} ${TRITON_ASCEND_URL})
|
||||
&& (${PIP_INSTALL} triton-ascend)
|
||||
|
||||
# Install SGLang
|
||||
RUN git clone https://github.com/sgl-project/sglang --branch $SGLANG_TAG && \
|
||||
@@ -78,23 +78,13 @@ RUN git clone https://github.com/sgl-project/sglang --branch $SGLANG_TAG && \
|
||||
|
||||
# Install Deep-ep
|
||||
# pin wheel to 0.45.1 ref: https://github.com/pypa/wheel/issues/662
|
||||
RUN ${PIP_INSTALL} wheel==0.45.1 && git clone --branch $SGLANG_KERNEL_NPU_TAG https://github.com/sgl-project/sgl-kernel-npu.git \
|
||||
&& export LD_LIBRARY_PATH=${ASCEND_CANN_PATH}/latest/runtime/lib64/stub:$LD_LIBRARY_PATH && \
|
||||
source ${ASCEND_CANN_PATH}/set_env.sh && \
|
||||
cd sgl-kernel-npu && \
|
||||
bash build.sh \
|
||||
RUN ${PIP_INSTALL} wheel==0.45.1 pybind11 pyyaml decorator scipy attrs psutil \
|
||||
&& mkdir sgl-kernel-npu \
|
||||
&& cd sgl-kernel-npu \
|
||||
&& wget https://github.com/sgl-project/sgl-kernel-npu/releases/download/${SGLANG_KERNEL_NPU_TAG}/sgl-kernel-npu_${SGLANG_KERNEL_NPU_TAG}_${CANN_VERSION}_${DEVICE_TYPE}.zip \
|
||||
&& unzip sgl-kernel-npu_${SGLANG_KERNEL_NPU_TAG}_${CANN_VERSION}_${DEVICE_TYPE}.zip \
|
||||
&& ${PIP_INSTALL} output/deep_ep*.whl output/sgl_kernel_npu*.whl \
|
||||
&& cd .. && rm -rf sgl-kernel-npu \
|
||||
&& cd "$(python3 -m pip show deep-ep | awk '/^Location:/ {print $2}')" && ln -s deep_ep/deep_ep_cpp*.so
|
||||
|
||||
# Install CustomOps
|
||||
RUN wget https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/ops/CANN-custom_ops-8.2.0.0-$DEVICE_TYPE-linux.aarch64.run && \
|
||||
chmod a+x ./CANN-custom_ops-8.2.0.0-$DEVICE_TYPE-linux.aarch64.run && \
|
||||
./CANN-custom_ops-8.2.0.0-$DEVICE_TYPE-linux.aarch64.run --quiet --install-path=/usr/local/Ascend/ascend-toolkit/latest/opp && \
|
||||
wget https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/ops/custom_ops-1.0.$DEVICE_TYPE-cp311-cp311-linux_aarch64.whl && \
|
||||
${PIP_INSTALL} ./custom_ops-1.0.$DEVICE_TYPE-cp311-cp311-linux_aarch64.whl
|
||||
|
||||
# Install Bisheng
|
||||
RUN wget -O "${BISHENG_NAME}" "${BISHENG_URL}" && chmod a+x "${BISHENG_NAME}" && "./${BISHENG_NAME}" --install && rm "${BISHENG_NAME}"
|
||||
&& cd "$(python3 -m pip show deep-ep | awk '/^Location:/ {print $2}')" && ln -sf deep_ep/deep_ep_cpp*.so
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
|
||||
@@ -546,7 +546,7 @@ class AscendAttnBackend(AttentionBackend):
|
||||
actual_seq_qlen_prev, actual_seq_qlen_next = actual_seq_qlen
|
||||
actual_seq_lengths_kv_prev, actual_seq_lengths_kv_next = actual_seq_lengths_kv
|
||||
|
||||
attn_out_prev = torch.ops.custom.npu_sparse_flash_attention(
|
||||
attn_out_prev, _, _ = torch_npu.npu_sparse_flash_attention(
|
||||
query=q_nope_prev,
|
||||
key=k_nope,
|
||||
value=k_nope,
|
||||
@@ -565,8 +565,10 @@ class AscendAttnBackend(AttentionBackend):
|
||||
layout_query="TND",
|
||||
layout_kv="PA_BSND",
|
||||
sparse_mode=3,
|
||||
attention_mode=2,
|
||||
return_softmax_lse=False,
|
||||
)
|
||||
attn_out_next = torch.ops.custom.npu_sparse_flash_attention(
|
||||
attn_out_next, _, _ = torch_npu.npu_sparse_flash_attention(
|
||||
query=q_nope_next,
|
||||
key=k_nope,
|
||||
value=k_nope,
|
||||
@@ -585,6 +587,8 @@ class AscendAttnBackend(AttentionBackend):
|
||||
layout_query="TND",
|
||||
layout_kv="PA_BSND",
|
||||
sparse_mode=3,
|
||||
attention_mode=2,
|
||||
return_softmax_lse=False,
|
||||
)
|
||||
return torch.cat([attn_out_prev, attn_out_next], dim=0)
|
||||
|
||||
@@ -675,7 +679,7 @@ class AscendAttnBackend(AttentionBackend):
|
||||
actual_seq_lengths_kv,
|
||||
)
|
||||
else:
|
||||
attn_out = torch.ops.custom.npu_sparse_flash_attention(
|
||||
attn_out, _, _ = torch_npu.npu_sparse_flash_attention(
|
||||
query=q_nope,
|
||||
key=k_nope,
|
||||
value=k_nope,
|
||||
@@ -694,6 +698,8 @@ class AscendAttnBackend(AttentionBackend):
|
||||
layout_query="TND",
|
||||
layout_kv="PA_BSND",
|
||||
sparse_mode=3,
|
||||
attention_mode=2,
|
||||
return_softmax_lse=False,
|
||||
)
|
||||
|
||||
return attn_out
|
||||
|
||||
@@ -92,14 +92,6 @@ def init_npu_backend():
|
||||
assert _is_npu, "NPU backend initialization called on non-NPU device."
|
||||
|
||||
import sgl_kernel_npu # noqa: F401
|
||||
|
||||
try:
|
||||
import custom_ops # noqa: F401
|
||||
except ImportError:
|
||||
logger.warning(
|
||||
f"custom_ops not found, dsv3.2 requires this package, which includes the npu_lightning_indexer and npu_sparse_flash_attention operators."
|
||||
)
|
||||
|
||||
import torch_npu
|
||||
from torch_npu.contrib import transfer_to_npu # noqa: F401
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ if _is_cuda:
|
||||
except ImportError as e:
|
||||
deep_gemm = e
|
||||
|
||||
if _is_npu:
|
||||
import custom_ops # noqa: F401
|
||||
if is_npu():
|
||||
import torch_npu
|
||||
from sglang.srt.hardware_backend.npu.utils import get_indexer_weight_stream
|
||||
|
||||
@@ -1277,6 +1276,7 @@ class Indexer(MultiPlatformOp):
|
||||
actual_seq_lengths_kv,
|
||||
block_table,
|
||||
)
|
||||
return topk_indices
|
||||
else:
|
||||
block_table = (
|
||||
block_table[: actual_seq_lengths_q.size()[0]]
|
||||
@@ -1284,7 +1284,7 @@ class Indexer(MultiPlatformOp):
|
||||
else block_table
|
||||
)
|
||||
|
||||
topk_indices = torch.ops.custom.npu_lightning_indexer(
|
||||
topk_indices = torch_npu.npu_lightning_indexer(
|
||||
query=q.view(-1, self.n_heads, self.head_dim),
|
||||
key=past_key_states,
|
||||
weights=weights,
|
||||
@@ -1298,8 +1298,7 @@ class Indexer(MultiPlatformOp):
|
||||
sparse_count=self.index_topk,
|
||||
sparse_mode=3,
|
||||
)
|
||||
|
||||
return topk_indices
|
||||
return topk_indices[0]
|
||||
|
||||
def do_npu_cp_balance_indexer(
|
||||
self,
|
||||
@@ -1322,7 +1321,7 @@ class Indexer(MultiPlatformOp):
|
||||
actual_seq_lengths_q_prev, actual_seq_lengths_q_next = actual_seq_lengths_q
|
||||
actual_seq_lengths_kv_prev, actual_seq_lengths_kv_next = actual_seq_lengths_kv
|
||||
|
||||
topk_indices_prev = torch.ops.custom.npu_lightning_indexer(
|
||||
topk_indices_prev = torch_npu.npu_lightning_indexer(
|
||||
query=q_prev,
|
||||
key=past_key_states,
|
||||
weights=weights_prev,
|
||||
@@ -1338,7 +1337,7 @@ class Indexer(MultiPlatformOp):
|
||||
sparse_count=self.index_topk,
|
||||
sparse_mode=3,
|
||||
)
|
||||
topk_indices_next = torch.ops.custom.npu_lightning_indexer(
|
||||
topk_indices_next = torch_npu.npu_lightning_indexer(
|
||||
query=q_next,
|
||||
key=past_key_states,
|
||||
weights=weights_next,
|
||||
@@ -1354,4 +1353,4 @@ class Indexer(MultiPlatformOp):
|
||||
sparse_count=self.index_topk,
|
||||
sparse_mode=3,
|
||||
)
|
||||
return topk_indices_prev, topk_indices_next
|
||||
return topk_indices_prev[0], topk_indices_next[0]
|
||||
|
||||
@@ -7,6 +7,7 @@ DEVICE_TYPE=$1
|
||||
|
||||
# Install the required dependencies in CI.
|
||||
apt update -y && apt install -y \
|
||||
unzip \
|
||||
build-essential \
|
||||
cmake \
|
||||
wget \
|
||||
@@ -23,46 +24,34 @@ apt update -y && apt install -y \
|
||||
update-ca-certificates
|
||||
${PIP_INSTALL} --upgrade pip
|
||||
# Pin wheel to 0.45.1, REF: https://github.com/pypa/wheel/issues/662
|
||||
${PIP_INSTALL} wheel==0.45.1 pybind11
|
||||
${PIP_INSTALL} wheel==0.45.1 pybind11 pyyaml decorator scipy attrs psutil
|
||||
|
||||
|
||||
### Install MemFabric
|
||||
${PIP_INSTALL} memfabric-hybrid==1.0.0
|
||||
${PIP_INSTALL} memfabric-hybrid==1.0.5
|
||||
|
||||
|
||||
### Install PyTorch and PTA
|
||||
PYTORCH_VERSION="2.8.0"
|
||||
TORCHVISION_VERSION="0.23.0"
|
||||
${PIP_INSTALL} torch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION} --index-url https://download.pytorch.org/whl/cpu
|
||||
|
||||
PTA_URL="https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/sglang/torch_npu/torch_npu-2.8.0.post2.dev20251113-cp311-cp311-manylinux_2_28_aarch64.whl"
|
||||
PTA_URL="https://gitcode.com/Ascend/pytorch/releases/download/v7.3.0-pytorch2.8.0/torch_npu-2.8.0.post2-cp311-cp311-manylinux_2_28_aarch64.whl"
|
||||
${PIP_INSTALL} ${PTA_URL}
|
||||
|
||||
|
||||
### Install Triton-Ascend
|
||||
TRITON_ASCEND_URL="https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/sglang/triton_ascend/triton_ascend-3.2.0.dev2025112116-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl"
|
||||
${PIP_INSTALL} ${TRITON_ASCEND_URL}
|
||||
|
||||
|
||||
### Install BiSheng
|
||||
BISHENG_NAME="Ascend-BiSheng-toolkit_aarch64_20251121.run"
|
||||
BISHENG_URL="https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/sglang/triton_ascend/${BISHENG_NAME}"
|
||||
wget -O "${BISHENG_NAME}" "${BISHENG_URL}" && chmod a+x "${BISHENG_NAME}" && "./${BISHENG_NAME}" --install && rm "${BISHENG_NAME}"
|
||||
${PIP_INSTALL} triton-ascend
|
||||
|
||||
|
||||
### Install sgl-kernel-npu
|
||||
SGL_KERNEL_NPU_TAG="2025.12.31"
|
||||
git clone --depth 1 https://github.com/sgl-project/sgl-kernel-npu.git --branch ${SGL_KERNEL_NPU_TAG}
|
||||
(cd sgl-kernel-npu && bash ./build.sh && ${PIP_INSTALL} output/deep_ep*.whl output/sgl_kernel_npu*.whl && cd "$(python3 -m pip show deep-ep | grep -E '^Location:' | awk '{print $2}')" && ln -s deep_ep/deep_ep_cpp*.so)
|
||||
SGLANG_KERNEL_NPU_TAG="2026.01.21"
|
||||
mkdir sgl-kernel-npu
|
||||
(cd sgl-kernel-npu && wget https://github.com/sgl-project/sgl-kernel-npu/releases/download/${SGLANG_KERNEL_NPU_TAG}/sgl-kernel-npu_${SGLANG_KERNEL_NPU_TAG}_8.5.0_${DEVICE_TYPE}.zip \
|
||||
&& unzip sgl-kernel-npu_${SGLANG_KERNEL_NPU_TAG}_8.5.0_${DEVICE_TYPE}.zip \
|
||||
&& ${PIP_INSTALL} output/deep_ep*.whl output/sgl_kernel_npu*.whl \
|
||||
&& (cd "$(python3 -m pip show deep-ep | grep -E '^Location:' | awk '{print $2}')" && ln -s deep_ep/deep_ep_cpp*.so))
|
||||
|
||||
|
||||
### Install CustomOps (TODO: to be removed once merged into sgl-kernel-npu)
|
||||
wget https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/ops/CANN-custom_ops-8.2.0.0-$DEVICE_TYPE-linux.aarch64.run
|
||||
chmod a+x ./CANN-custom_ops-8.2.0.0-$DEVICE_TYPE-linux.aarch64.run
|
||||
./CANN-custom_ops-8.2.0.0-$DEVICE_TYPE-linux.aarch64.run --quiet --install-path=/usr/local/Ascend/ascend-toolkit/latest/opp
|
||||
wget https://sglang-ascend.obs.cn-east-3.myhuaweicloud.com/ops/custom_ops-1.0.$DEVICE_TYPE-cp311-cp311-linux_aarch64.whl
|
||||
pip install ./custom_ops-1.0.$DEVICE_TYPE-cp311-cp311-linux_aarch64.whl
|
||||
|
||||
### Install SGLang
|
||||
rm -rf python/pyproject.toml && mv python/pyproject_npu.toml python/pyproject.toml
|
||||
${PIP_INSTALL} -v -e "python[dev_npu]"
|
||||
|
||||
Reference in New Issue
Block a user