diff --git a/.github/workflows/release-docker-npu-nightly.yml b/.github/workflows/release-docker-npu-nightly.yml index e798bfa0f..df5db619d 100644 --- a/.github/workflows/release-docker-npu-nightly.yml +++ b/.github/workflows/release-docker-npu-nightly.yml @@ -52,6 +52,14 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} 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) # https://github.com/docker/build-push-action - name: Build and push Docker image @@ -60,13 +68,12 @@ jobs: with: context: docker file: docker/npu.Dockerfile - # TODO: need add x86 platforms support when memfabric is ready - platforms: linux/arm64 + platforms: linux/arm64,linux/amd64 labels: ${{ steps.meta.outputs.labels }} tags: ${{ steps.meta.outputs.tags }} push: ${{ github.repository == 'sgl-project/sglang' && github.event_name != 'pull_request' }} provenance: false build-args: | - SGLANG_KERNEL_NPU_TAG=2026.01.21 + SGLANG_KERNEL_NPU_TAG=2026.01.28 CANN_VERSION=${{ matrix.cann_version }} DEVICE_TYPE=${{ matrix.device_type }} diff --git a/.github/workflows/release-docker-npu.yml b/.github/workflows/release-docker-npu.yml index 2bd8f1490..12f960949 100644 --- a/.github/workflows/release-docker-npu.yml +++ b/.github/workflows/release-docker-npu.yml @@ -67,6 +67,13 @@ jobs: fi echo "version=v${VERSION}" >> $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 id: build-and-push @@ -74,14 +81,13 @@ jobs: with: context: docker file: docker/npu.Dockerfile - # TODO: need add x86 platforms support when memfabric is ready - platforms: linux/arm64 + platforms: linux/arm64,linux/amd64 labels: ${{ steps.meta.outputs.labels }} tags: ${{ steps.meta.outputs.tags || steps.version.outputs.TAG }} push: ${{ github.repository == 'sgl-project/sglang' && github.event_name != 'pull_request' }} provenance: false build-args: | - SGLANG_KERNEL_NPU_TAG=2026.01.21 + SGLANG_KERNEL_NPU_TAG=2026.01.28 CANN_VERSION=${{ matrix.cann_version }} DEVICE_TYPE=${{ matrix.device_type }} SGLANG_TAG=${{ steps.version.outputs.version }} diff --git a/docker/npu.Dockerfile b/docker/npu.Dockerfile index 8f5c065e9..fa42318bb 100644 --- a/docker/npu.Dockerfile +++ b/docker/npu.Dockerfile @@ -6,13 +6,15 @@ ARG PYTHON_VERSION=py3.11 FROM quay.io/ascend/cann:$CANN_VERSION-$DEVICE_TYPE-$OS-$PYTHON_VERSION # Update pip & apt sources +ARG TARGETARCH 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://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 ASCEND_CANN_PATH=/usr/local/Ascend/ascend-toolkit 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 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 # Define environments @@ -63,13 +75,13 @@ RUN ${PIP_INSTALL} sglang-router ### 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}) -# TODO: install from pypi released triton-ascend -RUN (${PIP_INSTALL} pybind11) \ - && (${PIP_INSTALL} triton-ascend) +## Install triton-ascend +RUN (${PIP_INSTALL} pybind11 triton-ascend) # Install SGLang RUN git clone https://github.com/sgl-project/sglang --branch $SGLANG_TAG && \