Changing Mac Unified Memory GPU limit
Category: macos, year: 2023
Apple Silicon Macs (M-series CPUs) have “unified memory”, where the the CPU and GPU can share the same core memory.
By default however (at least on MacOS 13 and 14), the amount of memory that can be “wired” or allocated to the GPU is only around 66-75% of the total system memory (the ratio depends on the amount of system memory), but it’s possible to change this and increase the amount of memory the GPU can access.
On MacOS 14 - Sonoma:
sudo sysctl iogpu.wired_limit_mb=27700
On MacOS 13 - Ventura:
sudo sysctl debug.iogpu.wired_limit=27700
Will allocate just over 27 GB of memory to the GPU, while still leaving a bit left dedicated to the CPU.