Conversation
iogpu.wired_limit_mb is 0 on every unmodified Mac, so _detect_iogpu_wired_limit_bytes() returns None and the whole of physical memory ends up reported as GPU-addressable. #153 fixed the case where the user had explicitly raised the limit; the default path was still wrong. recommendedMaxWorkingSetSize is the budget macOS actually enforces, and it is not exposed through sysctl or system_profiler — the Metal API is the only way to read it. Read it through ctypes against the system Metal and objc libraries, so this adds no dependency, and apply it only when no explicit wired limit is set (an explicitly raised limit stays a deliberate user choice). Measured on a 16 GB M4 (MacBook Air, macOS 26): before: Apple M4 — 16.0 GB shared (budget 15.2 GB) after: Apple M4 — 11.8 GB shared (budget 11.2 GB) Metal: 12713115648 bytes = 11.84 GiB llama.cpp agrees: ggml_metal_log_allocated_size (3927.89 / 12124.17) The inflated budget is not cosmetic: it put two models at the top of the recommendations that cannot load at all on this machine (14.4 GB and 14.0 GB against an 11.84 GiB ceiling). Both disappear after the fix, and the top pick becomes one that actually runs. Completes #152. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Withdrawn by the author.