Skip to content

fix: place a model too big for the box, and stop instead of silently … - #107

Merged
WestWaters merged 2 commits into
mainfrom
fix/placement-and-measure-or-stop
Sep 18, 2026
Merged

WestWaters merged 2 commits into
mainfrom
fix/placement-and-measure-or-stop

Conversation

@WestWaters

Copy link
Copy Markdown
Owner

…going uniform

pollard-probe pinned the whole model to one device, so the first model bigger than the accelerator OOM'd (Gemma4 12B: 22.3GB onto a 16GB Mac). plan_placement measures the weights first: fits the accelerator -> use it; fits RAM -> CPU; fits neither -> shard and offload the tail to disk. --device now defaults to auto (cuda > mps > cpu) rather than mps.

Both callers then swallowed the failure. _ensure_sensitivity fell back to a uniform allocation, which pollard-fit itself warns has no quality win, and _ensure_imatrix never checked llama-imatrix's exit code -- so a missing imatrix stayed invisible until llama-quantize could not open it. Both now stop. Uniform is available on purpose via --no-measure.

--ngl gains 'auto': offload the share that fits and stream the rest, instead of a static 99 that is fatal on a model bigger than the accelerator.

Apple Silicon is unified memory, so the GPU and CPU budgets must not be summed. Windows has neither sysconf nor /proc, so detect_available_ram_gb returned None there and every budget decision on the build box was made blind; both paths now read RAM on all three platforms.

Tests: 4 regressions (63/63).

…going uniform

pollard-probe pinned the whole model to one device, so the first model bigger
than the accelerator OOM'd (Gemma4 12B: 22.3GB onto a 16GB Mac). plan_placement
measures the weights first: fits the accelerator -> use it; fits RAM -> CPU;
fits neither -> shard and offload the tail to disk. --device now defaults to
auto (cuda > mps > cpu) rather than mps.

Both callers then swallowed the failure. _ensure_sensitivity fell back to a
uniform allocation, which pollard-fit itself warns has no quality win, and
_ensure_imatrix never checked llama-imatrix's exit code -- so a missing imatrix
stayed invisible until llama-quantize could not open it. Both now stop. Uniform
is available on purpose via --no-measure.

--ngl gains 'auto': offload the share that fits and stream the rest, instead of
a static 99 that is fatal on a model bigger than the accelerator.

Apple Silicon is unified memory, so the GPU and CPU budgets must not be summed.
Windows has neither sysconf nor /proc, so detect_available_ram_gb returned None
there and every budget decision on the build box was made blind; both paths now
read RAM on all three platforms.

Tests: 4 regressions (63/63).
pollard_probe imports torch at module scope, so importing it at the top of a
test hard-fails on CI. The cross-platform memory assertions are a source scan
and need no torch at all -- CI is precisely the machine that would otherwise
let a POSIX-only probe through -- so those now run unconditionally, and only
the live calls sit behind the suite's existing torch skip.
@WestWaters
WestWaters merged commit 99fef11 into main Sep 18, 2026
1 check passed
@WestWaters
WestWaters deleted the fix/placement-and-measure-or-stop branch September 18, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant