mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #533] Hot VRAM resize: let the engine yield VRAM to other apps and take it back #252
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#252
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AXKore on GitHub (Oct 2, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/533
The engine sizes its VRAM budget once at start (expert cache + KV) and holds it for the whole run. On a desktop GPU shared with heavy apps (CAD, games), whichever starts second loses: WDDM evicts the engine's allocations to system RAM (decode collapses) or the other app fails. Issue #516 is the same pain on Linux; PR #380 adds a static WDDM budget; PR #378 makes K/V elastic inside the engine — but nothing yields VRAM to other processes yet.
Suggestion: an opt-in way to shrink the expert cache at runtime and hand the freed VRAM back, then reclaim it when it is free again. Even a coarse control would do — e.g. POST /vram {"reserve_gib": 8} on the API, or a simple half/full toggle, or STRATA_VRAM_FLOOR. The adaptive tier re-warms the returned experts quickly, and with expert_profile_save (#477) a shrink/re-grow cycle costs almost nothing.
Use case: an inference box that is also a workstation — run CAD or a game while inference keeps serving (slower, but functional) instead of fighting the driver for memory.
Environment: engine 0.1.36, Windows 11, RTX 4090 24 GB, IQ3_S 262K.
@XeonG commented on GitHub (Oct 2, 2026):
This would would be very useful to have, especially with less total vram available
@Niko1221 commented on GitHub (Oct 3, 2026):
Agreed, this would help on shared desktops, and #560 / #516 show the same problem on Linux. Keeping it open as planned work. The plan:
VRAM <reserve_mib>, that shrinks the cache to leave that much free and grows it back when the VRAM is free again. The adaptive tier re-warms the returned experts.POST /v1/vram {"reserve_mib": 8192}) and a config default, so a script or a hotkey can switch before a game or CAD session.It would never shrink or grow on its own. For now the static
--vram-reserve-mib N(0.1.37) is the way to leave room for another app.@Niko1221 commented on GitHub (Oct 4, 2026):
Added in 0.1.39, opt-in. Put
"vram_elastic": truein yourstrata-<model>.json(or start the engine with--vram-elastic): the expert cache is then allocated in 512 MiB segments ("vram_segment_mib"changes that). Between requests,POST /v1/vramwith{"reserve_mib": 8000}shrinks the cache until 8000 MiB of VRAM is free for the other program,{"reserve_mib": null}grows it back while keeping the reserve the engine started with, and{"reserve_mib": 0}takes everything back. A request that is running finishes first, and nothing resizes on its own.The experts in the segments it gives back run on the CPU meanwhile, so answers keep coming, only slower. Growing back puts the same experts in the same slots. On an RTX 5070 with Q2_0,
reserve_mib: 6000freed 4.3 GiB in 78 ms (decode went from 44 to 33 tok/s), and after growing back the answers were token for token the same as before. Without the key nothing changes. For now it needs one NVIDIA GPU: no layer split, helper caches,--peer-deviceor resident low-RAM mode, and no AMD. Details: docs/DETAILS.md, "Sharing the GPU with other programs".