mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
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#2693
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/563
Author: @Mirtraxxx
Created: 10/2/2026
Status: ❌ Closed
Base:
main← Head:expert-cache-release📝 Commits (1)
047da7dGive the expert cache's VRAM back without unloading the model (#533)📊 Changes
7 files changed (+495 additions, -5 deletions)
View changed files
📝
CMakeLists.txt(+2 -1)📝
docs/DETAILS.md(+27 -1)📝
include/strata/core/expert_cache.hpp(+23 -0)📝
serve/server.py(+103 -0)📝
serve/test_lifecycle.py(+44 -1)📝
src/core/expert_cache.cpp(+172 -2)📝
src/program/generate.cpp(+124 -0)📄 Description
Addresses #533 for the expert cache, the largest part of the VRAM: the engine gives the cache's VRAM back to other programs and takes it again, while the model, the context and the conversation cache stay loaded.
What it does
--expert-cache-release(off by default). The expert cache is allocated with CUDA's virtual memory API (cuMemAddressReserve+cuMemCreate/cuMemMap) instead ofcudaMalloc. Two new serve-loop commands:RELEASE: every resident expert is marked not resident (and remembered), then the physical memory is unmapped and freed. The address range stays reserved, so the captured graphs and the experts' pointers stay valid.REFILL: new physical memory is mapped at the same address, and the remembered experts are copied back into the same slots from the host copy. The residency table is restored as it was.GEN/GENIthat arrives while the cache is released refills it first, so a client needs nothing new.POST /cache/releaseandPOST /cache/refillanswer409while a request is running and400when the engine can't (e.g. started without the option).--cache-release-idle SECONDS/"cache_release_idle_s"gives the cache back after that many seconds without requests. It adds the engine option itself, and it works like--idle-unloadbut keeps the model loaded.Measured
RTX 3090 24 GB, Windows 11, driver 616.56, a Qwen3.8-Flash-Next fine-tune at IQ2_XS,
--expert-cache auto, MTP on:STRATA_VERIFY_REFILL=1reads every refilled slot back)serve/test_lifecycle.pygets three tests: the endpoints, the idle wait, and the engine flag being added.test_server,test_lifecycle,test_monitorandtest_structuredpass (140 tests).Limits
/unloadis still the way to free everything.#if-guarded, andCUDA::cuda_driveris only linked in the CUDA build.The idea and the use case are AXKore's in #533 (a CAD/games workstation). Mine is an LLM sharing a 3090 with ComfyUI.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.