Release sglang kernel 0.4.0 (#20440)
Co-authored-by: Baizhou Zhang <sobereddiezhang@gmail.com>
This commit is contained in:
@@ -110,6 +110,7 @@ if [ -n "$SKIP_SGLANG_BUILD" ]; then
|
||||
echo "Didn't build checkout SGLang"
|
||||
else
|
||||
docker exec ci_sglang pip uninstall sgl-kernel -y || true
|
||||
docker exec ci_sglang pip uninstall sglang-kernel -y || true
|
||||
docker exec ci_sglang pip uninstall sglang -y || true
|
||||
# Clear Python cache to ensure latest code is used
|
||||
docker exec ci_sglang find /opt/venv -name "*.pyc" -delete || true
|
||||
|
||||
@@ -190,7 +190,7 @@ fi
|
||||
|
||||
# Install sgl-kernel
|
||||
SGL_KERNEL_VERSION_FROM_KERNEL=$(grep -Po '(?<=^version = ")[^"]*' sgl-kernel/pyproject.toml)
|
||||
SGL_KERNEL_VERSION_FROM_SRT=$(grep -Po -m1 '(?<=sgl-kernel==)[0-9A-Za-z\.\-]+' python/pyproject.toml)
|
||||
SGL_KERNEL_VERSION_FROM_SRT=$(grep -Po -m1 '(?<=sglang-kernel==)[0-9A-Za-z\.\-]+' python/pyproject.toml)
|
||||
echo "SGL_KERNEL_VERSION_FROM_KERNEL=${SGL_KERNEL_VERSION_FROM_KERNEL} SGL_KERNEL_VERSION_FROM_SRT=${SGL_KERNEL_VERSION_FROM_SRT}"
|
||||
|
||||
if [ "${CUSTOM_BUILD_SGL_KERNEL:-}" = "true" ] && [ -d "sgl-kernel/dist" ]; then
|
||||
@@ -201,7 +201,7 @@ if [ "${CUSTOM_BUILD_SGL_KERNEL:-}" = "true" ] && [ -d "sgl-kernel/dist" ]; then
|
||||
else
|
||||
WHEEL_ARCH="x86_64"
|
||||
fi
|
||||
$PIP_CMD install sgl-kernel/dist/sgl_kernel-${SGL_KERNEL_VERSION_FROM_KERNEL}-cp310-abi3-manylinux2014_${WHEEL_ARCH}.whl --force-reinstall $PIP_INSTALL_SUFFIX
|
||||
$PIP_CMD install sgl-kernel/dist/sglang_kernel-${SGL_KERNEL_VERSION_FROM_KERNEL}-cp310-abi3-manylinux2014_${WHEEL_ARCH}.whl --force-reinstall $PIP_INSTALL_SUFFIX
|
||||
elif [ "${CUSTOM_BUILD_SGL_KERNEL:-}" = "true" ] && [ ! -d "sgl-kernel/dist" ]; then
|
||||
# CUSTOM_BUILD_SGL_KERNEL was set but artifacts not available (e.g., stage rerun without wheel build)
|
||||
# Fail instead of falling back to PyPI - we need to test the built kernel, not PyPI version
|
||||
@@ -212,15 +212,15 @@ elif [ "${CUSTOM_BUILD_SGL_KERNEL:-}" = "true" ] && [ ! -d "sgl-kernel/dist" ];
|
||||
else
|
||||
# On Blackwell machines, skip reinstall if correct version already installed to avoid race conditions
|
||||
if [ "$IS_BLACKWELL" = "1" ]; then
|
||||
INSTALLED_SGL_KERNEL=$(pip show sgl-kernel 2>/dev/null | grep "^Version:" | awk '{print $2}' || echo "")
|
||||
INSTALLED_SGL_KERNEL=$(pip show sglang-kernel 2>/dev/null | grep "^Version:" | awk '{print $2}' || echo "")
|
||||
if [ "$INSTALLED_SGL_KERNEL" = "$SGL_KERNEL_VERSION_FROM_SRT" ]; then
|
||||
echo "sgl-kernel==${SGL_KERNEL_VERSION_FROM_SRT} already installed, skipping reinstall"
|
||||
echo "sglang-kernel==${SGL_KERNEL_VERSION_FROM_SRT} already installed, skipping reinstall"
|
||||
else
|
||||
echo "Installing sgl-kernel==${SGL_KERNEL_VERSION_FROM_SRT} (current: ${INSTALLED_SGL_KERNEL:-none})"
|
||||
$PIP_CMD install sgl-kernel==${SGL_KERNEL_VERSION_FROM_SRT} $PIP_INSTALL_SUFFIX
|
||||
echo "Installing sglang-kernel==${SGL_KERNEL_VERSION_FROM_SRT} (current: ${INSTALLED_SGL_KERNEL:-none})"
|
||||
$PIP_CMD install sglang-kernel==${SGL_KERNEL_VERSION_FROM_SRT} $PIP_INSTALL_SUFFIX
|
||||
fi
|
||||
else
|
||||
$PIP_CMD install sgl-kernel==${SGL_KERNEL_VERSION_FROM_SRT} --force-reinstall $PIP_INSTALL_SUFFIX
|
||||
$PIP_CMD install sglang-kernel==${SGL_KERNEL_VERSION_FROM_SRT} --force-reinstall $PIP_INSTALL_SUFFIX
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -25,17 +25,18 @@ python scripts/release/bump_sglang_version.py 0.5.3rc0
|
||||
- `python/sglang/version.py`
|
||||
|
||||
### `bump_kernel_version.py`
|
||||
Updates sgl-kernel version across all relevant files following the pattern from [PR #10732](https://github.com/sgl-project/sglang/pull/10732).
|
||||
Updates the `sglang-kernel` release version across all relevant files following the pattern from [PR #10732](https://github.com/sgl-project/sglang/pull/10732).
|
||||
|
||||
**Usage:**
|
||||
```bash
|
||||
python scripts/release/bump_kernel_version.py 0.3.12
|
||||
python scripts/release/bump_kernel_version.py 0.4.0
|
||||
```
|
||||
|
||||
**Files updated:**
|
||||
- `sgl-kernel/pyproject.toml`
|
||||
- `sgl-kernel/pyproject_cpu.toml`
|
||||
- `sgl-kernel/pyproject_rocm.toml`
|
||||
- `sgl-kernel/pyproject_musa.toml`
|
||||
- `sgl-kernel/python/sgl_kernel/version.py`
|
||||
|
||||
## Manual Testing Instructions
|
||||
@@ -68,7 +69,7 @@ python scripts/release/bump_kernel_version.py 0.3.12
|
||||
|
||||
1. **Run the script:**
|
||||
```bash
|
||||
python scripts/release/bump_kernel_version.py 0.3.13
|
||||
python scripts/release/bump_kernel_version.py 0.4.0
|
||||
```
|
||||
|
||||
2. **Verify changes with git diff:**
|
||||
@@ -78,8 +79,8 @@ python scripts/release/bump_kernel_version.py 0.3.12
|
||||
|
||||
3. **Check specific files contain the new version:**
|
||||
```bash
|
||||
grep -r "0.3.13" sgl-kernel/python/sgl_kernel/version.py
|
||||
grep -r "0.3.13" sgl-kernel/pyproject.toml
|
||||
grep -r "0.4.0" sgl-kernel/python/sgl_kernel/version.py
|
||||
grep -r "0.4.0" sgl-kernel/pyproject.toml
|
||||
```
|
||||
|
||||
4. **Reset changes (if testing):**
|
||||
@@ -90,6 +91,6 @@ python scripts/release/bump_kernel_version.py 0.3.12
|
||||
## Version Format Validation
|
||||
|
||||
- **SGLang versions:** `X.Y.Z` or `X.Y.ZrcN` (e.g., `0.5.3` or `0.5.3rc0`)
|
||||
- **Kernel versions:** `X.Y.Z` (e.g., `0.3.12`)
|
||||
- **Kernel versions:** `X.Y.Z` (e.g., `0.4.0`)
|
||||
|
||||
The scripts will validate the version format and exit with an error if invalid.
|
||||
|
||||
@@ -22,6 +22,7 @@ def main():
|
||||
Path("sgl-kernel/pyproject.toml"),
|
||||
Path("sgl-kernel/pyproject_cpu.toml"),
|
||||
Path("sgl-kernel/pyproject_rocm.toml"),
|
||||
Path("sgl-kernel/pyproject_musa.toml"),
|
||||
Path("sgl-kernel/python/sgl_kernel/version.py"),
|
||||
]
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Bump sgl-kernel version in SGLang files to match the version in sgl-kernel/pyproject.toml.
|
||||
Bump sglang-kernel version in SGLang files to match the version in sgl-kernel/pyproject.toml.
|
||||
Updates:
|
||||
- python/pyproject.toml
|
||||
- python/sglang/srt/entrypoints/engine.py
|
||||
@@ -37,7 +37,7 @@ def get_kernel_version_from_source() -> str:
|
||||
|
||||
|
||||
def update_python_pyproject(new_version: str) -> bool:
|
||||
"""Update sgl-kernel version in python/pyproject.toml"""
|
||||
"""Update sglang-kernel version in python/pyproject.toml"""
|
||||
pyproject_path = Path("python/pyproject.toml")
|
||||
|
||||
if not pyproject_path.exists():
|
||||
@@ -46,10 +46,10 @@ def update_python_pyproject(new_version: str) -> bool:
|
||||
|
||||
content = pyproject_path.read_text()
|
||||
|
||||
# Replace "sgl-kernel==x.x.x" with new version
|
||||
# Replace "sglang-kernel==x.x.x" with new version
|
||||
new_content = re.sub(
|
||||
r'"sgl-kernel==[^"]+"',
|
||||
f'"sgl-kernel=={new_version}"',
|
||||
r'"sglang-kernel==[^"]+"',
|
||||
f'"sglang-kernel=={new_version}"',
|
||||
content,
|
||||
)
|
||||
|
||||
@@ -63,7 +63,7 @@ def update_python_pyproject(new_version: str) -> bool:
|
||||
|
||||
|
||||
def update_engine_py(new_version: str) -> bool:
|
||||
"""Update sgl-kernel version in python/sglang/srt/entrypoints/engine.py"""
|
||||
"""Update sglang-kernel version in python/sglang/srt/entrypoints/engine.py"""
|
||||
engine_path = Path("python/sglang/srt/entrypoints/engine.py")
|
||||
|
||||
if not engine_path.exists():
|
||||
@@ -72,9 +72,9 @@ def update_engine_py(new_version: str) -> bool:
|
||||
|
||||
content = engine_path.read_text()
|
||||
|
||||
# Replace version in assert_pkg_version("sgl-kernel", "version", ...)
|
||||
# Replace version in assert_pkg_version("sglang-kernel", "version", ...)
|
||||
new_content = re.sub(
|
||||
r'(assert_pkg_version\s*\(\s*"sgl-kernel"\s*,\s*)"[^"]+"',
|
||||
r'(assert_pkg_version\s*\(\s*"sglang-kernel"\s*,\s*)"[^"]+"',
|
||||
rf'\1"{new_version}"',
|
||||
content,
|
||||
)
|
||||
@@ -117,7 +117,7 @@ def update_dockerfile(new_version: str) -> bool:
|
||||
|
||||
def main():
|
||||
kernel_version = get_kernel_version_from_source()
|
||||
print(f"Bumping sgl-kernel version to: {kernel_version}\n")
|
||||
print(f"Bumping sglang-kernel version to: {kernel_version}\n")
|
||||
|
||||
updated_files = []
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Check if sgl-kernel version from sgl-kernel/pyproject.toml matches the versions
|
||||
Check if sglang-kernel version from sgl-kernel/pyproject.toml matches the versions
|
||||
used in SGLang files (python/pyproject.toml, engine.py, and Dockerfile).
|
||||
Sets GitHub Actions output variables to indicate if sync is needed.
|
||||
"""
|
||||
@@ -36,7 +36,7 @@ def get_kernel_version_from_source() -> str:
|
||||
|
||||
|
||||
def get_kernel_version_from_python_pyproject() -> str:
|
||||
"""Extract sgl-kernel version from python/pyproject.toml"""
|
||||
"""Extract sglang-kernel version from python/pyproject.toml"""
|
||||
pyproject_path = Path("python/pyproject.toml")
|
||||
|
||||
if not pyproject_path.exists():
|
||||
@@ -45,17 +45,17 @@ def get_kernel_version_from_python_pyproject() -> str:
|
||||
|
||||
content = pyproject_path.read_text()
|
||||
|
||||
# Match "sgl-kernel==x.x.x"
|
||||
match = re.search(r'"sgl-kernel==([^"]+)"', content)
|
||||
# Match "sglang-kernel==x.x.x"
|
||||
match = re.search(r'"sglang-kernel==([^"]+)"', content)
|
||||
if not match:
|
||||
print("Error: Could not find sgl-kernel version in python/pyproject.toml")
|
||||
print("Error: Could not find sglang-kernel version in python/pyproject.toml")
|
||||
sys.exit(1)
|
||||
|
||||
return match.group(1)
|
||||
|
||||
|
||||
def get_kernel_version_from_engine() -> str:
|
||||
"""Extract sgl-kernel version from python/sglang/srt/entrypoints/engine.py"""
|
||||
"""Extract sglang-kernel version from python/sglang/srt/entrypoints/engine.py"""
|
||||
engine_path = Path("python/sglang/srt/entrypoints/engine.py")
|
||||
|
||||
if not engine_path.exists():
|
||||
@@ -64,13 +64,13 @@ def get_kernel_version_from_engine() -> str:
|
||||
|
||||
content = engine_path.read_text()
|
||||
|
||||
# Find the assert_pkg_version call for sgl-kernel
|
||||
# Look for the pattern: assert_pkg_version("sgl-kernel", "version", ...)
|
||||
# Find the assert_pkg_version call for sglang-kernel
|
||||
# Look for the pattern: assert_pkg_version("sglang-kernel", "version", ...)
|
||||
match = re.search(
|
||||
r'assert_pkg_version\s*\(\s*"sgl-kernel"\s*,\s*"([^"]+)"', content
|
||||
r'assert_pkg_version\s*\(\s*"sglang-kernel"\s*,\s*"([^"]+)"', content
|
||||
)
|
||||
if not match:
|
||||
print("Error: Could not find sgl-kernel version in engine.py")
|
||||
print("Error: Could not find sglang-kernel version in engine.py")
|
||||
sys.exit(1)
|
||||
|
||||
return match.group(1)
|
||||
@@ -102,8 +102,10 @@ def main():
|
||||
dockerfile_version = get_kernel_version_from_dockerfile()
|
||||
|
||||
print(f"Kernel version in sgl-kernel/pyproject.toml: {kernel_version}")
|
||||
print(f"Kernel version in python/pyproject.toml: {pyproject_version}")
|
||||
print(f"Kernel version in engine.py: {engine_version}")
|
||||
print(
|
||||
f"SGLang kernel dependency version in python/pyproject.toml: {pyproject_version}"
|
||||
)
|
||||
print(f"SGLang kernel dependency version in engine.py: {engine_version}")
|
||||
print(f"Kernel version in Dockerfile: {dockerfile_version}")
|
||||
|
||||
# Check if any version differs from the source
|
||||
|
||||
@@ -25,9 +25,9 @@ COMMIT_FILES=$(git diff --name-only | sed 's/^/ - /')
|
||||
# Commit changes
|
||||
echo "Committing changes..."
|
||||
git add -A
|
||||
git commit -m "chore: bump sgl-kernel version to ${KERNEL_VERSION} in SGLang
|
||||
git commit -m "chore: bump sglang-kernel version to ${KERNEL_VERSION} in SGLang
|
||||
|
||||
This commit updates the sgl-kernel version across SGLang files to match
|
||||
This commit updates the sglang-kernel version across SGLang files to match
|
||||
the version defined in sgl-kernel/pyproject.toml.
|
||||
|
||||
Files updated:
|
||||
@@ -42,10 +42,10 @@ git push origin "${BRANCH_NAME}"
|
||||
# Create pull request
|
||||
echo "Creating pull request..."
|
||||
PR_URL=$(gh pr create \
|
||||
--title "chore: bump sgl-kernel version to ${KERNEL_VERSION}" \
|
||||
--title "chore: bump sglang-kernel version to ${KERNEL_VERSION}" \
|
||||
--body "## Summary
|
||||
|
||||
This PR bumps the \`sgl-kernel\` version to \`${KERNEL_VERSION}\` across SGLang files to match the version defined in \`sgl-kernel/pyproject.toml\`.
|
||||
This PR bumps the \`sglang-kernel\` version to \`${KERNEL_VERSION}\` across SGLang files to match the version defined in \`sgl-kernel/pyproject.toml\`.
|
||||
|
||||
**Kernel Version:** \`${KERNEL_VERSION}\`
|
||||
|
||||
@@ -54,7 +54,7 @@ ${FILES_LIST}
|
||||
|
||||
## Context
|
||||
|
||||
The sgl-kernel version in \`sgl-kernel/pyproject.toml\` has been updated. This PR ensures that all SGLang files referencing the kernel version are updated accordingly:
|
||||
The kernel version in \`sgl-kernel/pyproject.toml\` has been updated. This PR ensures that all SGLang files referencing the \`sglang-kernel\` dependency are updated accordingly:
|
||||
- \`python/pyproject.toml\` - dependency specification
|
||||
- \`python/sglang/srt/entrypoints/engine.py\` - version check
|
||||
- \`docker/Dockerfile\` - Docker build argument
|
||||
|
||||
@@ -15,11 +15,11 @@ def check_wheel_cuda_version(path_name, target_cuda_version):
|
||||
if re.search(f"rocm", path_name):
|
||||
return False
|
||||
|
||||
# For other CUDA versions, the wheel path name will contain the cuda version suffix, e.g. sgl_kernel-0.3.16.post5+cu130-cp310-abi3-manylinux2014_x86_64.whl
|
||||
# For other CUDA versions, the wheel path name will contain the cuda version suffix, e.g. sglang_kernel-0.4.0+cu130-cp310-abi3-manylinux2014_x86_64.whl
|
||||
if target_cuda_version != DEFAULT_CUDA_VERSION:
|
||||
return target_cuda_version in path_name
|
||||
|
||||
# For the default CUDA version, the wheel path name will not contain any cuda version suffix, e.g. sgl_kernel-0.3.16.post5-cp310-abi3-manylinux2014_x86_64.whl
|
||||
# For the default CUDA version, the wheel path name will not contain any cuda version suffix, e.g. sglang_kernel-0.4.0-cp310-abi3-manylinux2014_x86_64.whl
|
||||
# So we need to check if the wheel path name contains any other cuda version suffix
|
||||
for cuda_version in SUPPORTED_CUDA_VERSIONS:
|
||||
if cuda_version != DEFAULT_CUDA_VERSION and cuda_version in path_name:
|
||||
@@ -28,7 +28,7 @@ def check_wheel_cuda_version(path_name, target_cuda_version):
|
||||
|
||||
|
||||
def update_wheel_index(cuda_version=DEFAULT_CUDA_VERSION, rocm_version=None):
|
||||
index_dir = pathlib.Path(f"sgl-whl/cu{cuda_version}/sgl-kernel")
|
||||
index_dir = pathlib.Path(f"sgl-whl/cu{cuda_version}/sglang-kernel")
|
||||
index_dir.mkdir(exist_ok=True, parents=True)
|
||||
base_url = "https://github.com/sgl-project/whl/releases/download"
|
||||
|
||||
@@ -39,7 +39,7 @@ def update_wheel_index(cuda_version=DEFAULT_CUDA_VERSION, rocm_version=None):
|
||||
with open(path, "rb") as f:
|
||||
sha256 = hashlib.sha256(f.read()).hexdigest()
|
||||
ver = re.findall(
|
||||
r"sgl_kernel-([0-9.]+(?:\.post[0-9]+)?)(?:\+cu[0-9]+)?-", path.name
|
||||
r"sglang_kernel-([0-9.]+(?:\.post[0-9]+)?)(?:\+cu[0-9]+)?-", path.name
|
||||
)[0]
|
||||
full_url = f"{base_url}/v{ver}/{path.name}#sha256={sha256}"
|
||||
with (index_dir / "index.html").open("a") as f:
|
||||
@@ -47,7 +47,7 @@ def update_wheel_index(cuda_version=DEFAULT_CUDA_VERSION, rocm_version=None):
|
||||
|
||||
|
||||
def _update_non_cuda_wheel_index(backend, version):
|
||||
index_dir = pathlib.Path(f"sgl-whl/{backend}{version}/sgl-kernel")
|
||||
index_dir = pathlib.Path(f"sgl-whl/{backend}{version}/sglang-kernel")
|
||||
index_dir.mkdir(exist_ok=True, parents=True)
|
||||
base_url = "https://github.com/sgl-project/whl/releases/download"
|
||||
|
||||
@@ -58,7 +58,8 @@ def _update_non_cuda_wheel_index(backend, version):
|
||||
with open(path, "rb") as f:
|
||||
sha256 = hashlib.sha256(f.read()).hexdigest()
|
||||
ver = re.findall(
|
||||
rf"sgl_kernel-([0-9.]+(?:\.post[0-9]+)?)(?:\+{backend}[0-9]+)?-", path.name
|
||||
rf"sglang_kernel-([0-9.]+(?:\.post[0-9]+)?)(?:\+{backend}[0-9]+)?-",
|
||||
path.name,
|
||||
)[0]
|
||||
full_url = f"{base_url}/v{ver}/{path.name}#sha256={sha256}"
|
||||
with (index_dir / "index.html").open("a") as f:
|
||||
|
||||
Reference in New Issue
Block a user