Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/guides/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ See [backend selection](./backend.md) for full syntax.

`--offload-to-cpu` keeps the source parameters in system RAM and creates compute-side GPU replicas on demand. Unpinned replicas remain resident for reuse, but automatic graph-cut execution evicts them from the last segment backward when the next weight or compute allocation needs space. Disk-backed parameters follow the same policy without retaining a RAM source copy.

On Vulkan, CPU-offloaded weights use pageable system RAM, leaving the driver's host buffer capacity available for transfers.

When a graph has cut markers and its missing weights plus incremental compute workspace exceed the available device headroom, it runs its fixed segment list in order. An existing monolithic workspace can be reused without a new allocation. An explicit `--max-vram` budget includes resident managed weights, compute and cache buffers registered by runners sharing the device, and ggml's idle buffer pool. The current segment's weights are pinned during compute, and the next parameter-bearing segment is prefetched when the device supports asynchronous transfer. No opt-in streaming flag is required.

When choosing between monolithic and segmented execution, the runner requires
Expand Down
4 changes: 3 additions & 1 deletion src/model_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,10 @@ ggml_backend_buffer_type_t ModelManager::params_buffer_type_for(const TensorStat
ggml_backend_buffer_type_t params_buft = nullptr;
if (state.compute_backend != nullptr && state.params_backend != state.compute_backend &&
sd_backend_is_cpu(state.params_backend)) {
// Vulkan host buffers are driver allocations. Keeping offloaded weights in them
// can exhaust Vulkan memory even after their device copies have been evicted.
ggml_backend_dev_t compute_dev = ggml_backend_get_device(state.compute_backend);
if (compute_dev != nullptr) {
if (compute_dev != nullptr && !sd_backend_is(state.compute_backend, "Vulkan")) {
params_buft = ggml_backend_dev_host_buffer_type(compute_dev);
}
} else if (state.params_backend == state.compute_backend) {
Expand Down
Loading