[NPU] add support for npu x86_64 image release (#14127)
Signed-off-by: 22dimensions <waitingwind@foxmail.com>
This commit is contained in:
@@ -52,6 +52,14 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
# Enable Docker multi-architecture build environment
|
||||||
|
# Emulate non-native architectures
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
# Required for building and pushing multi-arch Docker images
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
# Build and push Docker image with Buildx (don't push on PR)
|
# Build and push Docker image with Buildx (don't push on PR)
|
||||||
# https://github.com/docker/build-push-action
|
# https://github.com/docker/build-push-action
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
@@ -60,13 +68,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: docker
|
context: docker
|
||||||
file: docker/npu.Dockerfile
|
file: docker/npu.Dockerfile
|
||||||
# TODO: need add x86 platforms support when memfabric is ready
|
platforms: linux/arm64,linux/amd64
|
||||||
platforms: linux/arm64
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
push: ${{ github.repository == 'sgl-project/sglang' && github.event_name != 'pull_request' }}
|
push: ${{ github.repository == 'sgl-project/sglang' && github.event_name != 'pull_request' }}
|
||||||
provenance: false
|
provenance: false
|
||||||
build-args: |
|
build-args: |
|
||||||
SGLANG_KERNEL_NPU_TAG=2026.01.21
|
SGLANG_KERNEL_NPU_TAG=2026.01.28
|
||||||
CANN_VERSION=${{ matrix.cann_version }}
|
CANN_VERSION=${{ matrix.cann_version }}
|
||||||
DEVICE_TYPE=${{ matrix.device_type }}
|
DEVICE_TYPE=${{ matrix.device_type }}
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "version=v${VERSION}" >> $GITHUB_OUTPUT
|
echo "version=v${VERSION}" >> $GITHUB_OUTPUT
|
||||||
echo "TAG=lmsysorg/sglang:v${VERSION}-cann${{ matrix.cann_version }}-${{ matrix.device_type }}" >> $GITHUB_OUTPUT
|
echo "TAG=lmsysorg/sglang:v${VERSION}-cann${{ matrix.cann_version }}-${{ matrix.device_type }}" >> $GITHUB_OUTPUT
|
||||||
|
# Enable Docker multi-architecture build environment
|
||||||
|
# Emulate non-native architectures
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
# Required for building and pushing multi-arch Docker images
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: build-and-push
|
id: build-and-push
|
||||||
@@ -74,14 +81,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: docker
|
context: docker
|
||||||
file: docker/npu.Dockerfile
|
file: docker/npu.Dockerfile
|
||||||
# TODO: need add x86 platforms support when memfabric is ready
|
platforms: linux/arm64,linux/amd64
|
||||||
platforms: linux/arm64
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
tags: ${{ steps.meta.outputs.tags || steps.version.outputs.TAG }}
|
tags: ${{ steps.meta.outputs.tags || steps.version.outputs.TAG }}
|
||||||
push: ${{ github.repository == 'sgl-project/sglang' && github.event_name != 'pull_request' }}
|
push: ${{ github.repository == 'sgl-project/sglang' && github.event_name != 'pull_request' }}
|
||||||
provenance: false
|
provenance: false
|
||||||
build-args: |
|
build-args: |
|
||||||
SGLANG_KERNEL_NPU_TAG=2026.01.21
|
SGLANG_KERNEL_NPU_TAG=2026.01.28
|
||||||
CANN_VERSION=${{ matrix.cann_version }}
|
CANN_VERSION=${{ matrix.cann_version }}
|
||||||
DEVICE_TYPE=${{ matrix.device_type }}
|
DEVICE_TYPE=${{ matrix.device_type }}
|
||||||
SGLANG_TAG=${{ steps.version.outputs.version }}
|
SGLANG_TAG=${{ steps.version.outputs.version }}
|
||||||
|
|||||||
+17
-5
@@ -6,13 +6,15 @@ ARG PYTHON_VERSION=py3.11
|
|||||||
FROM quay.io/ascend/cann:$CANN_VERSION-$DEVICE_TYPE-$OS-$PYTHON_VERSION
|
FROM quay.io/ascend/cann:$CANN_VERSION-$DEVICE_TYPE-$OS-$PYTHON_VERSION
|
||||||
|
|
||||||
# Update pip & apt sources
|
# Update pip & apt sources
|
||||||
|
ARG TARGETARCH
|
||||||
ARG CANN_VERSION
|
ARG CANN_VERSION
|
||||||
ARG DEVICE_TYPE
|
ARG DEVICE_TYPE
|
||||||
ARG PIP_INDEX_URL="https://pypi.org/simple/"
|
ARG PIP_INDEX_URL="https://pypi.org/simple/"
|
||||||
ARG APTMIRROR=""
|
ARG APTMIRROR=""
|
||||||
ARG PYTORCH_VERSION="2.8.0"
|
ARG PYTORCH_VERSION="2.8.0"
|
||||||
ARG TORCHVISION_VERSION="0.23.0"
|
ARG TORCHVISION_VERSION="0.23.0"
|
||||||
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 PTA_URL_ARM64="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 PTA_URL_AMD64="https://gitcode.com/Ascend/pytorch/releases/download/v7.3.0-pytorch2.8.0/torch_npu-2.8.0.post2-cp311-cp311-manylinux_2_28_x86_64.whl"
|
||||||
ARG SGLANG_TAG=main
|
ARG SGLANG_TAG=main
|
||||||
ARG ASCEND_CANN_PATH=/usr/local/Ascend/ascend-toolkit
|
ARG ASCEND_CANN_PATH=/usr/local/Ascend/ascend-toolkit
|
||||||
ARG SGLANG_KERNEL_NPU_TAG=main
|
ARG SGLANG_KERNEL_NPU_TAG=main
|
||||||
@@ -20,6 +22,16 @@ ARG SGLANG_KERNEL_NPU_TAG=main
|
|||||||
ARG PIP_INSTALL="python3 -m pip install --no-cache-dir"
|
ARG PIP_INSTALL="python3 -m pip install --no-cache-dir"
|
||||||
ARG DEVICE_TYPE
|
ARG DEVICE_TYPE
|
||||||
|
|
||||||
|
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
||||||
|
echo "Using x86_64 dependencies"; \
|
||||||
|
echo "PTA_URL=$PTA_URL_AMD64" >> /etc/environment_new; \
|
||||||
|
elif [ "$TARGETARCH" = "arm64" ]; then \
|
||||||
|
echo "Using aarch64 dependencies"; \
|
||||||
|
echo "PTA_URL=$PTA_URL_ARM64" >> /etc/environment_new; \
|
||||||
|
else \
|
||||||
|
echo "Unsupported TARGETARCH: $TARGETARCH"; exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
|
|
||||||
# Define environments
|
# Define environments
|
||||||
@@ -63,13 +75,13 @@ RUN ${PIP_INSTALL} sglang-router
|
|||||||
|
|
||||||
|
|
||||||
### Install PyTorch and PTA
|
### Install PyTorch and PTA
|
||||||
RUN (${PIP_INSTALL} torch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION} --index-url https://download.pytorch.org/whl/cpu) \
|
RUN . /etc/environment_new && \
|
||||||
|
(${PIP_INSTALL} torch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION} --index-url https://download.pytorch.org/whl/cpu) \
|
||||||
&& (${PIP_INSTALL} ${PTA_URL})
|
&& (${PIP_INSTALL} ${PTA_URL})
|
||||||
|
|
||||||
|
|
||||||
# TODO: install from pypi released triton-ascend
|
## Install triton-ascend
|
||||||
RUN (${PIP_INSTALL} pybind11) \
|
RUN (${PIP_INSTALL} pybind11 triton-ascend)
|
||||||
&& (${PIP_INSTALL} triton-ascend)
|
|
||||||
|
|
||||||
# Install SGLang
|
# Install SGLang
|
||||||
RUN git clone https://github.com/sgl-project/sglang --branch $SGLANG_TAG && \
|
RUN git clone https://github.com/sgl-project/sglang --branch $SGLANG_TAG && \
|
||||||
|
|||||||
Reference in New Issue
Block a user