[Build][CI] Drop Python 3.10: require Python 3.11+ and run CUDA CI on Python 3.12 (#43021)
Co-authored-by: Mohammad Angkad <mohammad.angkad@radixark.ai> Co-authored-by: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com>
This commit is contained in:
co-authored by
Mohammad Angkad
Mohammad Miadh Angkad
parent
59445b3da1
commit
e775fa7253
@@ -13,7 +13,7 @@ inputs:
|
||||
cache_key_prefix:
|
||||
description: 'Must match what _pr-test-rust-ext-build.yml saves under.'
|
||||
required: false
|
||||
default: rust-ext-x86_64-cp310-cp312
|
||||
default: rust-ext-x86_64-cp312
|
||||
|
||||
outputs:
|
||||
hit:
|
||||
|
||||
@@ -46,7 +46,7 @@ on:
|
||||
cache_key_prefix:
|
||||
description: 'Cache key prefix. Callers share it on purpose to reuse each other''s build; it encodes the arch and the interpreter ABI set, since the modules are portable across neither.'
|
||||
type: string
|
||||
default: rust-ext-x86_64-cp310-cp312
|
||||
default: rust-ext-x86_64-cp312
|
||||
max_glibc:
|
||||
description: >
|
||||
Highest GLIBC symbol version the built .so files may require. A ceiling set
|
||||
@@ -168,16 +168,12 @@ jobs:
|
||||
runs-on: ${{ inputs.runs_on }}
|
||||
timeout-minutes: 60
|
||||
name: Build Rust Ext
|
||||
# No crate sets abi3, so the pools' interpreters (h100 ships 3.10, h20 ships
|
||||
# 3.12) each need their own module set, and each its own target dir, since
|
||||
# PyO3's fingerprint tracks the interpreter. The two passes therefore share
|
||||
# nothing, which is why they run as parallel jobs rather than back to back.
|
||||
# No crate sets abi3, so each interpreter the stages run needs its own leg;
|
||||
# keep this matrix in sync with CI_PYTHON_VER in ci_install_dependency.sh.
|
||||
strategy:
|
||||
# Both legs run to completion, so a failure in one still leaves the other's
|
||||
# log to compare against.
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ['3.10', '3.12']
|
||||
python-version: ['3.12']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
@@ -82,14 +82,14 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
# This stage compiled the workspace too - 7+ minutes per partition on
|
||||
# billable hosted minutes. rust-ext-build's modules need an older glibc than
|
||||
# this runner has, which is the safe direction, and both pin Python 3.10.
|
||||
# this runner has, which is the safe direction, and both pin Python 3.12.
|
||||
- uses: ./.github/actions/download-rust-ext
|
||||
id: rust_ext
|
||||
with:
|
||||
|
||||
@@ -102,8 +102,16 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
timeout-minutes: 10
|
||||
# Keep this unpinned resolve out of /opt/sglang-ci-py*, which gated jobs reuse;
|
||||
# `python3 -m uv` runs the uv just upgraded, not an older one on PATH.
|
||||
run: |
|
||||
pip install -e "python/[test]"
|
||||
venv="$RUNNER_TEMP/sglang-coverage-venv"
|
||||
python3 -m pip install --upgrade uv
|
||||
python3 -m uv python install --upgrade 3.12 --python-preference only-managed
|
||||
python3 -m uv venv "$venv" --python 3.12 --python-preference only-managed --seed
|
||||
echo "$venv/bin" >> "$GITHUB_PATH"
|
||||
echo "VIRTUAL_ENV=$venv" >> "$GITHUB_ENV"
|
||||
python3 -m uv pip install --python "$venv/bin/python3" -e "python/[test]"
|
||||
|
||||
- name: Run unit tests with coverage
|
||||
# Non-gating on purpose: running the whole tree in one process
|
||||
|
||||
@@ -216,12 +216,12 @@ jobs:
|
||||
- name: Install official LTX repro dependencies
|
||||
if: matrix.source_group == 'ltx' || matrix.source_group == 'ltx23'
|
||||
run: |
|
||||
UV_SYSTEM_PYTHON=1 uv pip install \
|
||||
uv pip install --python "$(command -v python3)" \
|
||||
"transformers==4.52.4" \
|
||||
openimageio \
|
||||
--index-strategy unsafe-best-match \
|
||||
--prerelease allow
|
||||
UV_SYSTEM_PYTHON=1 uv pip uninstall kernels
|
||||
uv pip uninstall --python "$(command -v python3)" kernels
|
||||
|
||||
- name: Checkout official Wan2.1 repo
|
||||
if: matrix.source_group == 'wan21'
|
||||
|
||||
@@ -252,7 +252,7 @@ jobs:
|
||||
runs_on: ubuntu-22.04-arm
|
||||
collect_runs_on: ubuntu-22.04-arm
|
||||
artifact_name: rust-ext-aarch64
|
||||
cache_key_prefix: rust-ext-aarch64-cp310-cp312
|
||||
cache_key_prefix: rust-ext-aarch64-cp312
|
||||
git_ref: ${{ inputs.git_ref || '' }}
|
||||
skip_pr_test_health_check: ${{ inputs.skip_pr_test_health_check == true || inputs.test_parallel_dispatch == true || inputs.run_all_tests == true }}
|
||||
secrets: inherit
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Generate PR wheel version
|
||||
id: gen_version
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
||||
python-version: ["3.11", "3.12", "3.13"]
|
||||
arch: [x86_64, aarch64]
|
||||
include:
|
||||
- arch: x86_64
|
||||
|
||||
@@ -386,14 +386,14 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
# Worth the most of the three jobs: this runner is hosted, so it has no
|
||||
# persistent cargo target dir and every dispatch compiled cold. Its
|
||||
# setup-python pins the same 3.10 the modules were built against.
|
||||
# setup-python pins the same 3.12 the modules were built against.
|
||||
- uses: ./.github/actions/download-rust-ext
|
||||
id: rust_ext
|
||||
|
||||
@@ -471,7 +471,7 @@ jobs:
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Write back result to reply comment
|
||||
env:
|
||||
|
||||
@@ -48,5 +48,5 @@ jobs:
|
||||
runs_on: ubuntu-22.04-arm
|
||||
collect_runs_on: ubuntu-22.04-arm
|
||||
artifact_name: rust-ext-aarch64
|
||||
cache_key_prefix: rust-ext-aarch64-cp310-cp312
|
||||
cache_key_prefix: rust-ext-aarch64-cp312
|
||||
secrets: inherit
|
||||
|
||||
@@ -93,7 +93,7 @@ Key characteristics as served by SGLang:
|
||||
|
||||
- **GPU**: NVIDIA SM100 family — sm_100 (B200 / GB200) and sm_103 (B300 / GB300).
|
||||
- **Toolchain**: CUDA Toolkit with `nvcc` ≥ 12.x on `PATH` (or `CUDA_HOME` set) — the kernels are JIT-compiled at first import.
|
||||
- **Python**: ≥ 3.10; **OS**: Linux — works on both **x86_64 and aarch64 (Grace, e.g. GB200 / GB300)**; the aarch64 build needs no source edits.
|
||||
- **Python**: ≥ 3.11; **OS**: Linux — works on both **x86_64 and aarch64 (Grace, e.g. GB200 / GB300)**; the aarch64 build needs no source edits.
|
||||
|
||||
<Accordion title="Install MSA (only on a custom image) & verify the gate (Python)">
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ For details, see the [Hugging Face model card](https://huggingface.co/poolside/L
|
||||
Laguna-XS.2 support is on `main` but not yet in a tagged release; install from the SGLang nightly wheel index, or pull a pre-built Docker image:
|
||||
|
||||
```bash Command
|
||||
# Install SGLang via pip (CUDA 13) — requires Python 3.10 (nightly wheels are cp310 only)
|
||||
# Install SGLang via pip (CUDA 13) — requires Python 3.10 (this nightly wheel is cp310 only)
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install --extra-index-url https://docs.sglang.ai/whl/cu130 \
|
||||
"sglang[all]==0.5.12.dev20260509+g096ad02b0"
|
||||
|
||||
@@ -25,7 +25,7 @@ If `--base-url` is provided, requests are sent to it. Otherwise, `--host` and `-
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Python 3.10+
|
||||
- Python 3.11+
|
||||
- Dependencies typically used by this script: `aiohttp`, `numpy`, `requests`, `tqdm`, `transformers`, and for some datasets `datasets`, `pillow`, `pybase64`. Install as needed.
|
||||
- An inference server running and reachable via the endpoints above
|
||||
- If your server requires authentication, set environment variable `OPENAI_API_KEY` (used as `Authorization: Bearer <key>`)
|
||||
|
||||
@@ -13,7 +13,7 @@ The extension retains its own argument parser, process topology, API endpoints,
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Install your extension and a compatible SGLang version in the same Python 3.10+ environment.
|
||||
- Install your extension and a compatible SGLang version in the same Python 3.11+ environment.
|
||||
- Declare the SGLang version range tested by your extension in its package dependencies.
|
||||
- Keep the backend factory and detector independent of GPU initialization and model loading.
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ The container shell is ready for `sglang serve`.
|
||||
</Tab>
|
||||
<Tab title="pip / uv" id="method-1-with-pip-or-uv">
|
||||
|
||||
Use Python 3.10 or higher and a compatible CUDA 13 environment.
|
||||
Use Python 3.11 or higher and a compatible CUDA 13 environment.
|
||||
|
||||
<Accordion title="CUDA version compatibility">
|
||||
|
||||
@@ -111,7 +111,7 @@ For `CUDA_HOME` errors, see [Troubleshooting](#cuda_home).
|
||||
</Tab>
|
||||
<Tab title="From source" id="method-2-from-source">
|
||||
|
||||
Use Python 3.10 or higher in an activated Python environment, with CUDA dependencies appropriate for the version you build.
|
||||
Use Python 3.11 or higher in an activated Python environment, with CUDA dependencies appropriate for the version you build.
|
||||
|
||||
**Get the source**
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ name = "sglang"
|
||||
dynamic = ["version"]
|
||||
description = "SGLang is a fast serving framework for large language models and vision language models."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.11"
|
||||
license = { file = "LICENSE" }
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
@@ -86,7 +86,6 @@ dependencies = [
|
||||
"timm==1.0.16",
|
||||
"tokenizers==0.23.2",
|
||||
"tokenspeed_mla==0.1.8",
|
||||
"tomli ; python_version < '3.11'",
|
||||
"torch==2.14.1",
|
||||
"torch_memory_saver>=0.0.9.post1",
|
||||
"torchaudio==2.11.0",
|
||||
|
||||
@@ -8,7 +8,7 @@ name = "sglang-cpu"
|
||||
dynamic = ["version"]
|
||||
description = "SGLang is a fast serving framework for large language models and vision language models."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.11"
|
||||
license = { file = "LICENSE" }
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
|
||||
@@ -7,7 +7,7 @@ name = "sglang"
|
||||
dynamic = ["version"]
|
||||
description = "SGLang is a fast serving framework for large language models and vision language models."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.11"
|
||||
license = { file = "LICENSE" }
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
|
||||
@@ -7,7 +7,7 @@ name = "sglang"
|
||||
dynamic = ["version"]
|
||||
description = "SGLang is a fast serving framework for large language models and vision language models."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.11"
|
||||
license = { file = "LICENSE" }
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
|
||||
@@ -46,6 +46,7 @@ from sglang.multimodal_gen.runtime.utils.logging_utils import (
|
||||
globally_suppress_loggers,
|
||||
init_logger,
|
||||
)
|
||||
from sglang.srt.observability.trace import fastapi_telemetry_disabled_kwargs
|
||||
from sglang.srt.utils.common import (
|
||||
add_prometheus_middleware,
|
||||
add_prometheus_track_response_middleware,
|
||||
@@ -430,7 +431,7 @@ def create_app(server_args: ServerArgs):
|
||||
Create and configure the FastAPI application instance.
|
||||
"""
|
||||
globally_suppress_loggers()
|
||||
app = FastAPI(lifespan=lifespan)
|
||||
app = FastAPI(lifespan=lifespan, **fastapi_telemetry_disabled_kwargs())
|
||||
if server_args.enable_metrics:
|
||||
configure_metrics()
|
||||
add_prometheus_middleware(app)
|
||||
|
||||
@@ -104,10 +104,7 @@ class TestDecodeHandsOutFinishedFrames(CustomTestCase):
|
||||
)
|
||||
|
||||
|
||||
@unittest.skipUnless(
|
||||
torch.cuda.is_available() and hasattr(os, "memfd_create"),
|
||||
"needs CUDA and memfd",
|
||||
)
|
||||
@unittest.skipUnless(condition=torch.cuda.is_available(), reason="needs CUDA")
|
||||
class TestStreamedEncode(CustomTestCase):
|
||||
@staticmethod
|
||||
def _video(height: int, width: int) -> torch.Tensor:
|
||||
|
||||
@@ -5,7 +5,6 @@ The frame hand-off itself is covered in
|
||||
python/sglang/multimodal_gen/test/unit/test_wan_vae_on_frames.py.
|
||||
"""
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
@@ -103,10 +102,7 @@ def _video_request(**overrides) -> SimpleNamespace:
|
||||
return SimpleNamespace(**fields)
|
||||
|
||||
|
||||
@unittest.skipUnless(
|
||||
torch.cuda.is_available() and hasattr(os, "memfd_create"),
|
||||
"needs CUDA and memfd",
|
||||
)
|
||||
@unittest.skipUnless(condition=torch.cuda.is_available(), reason="needs CUDA")
|
||||
class TestStreamedEncode(CustomTestCase):
|
||||
@torch.no_grad()
|
||||
def test_hunyuan_without_callback_matches_one_shot_mp4(self):
|
||||
|
||||
@@ -47,6 +47,7 @@ from sglang.srt.managers.io_struct import (
|
||||
wrap_as_pickle,
|
||||
)
|
||||
from sglang.srt.managers.schedule_batch import Modality
|
||||
from sglang.srt.observability.trace import fastapi_telemetry_disabled_kwargs
|
||||
from sglang.srt.runtime_context import (
|
||||
get_disagg,
|
||||
get_observability,
|
||||
@@ -100,7 +101,7 @@ async def _lifespan(app: FastAPI):
|
||||
await local_runtime.stop()
|
||||
|
||||
|
||||
app = FastAPI(lifespan=_lifespan)
|
||||
app = FastAPI(lifespan=_lifespan, **fastapi_telemetry_disabled_kwargs())
|
||||
|
||||
|
||||
def _register_encoder_url_with_bootstrap():
|
||||
|
||||
@@ -36,6 +36,7 @@ from sglang.srt.managers.multimodal_processor import get_mm_processor, import_pr
|
||||
from sglang.srt.managers.schedule_batch import Modality, Req
|
||||
from sglang.srt.multimodal.cache import media_preprocess_kwargs
|
||||
from sglang.srt.multimodal.transport import determine_tensor_transport_mode
|
||||
from sglang.srt.observability.trace import fastapi_telemetry_disabled_kwargs
|
||||
from sglang.srt.runtime_context import (
|
||||
get_device,
|
||||
get_disagg,
|
||||
@@ -164,7 +165,9 @@ class EncoderBootstrapServer:
|
||||
except (asyncio.CancelledError, Exception):
|
||||
pass
|
||||
|
||||
self.app = FastAPI(lifespan=lifespan, openapi_url=None)
|
||||
self.app = FastAPI(
|
||||
lifespan=lifespan, openapi_url=None, **fastapi_telemetry_disabled_kwargs()
|
||||
)
|
||||
|
||||
@self.app.get("/health")
|
||||
async def _health() -> Response:
|
||||
|
||||
@@ -10,6 +10,7 @@ from fastapi import FastAPI
|
||||
from fastapi.responses import PlainTextResponse
|
||||
|
||||
from sglang.srt.distributed.parallel_state import get_world_group
|
||||
from sglang.srt.observability.trace import fastapi_telemetry_disabled_kwargs
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -82,7 +83,7 @@ class _GatedLaunchServer:
|
||||
|
||||
|
||||
def _build_app(server: _GatedLaunchServer) -> FastAPI:
|
||||
app = FastAPI()
|
||||
app = FastAPI(**fastapi_telemetry_disabled_kwargs())
|
||||
|
||||
@app.get("/health")
|
||||
def health():
|
||||
|
||||
@@ -20,6 +20,8 @@ import uvicorn
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from fastapi.responses import PlainTextResponse
|
||||
|
||||
from sglang.srt.observability.trace import fastapi_telemetry_disabled_kwargs
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -42,7 +44,7 @@ class EngineInfoBootstrapServer:
|
||||
self.transfer_engine_info: Dict[int, Tuple] = {}
|
||||
self.lock = threading.Lock()
|
||||
|
||||
app = FastAPI()
|
||||
app = FastAPI(**fastapi_telemetry_disabled_kwargs())
|
||||
|
||||
@app.get("/health")
|
||||
def health():
|
||||
|
||||
@@ -169,6 +169,7 @@ from sglang.srt.managers.multi_tokenizer_mixin import (
|
||||
from sglang.srt.managers.tokenizer_manager import ServerStatus, TokenizerManager
|
||||
from sglang.srt.observability.func_timer import enable_func_timer
|
||||
from sglang.srt.observability.trace import (
|
||||
fastapi_telemetry_disabled_kwargs,
|
||||
process_tracing_init,
|
||||
set_global_trace_level,
|
||||
trace_set_thread_info,
|
||||
@@ -479,6 +480,7 @@ class ORJSONRoute(APIRoute):
|
||||
app = FastAPI(
|
||||
lifespan=lifespan,
|
||||
openapi_url=None if get_bool_env_var("DISABLE_OPENAPI_DOC") else "/openapi.json",
|
||||
**fastapi_telemetry_disabled_kwargs(),
|
||||
)
|
||||
app.router.route_class = ORJSONRoute
|
||||
app.add_middleware(
|
||||
|
||||
@@ -269,6 +269,11 @@ def get_global_tracing_enabled():
|
||||
return opentelemetry_initialized
|
||||
|
||||
|
||||
def fastapi_telemetry_disabled_kwargs() -> Dict[str, Any]:
|
||||
# FastAPI traces every request under process_tracing_init's provider by default.
|
||||
return {"telemetry": {"tracing": False, "metrics": False, "logs": False}}
|
||||
|
||||
|
||||
def get_otlp_span_exporter(endpoint):
|
||||
protocol = os.environ.get(OTEL_EXPORTER_OTLP_TRACES_PROTOCOL, "grpc")
|
||||
supported_protocols = {"grpc", "http/protobuf"}
|
||||
|
||||
@@ -3678,9 +3678,10 @@ def launch_dummy_health_check_server(host, port, enable_metrics):
|
||||
import uvicorn
|
||||
from fastapi import FastAPI, Response
|
||||
|
||||
from sglang.srt.observability.trace import fastapi_telemetry_disabled_kwargs
|
||||
from sglang.srt.utils.network import NetworkAddress
|
||||
|
||||
app = FastAPI()
|
||||
app = FastAPI(**fastapi_telemetry_disabled_kwargs())
|
||||
|
||||
@app.get("/ping")
|
||||
async def ping():
|
||||
|
||||
@@ -12,7 +12,7 @@ build-backend = "maturin"
|
||||
name = "sglang-grpc"
|
||||
dynamic = ["version"]
|
||||
description = "In-process Rust gRPC server for SGLang"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.11"
|
||||
|
||||
[tool.maturin]
|
||||
module-name = "_grpc"
|
||||
|
||||
@@ -6,7 +6,7 @@ build-backend = "maturin"
|
||||
name = "sglang-mm"
|
||||
dynamic = ["version"]
|
||||
description = "Rust-accelerated multimodal preprocessing for SGLang"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.11"
|
||||
|
||||
[tool.maturin]
|
||||
module-name = "_multimodal"
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
||||
|
||||
[project]
|
||||
name = "sglang-server"
|
||||
requires-python = ">=3.10"
|
||||
requires-python = ">=3.11"
|
||||
classifiers = [
|
||||
"Programming Language :: Rust",
|
||||
"Programming Language :: Python :: Implementation :: CPython",
|
||||
|
||||
@@ -55,36 +55,67 @@ configure_environment() {
|
||||
USE_VENV="${USE_VENV:-0}"
|
||||
echo "USE_VENV=${USE_VENV}"
|
||||
|
||||
python3 -m pip install --upgrade pip
|
||||
if ! command -v uv >/dev/null 2>&1; then
|
||||
pip install uv
|
||||
# A stale uv only knows the managed Python builds released before it.
|
||||
python3 -m pip install --upgrade pip uv
|
||||
# Put that uv ahead of any older copy on PATH (runner image, standalone installer).
|
||||
UV_BIN_DIR="$(dirname "$(python3 -c 'import uv; print(uv.find_uv_bin())')")"
|
||||
export PATH="${UV_BIN_DIR}:${PATH}"
|
||||
if [ -n "${GITHUB_PATH:-}" ]; then
|
||||
mkdir -p "$(dirname "$GITHUB_PATH")" 2>/dev/null || true
|
||||
echo "$UV_BIN_DIR" >> "$GITHUB_PATH" || true
|
||||
fi
|
||||
uv --version
|
||||
|
||||
# Every job installs into a uv-managed venv, whatever Python the runner image ships.
|
||||
# Keep in sync with the python-version matrix in _pr-test-rust-ext-build.yml.
|
||||
CI_PYTHON_VER="3.12"
|
||||
|
||||
# Managed builds ship Python.h, which Triton's runtime launcher compiles against.
|
||||
# The download comes from github.com, which some pools reach slowly enough to time
|
||||
# out this step, so keep the installed build unless it predates os.memfd_create
|
||||
# (python-build-standalone before 20260718). --upgrade repoints uv's minor-version
|
||||
# link at the latest patch; a kept venv follows it.
|
||||
CI_PYTHON_BIN="$(uv python find "$CI_PYTHON_VER" --system --python-preference only-managed 2>/dev/null || true)"
|
||||
if [ -z "$CI_PYTHON_BIN" ] || ! "$CI_PYTHON_BIN" -c 'import os; os.memfd_create' 2>/dev/null; then
|
||||
uv python install --upgrade "$CI_PYTHON_VER" --python-preference only-managed
|
||||
fi
|
||||
|
||||
SYS_PYTHON_VER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
|
||||
|
||||
UV_VENV_COMPLETE_MARKER=""
|
||||
if [ "$USE_VENV" = "1" ]; then
|
||||
UV_VENV="/tmp/sglang-ci-${GITHUB_RUN_ID:-norun}-${GITHUB_JOB:-nojob}-$$"
|
||||
uv venv "$UV_VENV" --python "python${SYS_PYTHON_VER}" --seed
|
||||
# shellcheck disable=SC1091
|
||||
source "$UV_VENV/bin/activate"
|
||||
[ "${VIRTUAL_ENV:-}" = "$UV_VENV" ] || { echo "FATAL: venv activation did not set VIRTUAL_ENV correctly"; exit 1; }
|
||||
[ "$(command -v python3)" = "$UV_VENV/bin/python3" ] || { echo "FATAL: python3 still resolves outside venv (got $(command -v python3))"; exit 1; }
|
||||
|
||||
if [ -n "${GITHUB_ENV:-}" ]; then
|
||||
# Self-heal: see install_rustup.sh for context on missing _runner_file_commands/.
|
||||
mkdir -p "$(dirname "$GITHUB_ENV")" 2>/dev/null || true
|
||||
echo "VIRTUAL_ENV=$UV_VENV" >> "$GITHUB_ENV" || true
|
||||
echo "SGLANG_CI_VENV_PATH=$UV_VENV" >> "$GITHUB_ENV" || true
|
||||
echo "BASH_ENV=$UV_VENV/env.sh" >> "$GITHUB_ENV" || true
|
||||
touch "$UV_VENV/env.sh"
|
||||
fi
|
||||
if [ -n "${GITHUB_PATH:-}" ]; then
|
||||
mkdir -p "$(dirname "$GITHUB_PATH")" 2>/dev/null || true
|
||||
echo "$UV_VENV/bin" >> "$GITHUB_PATH" || true
|
||||
fi
|
||||
uv venv "$UV_VENV" --python "$CI_PYTHON_VER" --python-preference only-managed --seed
|
||||
else
|
||||
echo "USE_VENV=0: skipping uv venv creation, installing into system Python"
|
||||
UV_VENV=""
|
||||
# Kept across jobs so installs stay incremental and path-keyed JIT caches hit.
|
||||
UV_VENV="/opt/sglang-ci-py${CI_PYTHON_VER}"
|
||||
# A cancelled install leaves dist-info that later installs treat as satisfied;
|
||||
# rebuild unless the last install ran to completion.
|
||||
UV_VENV_COMPLETE_MARKER="$UV_VENV/.install-complete"
|
||||
if [ ! -f "$UV_VENV_COMPLETE_MARKER" ]; then
|
||||
rm -rf "$UV_VENV"
|
||||
uv venv "$UV_VENV" --python "$CI_PYTHON_VER" --python-preference only-managed --seed
|
||||
fi
|
||||
rm -f "$UV_VENV_COMPLETE_MARKER"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source "$UV_VENV/bin/activate"
|
||||
[ "${VIRTUAL_ENV:-}" = "$UV_VENV" ] || { echo "FATAL: venv activation did not set VIRTUAL_ENV correctly"; exit 1; }
|
||||
[ "$(command -v python3)" = "$UV_VENV/bin/python3" ] || { echo "FATAL: python3 still resolves outside venv (got $(command -v python3))"; exit 1; }
|
||||
|
||||
if [ -n "${GITHUB_ENV:-}" ]; then
|
||||
# Self-heal: see install_rustup.sh for context on missing _runner_file_commands/.
|
||||
mkdir -p "$(dirname "$GITHUB_ENV")" 2>/dev/null || true
|
||||
echo "VIRTUAL_ENV=$UV_VENV" >> "$GITHUB_ENV" || true
|
||||
# ci_cleanup_venv.sh deletes this path, so only the per-job venv exports it.
|
||||
if [ "$USE_VENV" = "1" ]; then
|
||||
echo "SGLANG_CI_VENV_PATH=$UV_VENV" >> "$GITHUB_ENV" || true
|
||||
fi
|
||||
echo "BASH_ENV=$UV_VENV/env.sh" >> "$GITHUB_ENV" || true
|
||||
: > "$UV_VENV/env.sh"
|
||||
fi
|
||||
if [ -n "${GITHUB_PATH:-}" ]; then
|
||||
mkdir -p "$(dirname "$GITHUB_PATH")" 2>/dev/null || true
|
||||
echo "$UV_VENV/bin" >> "$GITHUB_PATH" || true
|
||||
fi
|
||||
|
||||
mark_step_done "${FUNCNAME[0]}"
|
||||
@@ -382,14 +413,8 @@ release_cargo_cache_lock() {
|
||||
}
|
||||
|
||||
setup_pip_toolchain() {
|
||||
if [ "$USE_VENV" = "1" ]; then
|
||||
# The bootstrap upgrade hit system pip; this upgrades the venv's own.
|
||||
python3 -m pip install --upgrade pip
|
||||
fi
|
||||
|
||||
if [ "$USE_VENV" != "1" ]; then
|
||||
export UV_SYSTEM_PYTHON=1
|
||||
fi
|
||||
# The bootstrap upgrade hit system pip; this upgrades the venv's own.
|
||||
python3 -m pip install --upgrade pip
|
||||
|
||||
export UV_LINK_MODE=copy
|
||||
PIP_CMD="uv pip"
|
||||
@@ -548,9 +573,8 @@ require_prebuilt_rust_exts() {
|
||||
# Exact EXT_SUFFIX rather than an _*.so glob: no crate sets abi3, so a module
|
||||
# built for another minor version satisfies the glob while the import system
|
||||
# ignores it, leaving is_rust_server_built() false and the Rust-server tests
|
||||
# silently skipped. Stages have no setup-python, so the interpreter is whatever
|
||||
# the image ships, and the pools are not on one version (h20 is 3.12 while
|
||||
# h100 is 3.10) - a mismatch is drift to route around, not a failure.
|
||||
# silently skipped. A CI_PYTHON_VER outside the build matrix has no module;
|
||||
# build it from source rather than fail.
|
||||
local suffix
|
||||
suffix=$(python3 -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))')
|
||||
local missing=()
|
||||
@@ -809,7 +833,9 @@ install_extra_deps() {
|
||||
fi
|
||||
|
||||
if [ "$IS_BLACKWELL" != "1" ]; then
|
||||
$PIP_CMD install "lmms_eval==0.5.0" $PIP_INSTALL_SUFFIX
|
||||
# pyarrow 26 needs NumPy 2 at import, but lmms_eval pins numpy 1.26.4;
|
||||
# drop the cap once lmms_eval allows NumPy 2.
|
||||
$PIP_CMD install "lmms_eval==0.5.0" "pyarrow<26" $PIP_INSTALL_SUFFIX
|
||||
# lmms_eval 0.5.0 pulls antlr4-python3-runtime==4.7.2, clobbering the
|
||||
# 4.9.3 that sgl-eval's latex2sympy2_extended needs (4.7.2 ImportError
|
||||
# at sgl-eval import). Pin it back so the nightly sgl-eval path works.
|
||||
@@ -835,9 +861,7 @@ setup_ld_library_path() {
|
||||
VENV_LD="${NVIDIA_LIBS}${TORCH_LIB}"
|
||||
export LD_LIBRARY_PATH="${VENV_LD}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
|
||||
if [ "$USE_VENV" = "1" ] && [ -n "$UV_VENV" ]; then
|
||||
echo "export LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"" >> "$UV_VENV/env.sh"
|
||||
fi
|
||||
echo "export LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"" >> "$UV_VENV/env.sh"
|
||||
if [ -n "${GITHUB_ENV:-}" ]; then
|
||||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> "$GITHUB_ENV" || echo "WARNING: GITHUB_ENV write failed; LD_LIBRARY_PATH will be set via BASH_ENV instead"
|
||||
fi
|
||||
@@ -943,6 +967,9 @@ main() {
|
||||
prepare_runner
|
||||
setup_ld_library_path
|
||||
verify_imports
|
||||
if [ -n "$UV_VENV_COMPLETE_MARKER" ]; then
|
||||
touch "$UV_VENV_COMPLETE_MARKER"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
@@ -85,19 +85,33 @@ class TestDiffusionRustGate(unittest.TestCase):
|
||||
functions
|
||||
+ """
|
||||
mark_step_done() { :; }
|
||||
python3() { if [ "$1" = "-c" ]; then echo .test.so; fi; }
|
||||
uv() { :; }
|
||||
# python3 must be a file, not a function, so the venv's copy wins on PATH.
|
||||
mkdir bin
|
||||
printf '#!/bin/sh\\nif [ "$1" = "-c" ]; then echo .test.so; fi\\n' > bin/python3
|
||||
chmod +x bin/python3
|
||||
PATH="$PWD/bin:$PATH"
|
||||
uv() {
|
||||
if [ "$1" = venv ]; then
|
||||
mkdir -p "$2/bin"
|
||||
cp bin/python3 "$2/bin/python3"
|
||||
printf 'VIRTUAL_ENV=%s\\nPATH=%s/bin:$PATH\\n' "$2" "$2" > "$2/bin/activate"
|
||||
fi
|
||||
}
|
||||
pip() { :; }
|
||||
configure_environment "$1"
|
||||
require_prebuilt_rust_exts
|
||||
if [ "$1" = diffusion ]; then setup_cargo_cache; fi
|
||||
printf 'RESULT=%s:%s\n' "$SGLANG_BUILD_RUST_EXTS" "$SGLANG_RUST_BUILD_MODE"
|
||||
rm -rf "$UV_VENV"
|
||||
"""
|
||||
)
|
||||
env = dict(
|
||||
os.environ,
|
||||
GITHUB_ENV=f"{tmp}/env",
|
||||
USE_VENV="0",
|
||||
GITHUB_PATH=f"{tmp}/path",
|
||||
# The per-job venv lives under /tmp; the persistent one is the
|
||||
# runner's real /opt/sglang-ci-py*, which this test must not touch.
|
||||
USE_VENV="1",
|
||||
SGLANG_BUILD_RUST_EXTS="none",
|
||||
SGLANG_RUST_BUILD_MODE="never",
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Benchmark tests for HiCache Storage with Mooncake backend.
|
||||
Usage:
|
||||
python3.10 -m pytest test/registered/hicache/test_hicache_storage_mooncake_backend.py -v
|
||||
python3 -m pytest test/registered/hicache/test_hicache_storage_mooncake_backend.py -v
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
@@ -27,7 +27,7 @@ class _FakeGraph:
|
||||
pass
|
||||
|
||||
|
||||
def _load_npu_graph_runner():
|
||||
def _load_npu_graph_runner_module():
|
||||
# Load shared modules before stubbing torch_npu so platform detection stays on CPU.
|
||||
importlib.import_module("sglang.srt.multimodal.vit_cuda_graph_runner")
|
||||
torch_npu = SimpleNamespace()
|
||||
@@ -37,14 +37,14 @@ def _load_npu_graph_runner():
|
||||
"torch_npu": torch_npu,
|
||||
},
|
||||
):
|
||||
module = importlib.import_module(
|
||||
return importlib.import_module(
|
||||
"sglang.srt.hardware_backend.npu.graph_runner.vit_npu_graph_runner"
|
||||
)
|
||||
return module.ViTNpuGraphRunner
|
||||
|
||||
|
||||
def test_npu_vit_graph_keys_include_attention_boundaries():
|
||||
runner_cls = _load_npu_graph_runner()
|
||||
module = _load_npu_graph_runner_module()
|
||||
runner_cls = module.ViTNpuGraphRunner
|
||||
vit = SimpleNamespace(
|
||||
blocks=[_Block()],
|
||||
merger=lambda x: x,
|
||||
@@ -70,10 +70,8 @@ def test_npu_vit_graph_keys_include_attention_boundaries():
|
||||
first_layout = torch.tensor([0, 4, 8], dtype=torch.int32)
|
||||
second_layout = torch.tensor([0, 2, 8], dtype=torch.int32)
|
||||
|
||||
with patch(
|
||||
"sglang.srt.hardware_backend.npu.graph_runner."
|
||||
"vit_npu_graph_runner.set_graph_pool_id"
|
||||
):
|
||||
# patch.dict dropped the module from sys.modules, so patch it by object.
|
||||
with patch.object(target=module, attribute="set_graph_pool_id"):
|
||||
runner.run(
|
||||
x,
|
||||
first_layout,
|
||||
|
||||
@@ -14,5 +14,8 @@ dependencies = [
|
||||
|
||||
[project.optional-dependencies]
|
||||
aic = [
|
||||
"aiconfigurator==0.10.0"
|
||||
"aiconfigurator==0.10.0",
|
||||
# pyarrow 26 needs NumPy 2 at import, but aiconfigurator pins numpy 1.26.4;
|
||||
# drop the cap once aiconfigurator allows NumPy 2.
|
||||
"pyarrow<26",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user