mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #192] GLM expert pool sizing: --expert-cache auto|N and --vram-reserve-mib in the config, checked once the pool is written #385
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#385
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/mw00/project-maya/pull/192
State: closed
Merged: Yes
What this changes
A GLM pack's expert pool already took the free VRAM less a fixed 700 MB.
--expert-cacheand--vram-reserve-mibin aconfig were parsed and then ignored; only
STRATA_GLM_RESERVE_MBin the environment changed anything. This makes thepool's size a setting in the config's
"args":--expert-cache auto(the default; the setup now writes it into every config): the pool takes the free VRAM lessthe reserve, as before, and then checks that budget once it is written. The budget is allocated in 1 GiB pieces
and zeroed, and the free VRAM is read again. If the card is short of the reserve, the pool gives back the
difference and is checked again (up to six times). If the driver refuses a piece, the budget ends at what it gave.
Under Windows an allocation counts only once it is touched, so the free figure read before it can be about 1 GB
high, and a card filled past it pages GPU memory to system RAM instead of failing: the start looks normal and
decode is several times slower. On Linux the figure is exact and the check gives nothing back.
--expert-cache N(the user's own value): the first GPU's pool holds at most N of its largest experts; asplit's later GPUs stay on auto. It is not checked once written.
--vram-reserve-mib N: the VRAM kept free beside the pool (default 700 MiB, 1024 on a Linux APU), and--vram-reserve-later-mib Nfor a split's later GPUs. Given in the args, they win over the environmentvariables, which keep working.
layer lowers the reserve as far as 300 MiB and says so. A reserve set by hand is kept.
Glm5Model::pool_budget) sizes the prompt path's chunk, the pool and the layer-split search, sothey agree, the check's correction included.
maya serve: CUDA0: ... MiB of VRAM free with everything loaded). Below 256 MiB (512 on a later GPU) the line addsLOWand the reserve that would leave room."--expert-cache", "auto"in every config, a new--vram-reserve-mib Noption, and a setup again keepsall three settings as they were edited.
docs/SETTINGS.md"The expert pool's size", adocs/SETUP.mdrow, adocs/WINDOWS.mdnote.Measured
EXL3-4.05bpw with the DFlash2 drafter, 32K context, a short greedy run (three questions, 256 tokens each).
--expert-cache autoSTRATA_GLM_POOL_CHECK_TEST_MB=1024) +--vram-reserve-mib 1000--expert-cache 600--expert-cache auto--vram-reserve-later-mib 400LOW--expert-cache 1500On Linux the sizing is the same as before: the check gives nothing back, the 3090 keeps 1,231 slots and nine GPUs
keep 10,839. With the free figure faked 1 GiB high, the pool gave back 1.04 GB, the prompt chunk was sized from the
same corrected figure (32,768 -> 31,232 tokens), and the card ended with the reserve plus the faked gigabyte free.
One thing the start-up line showed: the 3090 alone with DFlash2 had 431 MiB free at start and 77 MiB after the first
request, because the drafter's verify windows allocate on first use, after the pool is sized. That is fine on Linux,
where a full card fails an allocation instead of paging. On Windows it is a reason to raise the reserve, and
docs/WINDOWS.mdsays so.Tests
tests/glm_memory_test.cpp: the small-card reserve and the check's give-back (glmfast::pool_reserve,glmfast::pool_give_back).tools/test_maya_prefill.py:--expert-cache autoin every config, and a hand-set number and the reserves kept by asetup again.