server: also free backend on sleep - #25265
Conversation
|
I always hate doing this (because it feels like it can come off as disrespectful to be given back an AI trace), you don't need to read it, but this is quick summarization of an initial investigation against my hardware: The tl;dr that I still need to do more digging on is that it might be driver level, as I can't even get hipDeviceReset to free these resources. AI InvestigationWhat PR #25265 changes. It wraps So at present it releases quantization-related host state and does not itself tear down device contexts, memory pools, or loaded GPU kernels. The CUDA/HIP backend also has no Measurements on this rig (
Interpretation. The residual VRAM in these probes is dominated by BLAS kernel-object memory rather than model weights or ggml pool allocations. In this setup it persisted across buffer frees, handle destruction, and a device reset. This suggests the sleep-time residual you observed is largely driver/library-level memory that the current software teardown path (model unload + |
|
yes, I looked into implementing real if you can confirm if calling |
|
I have a better prototype that works on CUDA with |
|
@DEV-DUFORD PTAL #25271 tested on CUDA: nvtop reports 0 memory usage on sleep |
Overview
Call
llama_backend_free()on sleepAs a side effect of this change,
llama_backend_init()is not longer called on router mode (which is expected)Requirements