Repository navigation
Conversation
…21#533) --expert-cache-release backs the expert cache with CUDA virtual memory, so the serve loop can hand its physical memory back (RELEASE) and take it again (REFILL) at the same device address: the captured graphs and the experts' pointers stay valid, and the model, context and conversation cache stay loaded. A request that arrives while the cache is released refills it first. The server adds POST /cache/release and /cache/refill, and --cache-release-idle / "cache_release_idle_s" gives the cache back after that many seconds without requests (it turns the engine option on itself). Measured on an RTX 3090 (Windows 11): 14.5 GiB given back in ~50 ms, refilled in 1.7-2.5 s, 0 of 10,800 slots different from their host copy after 3 cycles. CUDA only; HIP, a layer split and the resident RAM mode keep the cache as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Linux data point, and a use you may not have planned for: we use Setup: engine B owns GPU0 with Measured on Linux (driver 595, CUDA 13), 3090:
Two notes from that use:
Thanks — this was the missing primitive for us. |
|
Closing: v0.1.39 shipped #533 as @q8atnight thanks for the data points. Your engine B (one GPU, |
…ndows streamed, landings in recent slots (#476 RubenTorney) With the lane on (DS4_STREAM=1) and one discrete NVIDIA GPU, the CPU lane's RAM copies are pinned and the fetch kernel pulls a streamed expert where it lies; a verify window's experts stream too and land in a recent slot, so the link's bytes stay in VRAM. Gating and follow-ups: one-GPU path only where experts stream (1b60249, 482e46c #496, 7c0ceb1 #551, mw00), no landing while the swap is pending and a table-update wait (32f3c8c handmade0octopus), a failed fill is never published (#646 handmade0octopus), Windows with pin by need (#567 TheSmokeDev), HIP pull clock on gfx11/gfx12 and DS4_IQ1S_ROWS (#563 Cass, mw00). Everything stays behind DS4_STREAM=1; DS4_RAM_SKIP_W (changes answers) is opt-in. Not ported: the helper-GPU condition (#415). Built on CUDA sm_120; model identity/A-B not run yet.
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