Skip to content

common : fit: size the MoE cache for -cmoe --moe-cache-mib auto - #380

Open
LeoBorcherding wants to merge 6 commits into
unslothai:moe-cache-auto-mainlinefrom
LeoBorcherding:night-shift-tester/251
Open

LeoBorcherding wants to merge 6 commits into
unslothai:moe-cache-auto-mainlinefrom
LeoBorcherding:night-shift-tester/251

Conversation

@LeoBorcherding

Copy link
Copy Markdown

Fix for #251 itself, targeting its branch: -cmoe --moe-cache-mib auto got no cache because the fit returned at no changes needed before the auto sizing ran.

  • 5d196fbd6, f06be43af: an override other than a lone --cpu-moe now warns instead of silently sizing nothing.
  • 344fc1817: a lone --cpu-moe gets the cache sized at that early return. It shares the sizing loop with the existing auto path.
  • 3ca685f4b: the log says "cache budget", since the cache caps itself at the host expert size.
  • 83c310142: on an integrated GPU, host-resident experts count against the target, since they share RAM with the cache. Without it, GLM-5.3-Flash on Strix Halo failed to allocate a 79924 MiB cache. With it, the cache is 11525 MiB and decodes at 12.5 tok/s.
  • 040c1bcf4: the cache is also sized when the fit only succeeds by shrinking the context.

Codex is clean on 040c1bcf4 (mirror). Measurements on L4, R9700 (Windows), RX 9060 XT and Strix Halo are in the #251 results comment. With the fix, -cmoe auto sizes the same cache as plain auto, and every cache run's greedy output is byte-identical to the all-GPU run.

…already fits

--cpu-moe already keeps every routed expert in host RAM, the placement auto
would choose itself, but the fit returned early with no changes needed and
left the free device memory unused. Size the cache there with the same loop
as the auto path; other overrides keep the warning.
…cated size

The cache caps itself at the size of the host experts, so with a lot of free
device memory the requested size overstated the cache several times over; the
llama_moe_cache log line right after it gives the real size.
On an iGPU (Strix Halo) the experts kept in host RAM and the device cache come
out of the same memory, so sizing the cache from device free memory alone asked
for an 80 GB cache on top of 80 GB of host experts and failed to allocate.
The single-device context-reduction return skipped the cache sizing, so
-cmoe --moe-cache-mib auto with an automatic context silently kept no cache.

This branch has not been deployed

No deployments
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