Repository navigation
fix(server): reserve declared SGLang runtime headroom at load staging - #879
Closed
ShaiShmuel wants to merge 1 commit into
Closed
ShaiShmuel wants to merge 1 commit into
ShaiShmuel wants to merge 1 commit into
Conversation
SGLang memory admission reserves the static pool plus a fixed allowance: 1 GiB with an explicit mem_fraction_static, 2 GiB with automatic sizing. A vision encoder can need several GiB more outside the static pool for one full-size image. A model that loads onto a shared device therefore passed admission without room for its own peak, and its first large page could run out of memory. Profiles can now declare the measured excess as the loadtime option runtime_headroom_gib. The memory budget adds it to the load reservation in both modes, capped at the device total for an explicit fraction. Load staging evicts idle models until that memory is free, and an automatically sized engine does not launch without it. The headroom is never given to the KV pool. The value defaults to 0, so existing profiles keep their reservations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
Contributor
Author
|
Closing without merging. Checking the pinned engine's sizing shows this option is the wrong lever:
The remaining gap (a later load admitted into a resident engine's not-yet-allocated headroom) is an admission-accounting question that no profile field can express; the discussion continues on #875. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
runtime_headroom_gib, toSGLangGenerationAdapter. The vision-extraction, CUDA 13 and Gemma SGLang adapters inherit it.SGLangMemoryBudget.required_bytesadds the value in both modes:mem_fraction_static: total × fraction + 1 GiB + headroom, capped at the device totalreserved_bytes/memory_footprint()include the headroom. Load staging evicts idle eligible models until that much memory is free. An automatically sized engine does not launch without it.--mem-fraction-staticand the KV cap do not change.0, so no existing profile's reservation changes.Why
This was split out of #875. CodeRabbit asked there to reserve the vision runtime headroom in shared-device admission. The measurement was on one L4 with Xiaomi-OCR-0. One 4096×4096 page is 16,384 visual tokens and needs about 3.6 GiB of GPU memory above the static pool. At
mem_fraction_static0.85 the engine runs out of memory. At 0.70 it passes, with a GPU peak of 21.1 of 23.0 GB. SGLang admission reserved only the static pool plus a fixed 1–2 GiB allowance. A vision model loading onto a shared device could therefore be admitted without room for its own peak.Scope
runtime_headroom_gib: 4, the measured 3.6 GiB rounded up. On an L4 that gives 0.70 × total + 5 GiB ≈ 20.7 GiB, which still fits. GLM-OCR, LightOnOCR-2/3, PaddleOCR-VL, Qwen3-VL and Qwen3.5/3.6 have the same exposure, but each needs a measured peak before it gets a value.Tests
tests/adapters/test_sglang_memory.py:tests/config/test_sglang_memory_profiles.py: a profile'sadapter_options.loadtime.runtime_headroom_gibreaches the adapter's load reservation, and the checked-in GLM-OCR profile keeps its reservation.mise run test -- packages/sie_server/tests/config: 1685 passed, 525 skippedtest_sglang*.py): all passedmise run lintandmise run typecheck: clean🤖 Generated with Claude Code