Repository navigation
Let users size the CUDA memory budget with TENSORFOLD_MEMORY_RESERVE_GIB and TENSORFOLD_CUDA_MEMORY_LIMIT_GB - #165
eleqtrizit wants to merge 4 commits into
Conversation
f484150 to
09544fd
Compare
|
@ashhart Please review. This maintains the current default but lets users override with env var. I run a headless linux hosting box (as many due), and don't want to leave free context on the table. |
|
Part of this is in TensorFold 0.6.3, with your commits under your name in the release history: https://github.com/ashhart/TensorFold/releases/tag/v0.6.3 In 0.6.3: Not in 0.6.3: the two commits you pushed tonight, which make We are leaving this open and will review the override and the startup claim for the next release. Headless boxes that want the whole card are a real case. Thank you, @eleqtrizit! |
…up budget The line names the allocator's budget in GiB, above or below free memory; no reserve is subtracted, and the estimate takes the CUDA context, its kernels and streams (about 2 GiB) out, floored so a tiny line still serves something. The memory gate and the planned and lone-stream copy-peak caps count the same tensor budget, and adaptive tests cover the arithmetic on the host, without GPU imports.
With the line set, a filler of the bytes the tensors have not taken is allocated and handed back to the allocator without an empty_cache, so the request caches reuse the reserved room: nvidia-smi shows the line's figure while the GPU idles.
67c6882 to
68160d7
Compare
|
Thank you, @eleqtrizit. The Python engine is frozen (#286), and this sizes only its CUDA memory budget, so it won't land there. On the Zig engine it waits for Zig CUDA serving, which doesn't exist yet. Zig CUDA today is a Nemotron bring-up run from the command line, with no server and no memory gate to size. When serving comes, the split you made is the one to keep: a reserve held back, a hard limit that replaces the free-memory figure, and a limit line that prices in what lives outside the tensor allocator. That carries your credit. |
|
@eleqtrizit, a correction. When we closed this we wrote that it wouldn't land. It had already shipped: your three commits are in 0.6.3 under your name. And the native CUDA engine now sizes its memory budget with your As of f930fbb you are a co-author on main for it, and the credits page names #165 beside the native file. Sorry for the wrong close, and thank you for the budget split we still use. |
TensorFold's CUDA server keeps back part of the GPU's memory so requests don't crash
against the card's limits mid-reply. Until now that reserve was fixed, and the amount
of memory you could ask for was likewise fixed. This PR lets you set both.
What it does:
TENSORFOLD_MEMORY_RESERVE_GIB. It sets how muchmemory the server holds back on the GPU and on the host, in GiB. The default stays
max(4 GiB, a tenth of the memory). A value below 2 is refused at startup.TENSORFOLD_CUDA_MEMORY_LIMIT_GB. It is a hardoverride in GiB: the startup budget is exactly that many GiB, replacing both the
reserve and the free-memory figure, and it can raise the budget as well as lower it.
Whoever sets it owns the headroom; a budget past what the card holds ends startup
or requests with CUDA out-of-memory errors.
CUDA context, kernels and streams, and the allocator's reserved-but-unallocated
slabs, measured at 2 GiB on a 27B Qwen3.8 serve. An admitted checkpoint then fits
its GiB as nvidia-smi shows it, without serving-time OOM. A tiny limit still serves
something: the least budget is 2 GiB.
the already-reserved segments, so nvidia-smi shows the limit's figure while idle and
no cache growth later asks the driver for memory admission did not count.
so requests still cannot take what the card does not have.
same tensor budget, so cache growth stays inside the line it was admitted against.
Tests cover both variables, the refusals for invalid values, the 2-GiB floor, and how
the reserve and the limit combine. README, RUNBOOK, docs/api.md, the CUDA recipe, and
the changelog document all of it.
The branch is rebased on upstream main (v0.6.5).