mlx.core.metal.set_wired_limit

mlx.core.metal.set_wired_limit#

set_wired_limit(limit: int) int#

Set the wired size limit.

Note

  • This function is only useful on macOS 15.0 or higher.

  • The wired limit should remain strictly less than the total memory size.

The wired limit is the total size in bytes of memory that will be kept resident. The default value is 0.

Setting a wired limit larger than system wired limit is an error. You can increase the system wired limit with:

sudo sysctl iogpu.wired_limit_mb=<size_in_megabytes>

Use device_info() to query the system wired limit ("max_recommended_working_set_size") and the total memory size ("memory_size").

Parameters:

limit (int) – The wired limit in bytes.

Returns:

The previous wired limit in bytes.

Return type:

int