Summary
With Gemma 4 E4B Q4_K_M (4.64 GiB GGUF) loaded through geist_model_load_from_memory, peak RSS goes far beyond one copy of the weights on the CPU and Metal backends. The model bytes are a single verified, read-only, page-aligned anonymous mapping owned by the caller. The header says these bytes are aliased zero-copy. The extra memory therefore has to come from backend-side copies.
| Backend |
Host |
Peak RSS (whole process) |
| file size |
|
4.64 GiB |
vulkan |
Ryzen 9 9950X + RTX 2080 Ti, Linux |
6.74 GiB |
auto (cpu_x86, 16 threads) |
same host |
11.66 GiB |
metal |
M1 Max (64 GB) |
10.6 GiB |
Measured with HELIO (--ai-bench, peak ru_maxrss of the process including its ~1 GiB game state) at geistlib 7a0b421.
Impact
HELIO targets the Steam Deck (16 GB, shared with the GPU) and Macs with 16 GB. Above ~6 GiB the game cannot ship this model there. The CPU path is the Deck fallback.
Hypotheses (unverified)
Requests
Related: #468 (vulkan resident mmap), #504 (cpu_x86 prefill).
Summary
With Gemma 4 E4B Q4_K_M (4.64 GiB GGUF) loaded through
geist_model_load_from_memory, peak RSS goes far beyond one copy of the weights on the CPU and Metal backends. The model bytes are a single verified, read-only, page-aligned anonymous mapping owned by the caller. The header says these bytes are aliased zero-copy. The extra memory therefore has to come from backend-side copies.vulkanauto(cpu_x86, 16 threads)metalMeasured with HELIO (
--ai-bench, peakru_maxrssof the process including its ~1 GiB game state) at geistlib7a0b421.Impact
HELIO targets the Steam Deck (16 GB, shared with the GPU) and Macs with 16 GB. Above ~6 GiB the game cannot ship this model there. The CPU path is the Deck fallback.
Hypotheses (unverified)
q4k_to_w4a8,q4k_to_q4kx8) and keeps the original tensors as well. That would roughly double the weights.MTLBuffers with copies (newBufferWithBytes) rather thannewBufferWithBytesNoCopyon the page-aligned host memory. On unified memory both are resident.Requests
load_from_memoryand forload(path).newBufferWithBytesNoCopywhere alignment allows.Related: #468 (vulkan resident mmap), #504 (cpu_x86 prefill).