mirror of
https://github.com/ollama/ollama.git
synced 2026-07-10 09:44:18 +00:00
* llm: fix ollama ps double-counting mmap'd weights on partial offload With mmap enabled, llama-server reports each CPU_Mapped model buffer as the file-offset span of its CPU-resident tensors. During partial offload that span covers nearly the whole file because the first and last tensors stay on CPU, so the parsed buffer sizes count the offloaded weights twice and ollama ps shows roughly 2x the real size with a false CPU/GPU split. Model weights can never exceed the model file on disk, so trim the excess over the file size from the mmap-backed portion when computing MemorySize. This makes the reported size independent of use_mmap; VRAM accounting and scheduler placement are unchanged. * llm: exclude repacked model buffers from the mmap overlap trim The trim that corrects mmap double-counting computed the overlap from all model buffers, including real copies such as CPU_REPACK. On a CPU-only repacked model that inflated the excess and trimmed the repack out, undercounting by the repack size (llama3.2 reported ~1918 MiB instead of ~3218 MiB). Compute the overlap from file-backed buffers only: mmap views and direct device copies, whose spans can overlap the file on partial offload. Repacked or host-pinned CPU copies are separate allocations that never overlap the on-disk weights, so leave them intact. Adds a CPU_Mapped + CPU_REPACK regression test and corrects the Metal case to the real total. |
||
|---|---|---|
| .. | ||
| exit_status.go | ||
| exit_status_other.go | ||
| exit_status_windows.go | ||
| llama_binary.go | ||
| llama_binary_test.go | ||
| llama_server.go | ||
| llama_server_test.go | ||
| llm_darwin.go | ||
| llm_linux.go | ||
| llm_windows.go | ||
| media.go | ||
| metal_retry.go | ||
| rocm_default.go | ||
| rocm_windows.go | ||
| server.go | ||
| server_wait_test.go | ||
| status.go | ||
| status_test.go | ||
| vulkan_windows.go | ||