Repository navigation
GLM-5.3-Flash: resident and wired before the weights are read - #581
BobClawblaw wants to merge 1 commit into
Conversation
GLM_RESIDENCY now requests the residency set before the parallel reads instead of after them, and the new GLM_WIRE wires every buffer (mlock) before it fills. Past roughly 110 GB of freshly written buffers on a 256 GB Mac, the GPU driver's wired collector handed the buffers no command had used yet to the VM compressor. Refs ashhart#498.
|
Thank you for these measurements; the compressor numbers match what we've seen of the GPU driver's wired collector. We can't take this one yet. |
Refs #498. This is the companion to #580: it makes a raised one-Mac limit safe to use on a 256 GB Mac.
Problem
Loading the full 4-bit checkpoint on one 256 GB M5 Ultra (with #580 and
TENSORFOLD_MEMORY_LIMIT_GB=200) wrote about 168 GiB into fresh shared buffers. Past roughly 110 GB, the VM compressor started taking those buffers, even at memory pressure level 1.vm_statshowed 123-145 GiB "occupied by compressor", growing as the load went on. It looks like the GPU driver's wired collector reclaiming buffers that no command buffer has used yet.GLM_RESIDENCYdidn't help, because the set was requested only after the reads, by which point the pages were already compressed.One load with a large file cache present ended in a jetsam event ("low-swap"): about 300 system daemons were killed, then the server.
Change
weights.loadtakes the residency set and awireflag. WithGLM_RESIDENCY, the weight buffers join the set and residency is requested beforerunCopiesreads anything. The caches and scratch join after the load, as before.GLM_WIRE(new, opt-in): every buffer, caches first, is wired withmlockbefore it fills. A refused wire, for example pastvm.user_wire_limit, fails the load with a log line instead of loading a model the VM can page.Receipts (M5 Ultra, 256 GB, macOS 27.0)
zig build test -Dcpu=apple_m1on this branch: 129/129 steps, 944/946 tests passed (2 skipped).GLM_LAYERS=8 GLM_WIRE=1 GLM_RESIDENCY=1: wired memory rose by 28 GiB (process footprint 32 GB). It served a request, and the 28 GiB was released at exit.TENSORFOLD_MEMORY_LIMIT_GB=200), on 1.0.3/1.0.4 with the same change:GLM_RESIDENCYonly (requested after reads)GLM_RESIDENCYrequested before readsGLM_RESIDENCY+GLM_WIREA 35-layer wired load (about 140 GB) kept the compressor flat at 1.5-1.7 GiB. An unwired load of the same size was already compressing.
The existing comment's caution still applies: wiring about 181 GB leaves macOS nothing to reclaim if another model shares the Mac. That's why both variables stay opt-in.