Files
sglang/.github/workflows/release-whl-deepgemm.yml

265 lines
9.6 KiB
YAML

name: Release sgl-deep-gemm
on:
workflow_dispatch:
inputs:
version:
description: "Wheel version (e.g. 0.1.0, 0.1.1rc0)"
type: string
required: true
target:
type: choice
description: "Build target (default: all)"
required: false
default: 'all'
options:
- 'all'
- 'cu130'
branch:
description: "DeepGEMM branch to build from (default: dev)"
type: string
required: false
default: 'dev'
validation_only:
description: "Build and test without publishing wheels"
type: boolean
required: false
default: false
concurrency:
group: release-sgl-deepgemm-${{ github.ref }}
cancel-in-progress: true
env:
NCCL_NVLS_ENABLE: "0"
# Must match TORCH_VER in docker/sgl-deep-gemm.Dockerfile — the wheel's
# pre-compiled _C.so links against this torch ABI.
TORCH_VER: "2.13.0"
jobs:
build-cu130-matrix:
if: |
github.repository == 'sgl-project/sglang' &&
(github.event.inputs.target == 'all' || github.event.inputs.target == 'cu130')
strategy:
matrix:
python-version: ["3.12"]
cuda-version: ["13.0"]
arch: [x86_64, aarch64]
include:
- arch: x86_64
runner: x64-kernel-build-node
- arch: aarch64
runner: arm-kernel-build-node
runs-on: ${{ matrix.runner }}
steps:
- name: Clean workspace (remove root-owned files from prior runs)
run: |
docker run --rm -v "${{ github.workspace }}:/workspace" alpine:3 \
sh -c 'rm -rf /workspace/..?* /workspace/.[!.]* /workspace/*' || true
- uses: actions/checkout@v4
- name: Checkout DeepGEMM
uses: actions/checkout@v4
with:
repository: sgl-project/DeepGEMM
ref: ${{ inputs.branch || 'dev' }}
path: DeepGEMM
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set wheel version
run: |
echo -n "${{ inputs.version }}" > DeepGEMM/sgl_deep_gemm/VERSION
cat DeepGEMM/sgl_deep_gemm/VERSION
- name: Build wheel
run: |
chmod +x ./scripts/build_sgl_deep_gemm.sh ./scripts/rename_sgl_deep_gemm_whl.sh
./scripts/build_sgl_deep_gemm.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}" "${{ github.workspace }}/DeepGEMM" "${{ matrix.arch }}"
# PyPI upload moved to release-cu130 so it is gated on test-cu130.
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: deepgemm-wheel-cuda${{ matrix.cuda-version }}-${{ matrix.arch }}
path: DeepGEMM/dist/*.whl
- name: Upload PyPI artifacts
uses: actions/upload-artifact@v4
with:
name: deepgemm-pypi-cuda${{ matrix.cuda-version }}-${{ matrix.arch }}
path: DeepGEMM/dist-pypi/*.whl
test-cu130:
needs: build-cu130-matrix
strategy:
fail-fast: false
matrix:
include:
- arch_label: sm90
runner: 8-gpu-h200
wheel_arch: x86_64
timeout: 60
- arch_label: sm100
runner: 8-gpu-b200
wheel_arch: x86_64
timeout: 60
# The sm120 tests require a runner with RTX 6000. It causes OOM on 5090 runners.
# - arch_label: sm120
# runner: 1-gpu-5090
# wheel_arch: x86_64
- arch_label: sm100-aarch64
runner: 4-gpu-gb300
wheel_arch: aarch64
timeout: 60
runs-on: ${{ matrix.runner }}
timeout-minutes: ${{ matrix.timeout }}
steps:
- uses: actions/checkout@v4
- name: Checkout DeepGEMM
uses: actions/checkout@v4
with:
repository: sgl-project/DeepGEMM
ref: ${{ inputs.branch || 'dev' }}
path: DeepGEMM
submodules: recursive
- name: Download wheel
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
pattern: deepgemm-wheel-cuda13.0-${{ matrix.wheel_arch }}
- name: Install wheel and deps
env:
CU_TAG: cu130
run: |
python3 -m pip install --upgrade pip
# deep_gemm imports torch before loading _C.so, so torch must preload the
# libcudart the cu130 wheel links. Pin the CUDA-matched torch (see sgl-deep-gemm.Dockerfile).
python3 -m pip install "torch==${TORCH_VER}" --index-url "https://download.pytorch.org/whl/${CU_TAG}" --force-reinstall
python3 -m pip install numpy "tilelang==0.1.9" "tile-kernels==1.0.0" "sgl-deep-ep==0.1.2"
python3 -m pip install dist/*.whl
# Torch pins NCCL 2.29.7, but this DeepEP wheel requires 2.30.7.
# Override it after every dependency-resolving pip command.
python3 -m pip install "nvidia-nccl-cu13==2.30.7" --force-reinstall --no-deps
nccl_lib=$(python3 -c "from importlib.metadata import distribution; print(distribution('nvidia-nccl-cu13').locate_file('nvidia/nccl/lib'))")
export LD_LIBRARY_PATH="${nccl_lib}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> "${GITHUB_ENV}"
python3 -c "import deep_gemm; print('deep_gemm:', deep_gemm.__file__)"
python3 - <<'PY'
import ctypes
import sys
import torch
import deep_ep
from tile_kernels.moe import top2_sum_gate
# torch.cuda.nccl.version() reports Torch's compiled version, not the loaded library.
nccl_version = ctypes.c_int()
assert ctypes.CDLL("libnccl.so.2").ncclGetVersion(ctypes.byref(nccl_version)) == 0
assert nccl_version.value == 23007, nccl_version.value
assert hasattr(deep_ep, "ElasticBuffer"), "DeepEP ElasticBuffer is required"
sys.path.insert(0, "DeepGEMM/third-party")
from tilelang_ops import ref_mhc
assert ref_mhc.has_baseline(), "Mega mHC reference operators are unavailable"
print("DeepGEMM test dependencies ready; NCCL:", nccl_version.value)
PY
- name: Install Compute Sanitizer 2025.4.1
env:
WHEEL_ARCH: ${{ matrix.wheel_arch }}
run: |
set -euo pipefail
# CUDA 13.1.1's standalone sanitizer fixes Python tensor retention in
# host backtraces. Keep the wheel and runtime on CUDA 13.0.
case "${WHEEL_ARCH}" in
x86_64)
sanitizer_arch=linux-x86_64
sanitizer_sha256=b9637777a31cd0f0ffe1e965523e8b0d382019b8496855fd688c886988583cf4
;;
aarch64)
sanitizer_arch=linux-sbsa
sanitizer_sha256=1dc68ccb146032bcdc9d932569c865d68e3966ecf136940ca38fd7d5abfda4ac
;;
*) echo "Unsupported sanitizer architecture: ${WHEEL_ARCH}" >&2; exit 1 ;;
esac
archive="cuda_sanitizer_api-${sanitizer_arch}-13.1.118-archive"
install_dir="${RUNNER_TEMP}/deepgemm-compute-sanitizer"
mkdir -p "${install_dir}"
curl -fsSL --retry 3 \
"https://developer.download.nvidia.com/compute/cuda/redist/cuda_sanitizer_api/${sanitizer_arch}/${archive}.tar.xz" \
-o "${install_dir}/${archive}.tar.xz"
echo "${sanitizer_sha256} ${install_dir}/${archive}.tar.xz" | sha256sum -c -
tar -xJf "${install_dir}/${archive}.tar.xz" -C "${install_dir}"
sanitizer="${install_dir}/${archive}/bin/compute-sanitizer"
"${sanitizer}" --version
echo "COMPUTE_SANITIZER=${sanitizer}" >> "${GITHUB_ENV}"
- name: Run DeepGEMM test suite
env:
# Each runner is a single NVLink domain; DeepEP references do not need RDMA/GIN.
EP_DISABLE_GIN: "1"
run: |
chmod +x "${{ github.workspace }}/DeepGEMM/sgl_deep_gemm/run_tests.sh"
"${{ github.workspace }}/DeepGEMM/sgl_deep_gemm/run_tests.sh" --release
release-cu130:
if: ${{ !inputs.validation_only }}
needs: [build-cu130-matrix, test-cu130]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
pattern: deepgemm-wheel-cuda13.0-*
- name: Download PyPI artifacts
uses: actions/download-artifact@v4
with:
path: dist-pypi/
merge-multiple: true
pattern: deepgemm-pypi-cuda13.0-*
- name: Upload to PyPI
run: |
pip install --upgrade twine "packaging>=24.2"
python3 -m twine upload --skip-existing dist-pypi/* -u __token__ -p ${{ secrets.SGL_DEEP_GEMM_PYPI_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
repository: sgl-project/whl
token: ${{ secrets.GH_PAT_FOR_WHL_RELEASE }}
files: |
dist/*
- name: Clone wheel index
run: git clone https://oauth2:${WHL_TOKEN}@github.com/sgl-project/whl.git sgl-whl
env:
WHL_TOKEN: ${{ secrets.GH_PAT_FOR_WHL_RELEASE }}
- name: Update wheel index
run: python3 scripts/update_deepgemm_whl_index.py --cuda 130
- name: Push wheel index
run: |
cd sgl-whl
git config --local user.name "sglang-bot"
git config --local user.email "sglangbot@gmail.com"
git add -A
git commit -m "update sgl-deep-gemm whl index for v${{ inputs.version }}"
git push