Fix sgl-deep-gemm release workflow (#24385)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
29dd3a36c0
commit
f059e0264a
@@ -33,7 +33,7 @@ jobs:
|
|||||||
(github.event.inputs.target == 'all' || github.event.inputs.target == 'cu129')
|
(github.event.inputs.target == 'all' || github.event.inputs.target == 'cu129')
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.10"]
|
python-version: ["3.12"]
|
||||||
cuda-version: ["12.9"]
|
cuda-version: ["12.9"]
|
||||||
arch: [x86_64, aarch64]
|
arch: [x86_64, aarch64]
|
||||||
include:
|
include:
|
||||||
@@ -65,14 +65,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Build wheel
|
- name: Build wheel
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./scripts/build_sgl_deep_gemm.sh
|
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 }}"
|
./scripts/build_sgl_deep_gemm.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}" "${{ github.workspace }}/DeepGEMM" "${{ matrix.arch }}"
|
||||||
|
|
||||||
- name: Rename wheel
|
|
||||||
run: |
|
|
||||||
chmod +x ./scripts/rename_sgl_deep_gemm_whl.sh
|
|
||||||
./scripts/rename_sgl_deep_gemm_whl.sh DeepGEMM/dist cu129 ${{ matrix.arch }}
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -124,7 +119,7 @@ jobs:
|
|||||||
(github.event.inputs.target == 'all' || github.event.inputs.target == 'cu130')
|
(github.event.inputs.target == 'all' || github.event.inputs.target == 'cu130')
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.10"]
|
python-version: ["3.12"]
|
||||||
cuda-version: ["13.0"]
|
cuda-version: ["13.0"]
|
||||||
arch: [x86_64, aarch64]
|
arch: [x86_64, aarch64]
|
||||||
include:
|
include:
|
||||||
@@ -149,6 +144,11 @@ jobs:
|
|||||||
path: DeepGEMM
|
path: DeepGEMM
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Set wheel version
|
- name: Set wheel version
|
||||||
run: |
|
run: |
|
||||||
echo -n "${{ inputs.version }}" > DeepGEMM/sgl_deep_gemm/VERSION
|
echo -n "${{ inputs.version }}" > DeepGEMM/sgl_deep_gemm/VERSION
|
||||||
@@ -156,41 +156,56 @@ jobs:
|
|||||||
|
|
||||||
- name: Build wheel
|
- name: Build wheel
|
||||||
run: |
|
run: |
|
||||||
chmod +x ./scripts/build_sgl_deep_gemm.sh
|
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 }}"
|
./scripts/build_sgl_deep_gemm.sh "${{ matrix.python-version }}" "${{ matrix.cuda-version }}" "${{ github.workspace }}/DeepGEMM" "${{ matrix.arch }}"
|
||||||
|
|
||||||
- name: Rename wheel
|
|
||||||
run: |
|
|
||||||
chmod +x ./scripts/rename_sgl_deep_gemm_whl.sh
|
|
||||||
./scripts/rename_sgl_deep_gemm_whl.sh DeepGEMM/dist cu130 ${{ matrix.arch }}
|
|
||||||
|
|
||||||
- name: Strip +cu130 local version for PyPI upload
|
|
||||||
working-directory: DeepGEMM
|
|
||||||
run: |
|
|
||||||
set -eux
|
|
||||||
pip install wheel
|
|
||||||
mkdir -p dist-pypi
|
|
||||||
for w in dist/*.whl; do
|
|
||||||
tmp=$(mktemp -d)
|
|
||||||
python3 -m wheel unpack "$w" --dest "$tmp"
|
|
||||||
unpacked=$(find "$tmp" -mindepth 1 -maxdepth 1 -type d | head -1)
|
|
||||||
info=$(find "$unpacked" -maxdepth 1 -type d -name "*.dist-info" | head -1)
|
|
||||||
meta="$info/METADATA"
|
|
||||||
orig=$(grep '^Version:' "$meta" | head -1 | sed 's/^Version:[[:space:]]*//')
|
|
||||||
new=$(echo "$orig" | sed 's/+cu[0-9]\+$//')
|
|
||||||
if [ "$orig" != "$new" ]; then
|
|
||||||
sed -i "s/^Version:.*/Version: ${new}/" "$meta"
|
|
||||||
old_base=$(basename "$info")
|
|
||||||
new_base="${old_base/${orig}/${new}}"
|
|
||||||
mv "$info" "$(dirname "$info")/${new_base}"
|
|
||||||
fi
|
|
||||||
python3 -m wheel pack "$unpacked" --dest-dir dist-pypi
|
|
||||||
rm -rf "$tmp"
|
|
||||||
done
|
|
||||||
ls -lh dist-pypi/
|
|
||||||
|
|
||||||
- name: Upload to PyPI
|
- name: Upload to PyPI
|
||||||
working-directory: DeepGEMM
|
working-directory: DeepGEMM
|
||||||
run: |
|
run: |
|
||||||
pip install twine
|
pip install twine
|
||||||
python3 -m twine upload --skip-existing dist-pypi/* -u __token__ -p ${{ secrets.SGL_DEEP_GEMM_PYPI_TOKEN }}
|
python3 -m twine upload --skip-existing dist-pypi/* -u __token__ -p ${{ secrets.SGL_DEEP_GEMM_PYPI_TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: deepgemm-wheel-cuda${{ matrix.cuda-version }}-${{ matrix.arch }}
|
||||||
|
path: DeepGEMM/dist/*.whl
|
||||||
|
|
||||||
|
release-cu130:
|
||||||
|
needs: build-cu130-matrix
|
||||||
|
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: 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
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ FROM ${BASE_IMG}:cuda${CUDA_VERSION}
|
|||||||
|
|
||||||
ARG ARCH=x86_64
|
ARG ARCH=x86_64
|
||||||
ARG CUDA_VERSION=13.0
|
ARG CUDA_VERSION=13.0
|
||||||
ARG PYTHON_VERSION=3.10
|
ARG PYTHON_VERSION=3.12
|
||||||
ARG PYTHON_TAG=cp310-cp310
|
ARG PYTHON_TAG=cp312-cp312
|
||||||
ARG TORCH_VER=2.11.0
|
ARG TORCH_VER=2.11.0
|
||||||
ARG TVM_FFI_VER=0.1.9
|
ARG TVM_FFI_VER=0.1.9
|
||||||
ARG PIP_DEFAULT_INDEX=https://pypi.python.org/simple
|
ARG PIP_DEFAULT_INDEX=https://pypi.python.org/simple
|
||||||
|
|||||||
@@ -7,7 +7,10 @@
|
|||||||
# DEEPGEMM_SRC: path to a checkout of sgl-project/DeepGEMM
|
# DEEPGEMM_SRC: path to a checkout of sgl-project/DeepGEMM
|
||||||
# ARCH: x86_64 (default) or aarch64
|
# ARCH: x86_64 (default) or aarch64
|
||||||
#
|
#
|
||||||
# The wheel is written into <DEEPGEMM_SRC>/dist by build_sgl_deep_gemm.sh.
|
# Writes:
|
||||||
|
# <DEEPGEMM_SRC>/dist/ — wheel(s) tagged +cu129 / +cu130 and manylinux
|
||||||
|
# <DEEPGEMM_SRC>/dist-pypi/ — cu130 only: same wheel(s) with +cu130 stripped
|
||||||
|
# (PyPI rejects local-version segments)
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
if [ $# -lt 3 ]; then
|
if [ $# -lt 3 ]; then
|
||||||
@@ -20,6 +23,15 @@ CUDA_VERSION="$2"
|
|||||||
DEEPGEMM_SRC="$(cd "$3" && pwd)"
|
DEEPGEMM_SRC="$(cd "$3" && pwd)"
|
||||||
ARCH="${4:-$(uname -i)}"
|
ARCH="${4:-$(uname -i)}"
|
||||||
|
|
||||||
|
case "${CUDA_VERSION}" in
|
||||||
|
13.0) CU_TAG=cu130 ;;
|
||||||
|
12.9) CU_TAG=cu129 ;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported CUDA_VERSION: ${CUDA_VERSION}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ "${ARCH}" = "aarch64" ]; then
|
if [ "${ARCH}" = "aarch64" ]; then
|
||||||
BASE_IMG="pytorch/manylinuxaarch64-builder"
|
BASE_IMG="pytorch/manylinuxaarch64-builder"
|
||||||
else
|
else
|
||||||
@@ -31,12 +43,14 @@ PY_TAG="cp${PYTHON_VERSION//.}-cp${PYTHON_VERSION//.}"
|
|||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||||
DOCKERFILE="${REPO_ROOT}/docker/sgl-deep-gemm.Dockerfile"
|
DOCKERFILE="${REPO_ROOT}/docker/sgl-deep-gemm.Dockerfile"
|
||||||
|
RENAME_SCRIPT="${SCRIPT_DIR}/rename_sgl_deep_gemm_whl.sh"
|
||||||
|
|
||||||
DEPS_TAG="sgl-deep-gemm-deps:cuda${CUDA_VERSION}-${PY_TAG}-${ARCH}"
|
DEPS_TAG="sgl-deep-gemm-deps:cuda${CUDA_VERSION}-${PY_TAG}-${ARCH}"
|
||||||
|
|
||||||
echo "----------------------------------------"
|
echo "----------------------------------------"
|
||||||
echo "PYTHON_VERSION: ${PYTHON_VERSION}"
|
echo "PYTHON_VERSION: ${PYTHON_VERSION}"
|
||||||
echo "CUDA_VERSION: ${CUDA_VERSION}"
|
echo "CUDA_VERSION: ${CUDA_VERSION}"
|
||||||
|
echo "CU_TAG: ${CU_TAG}"
|
||||||
echo "ARCH: ${ARCH}"
|
echo "ARCH: ${ARCH}"
|
||||||
echo "BASE_IMG: ${BASE_IMG}"
|
echo "BASE_IMG: ${BASE_IMG}"
|
||||||
echo "DEEPGEMM_SRC: ${DEEPGEMM_SRC}"
|
echo "DEEPGEMM_SRC: ${DEEPGEMM_SRC}"
|
||||||
@@ -55,6 +69,7 @@ docker build \
|
|||||||
|
|
||||||
mkdir -p "${DEEPGEMM_SRC}/dist"
|
mkdir -p "${DEEPGEMM_SRC}/dist"
|
||||||
|
|
||||||
|
# 1) Build the wheel inside the deps container.
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
--network=host \
|
--network=host \
|
||||||
-v "${DEEPGEMM_SRC}:/deepgemm" \
|
-v "${DEEPGEMM_SRC}:/deepgemm" \
|
||||||
@@ -62,5 +77,49 @@ docker run --rm \
|
|||||||
"${DEPS_TAG}" \
|
"${DEPS_TAG}" \
|
||||||
bash build_sgl_deep_gemm.sh
|
bash build_sgl_deep_gemm.sh
|
||||||
|
|
||||||
echo "Wheels written to ${DEEPGEMM_SRC}/dist:"
|
# 2) Rename inside the same image so we have a working pip / wheel CLI and can
|
||||||
|
# rewrite the root-owned wheel files written by the build container above.
|
||||||
|
docker run --rm \
|
||||||
|
-v "${DEEPGEMM_SRC}:/deepgemm" \
|
||||||
|
-v "${RENAME_SCRIPT}:/rename_sgl_deep_gemm_whl.sh:ro" \
|
||||||
|
-w /deepgemm \
|
||||||
|
"${DEPS_TAG}" \
|
||||||
|
bash /rename_sgl_deep_gemm_whl.sh dist "${CU_TAG}" "${ARCH}"
|
||||||
|
|
||||||
|
# 3) cu130 only: produce a sibling dist-pypi/ with the +cu130 local-version
|
||||||
|
# stripped (PyPI rejects local versions).
|
||||||
|
if [ "${CU_TAG}" = "cu130" ]; then
|
||||||
|
docker run --rm \
|
||||||
|
-v "${DEEPGEMM_SRC}:/deepgemm" \
|
||||||
|
-w /deepgemm \
|
||||||
|
"${DEPS_TAG}" \
|
||||||
|
bash -c '
|
||||||
|
set -eux
|
||||||
|
mkdir -p dist-pypi
|
||||||
|
for w in dist/*.whl; do
|
||||||
|
tmp=$(mktemp -d)
|
||||||
|
python3 -m wheel unpack "$w" --dest "$tmp"
|
||||||
|
unpacked=$(find "$tmp" -mindepth 1 -maxdepth 1 -type d | head -1)
|
||||||
|
info=$(find "$unpacked" -maxdepth 1 -type d -name "*.dist-info" | head -1)
|
||||||
|
meta="$info/METADATA"
|
||||||
|
orig=$(grep "^Version:" "$meta" | head -1 | sed "s/^Version:[[:space:]]*//")
|
||||||
|
new=$(echo "$orig" | sed "s/+cu[0-9]\+$//")
|
||||||
|
if [ "$orig" != "$new" ]; then
|
||||||
|
sed -i "s/^Version:.*/Version: ${new}/" "$meta"
|
||||||
|
old_base=$(basename "$info")
|
||||||
|
new_base="${old_base/${orig}/${new}}"
|
||||||
|
mv "$info" "$(dirname "$info")/${new_base}"
|
||||||
|
fi
|
||||||
|
python3 -m wheel pack "$unpacked" --dest-dir dist-pypi
|
||||||
|
rm -rf "$tmp"
|
||||||
|
done
|
||||||
|
ls -lh dist-pypi/
|
||||||
|
'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Wheels in ${DEEPGEMM_SRC}/dist:"
|
||||||
ls -lh "${DEEPGEMM_SRC}/dist"/*.whl 2>/dev/null || true
|
ls -lh "${DEEPGEMM_SRC}/dist"/*.whl 2>/dev/null || true
|
||||||
|
if [ "${CU_TAG}" = "cu130" ]; then
|
||||||
|
echo "PyPI-ready wheels in ${DEEPGEMM_SRC}/dist-pypi:"
|
||||||
|
ls -lh "${DEEPGEMM_SRC}/dist-pypi"/*.whl 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user