Repository navigation
GLM-5.3-Flash: TENSORFOLD_MEMORY_LIMIT_GB sets the one-Mac load limit on Metal - #580
BobClawblaw wants to merge 1 commit into
Conversation
… on Metal The native GLM engine refused the 4-bit checkpoint on one 256 GB Mac: its load limit was 70% of RAM (179.2 GB) with no override, and the language model alone is 180.6 GB. The limit now honours TENSORFOLD_MEMORY_LIMIT_GB as the Python engine does, capped at 90% of RAM; 70% stays the default. Refs ashhart#498.
|
Thank you, @BobClawblaw. We've settled the question this was waiting on: 70% of RAM stays the default, and a load past it is allowed only when you ask for it explicitly, with the risk named. One of the 256 GB Macs we test on had a watchdog panic on 6 Oct when a full GLM load wired about 181 GB, which is why we're careful here. Since you opened this, main gained |
|
Thank you, @BobClawblaw. We settled the question this was waiting on: 70% of RAM stays the default, and a load past it happens only when you ask for it, with the risk named. One of the 256 GB Macs we test on had a watchdog panic on 6 Oct when a full GLM load wired about 181 GB, which is why we're careful here. To keep one name, 601417f extends The commit credits you as co-author, with @heitke from #521. Thanks for the receipts here and in #498. I'm closing this in favour of 601417f. |
Refs #498.
Problem
The native GLM engine refuses
TensorFold/GLM-5.3-Flash-MLX-4bit-MTPon one 256 GB Mac before any weight is read.Engine.loadLimit()is fixed at 70% of RAM (179.2 GB), the language model alone is 180.6 GB, and nothing overrides the limit on Metal.Change
glm/config.zig:loadLimit(ram, budget). WithTENSORFOLD_MEMORY_LIMIT_GBset to a positive number, the limit is that many GB, capped at 90% of RAM. Otherwise it stays at 70%, so the default does not change.glm/engine.zig:loadLimit()readshw.memsizeand the variable and calls it. The refusal now names the variable.0, and text that doesn't parse.Receipts (M5 Ultra, 256 GB, macOS 27.0, this branch on
f6dbc6f)zig build test -Dcpu=apple_m1: 129/129 steps, 945/947 tests passed (2 skipped).GLM_LAYERS=4 --context 8192:TENSORFOLD_MEMORY_LIMIT_GB=2: refused, "9.6 GB of weights and 3.9 GB of caches pass this Mac's 2.0 GB load limit".TENSORFOLD_MEMORY_LIMIT_GB=40: loads and serves.A higher limit needs wiring on 256 GB
I'm sending this as a separate PR, since it's a separate change. With the limit raised and the full model loaded, past roughly 110 GB of freshly written buffers the GPU driver's wired collector hands the buffers no command has touched yet to the VM compressor. We saw up to 145 GiB compressed at normal pressure. Once, with a large file cache present as well, the load ended in a jetsam event that killed about 300 system daemons, and then the server.
With the weights wired (mlock) and resident before their reads, the same load takes 22 s instead of 80 s. The compressor stays flat, 183 GiB is wired, and pressure stays normal. I'll open that PR next, referencing #498.