Repository navigation
Conversation
…idency available_bytes bounded the startup budget by min(GPU free, host MemAvailable). The CUDA loader streams -- one tensor at a time through host staging and .to(dev) -- so the host never holds the checkpoint, but the bound demanded it. A host with more VRAM than RAM (several cards, modest memory) could not start any model larger than its RAM, at any context size: the refusal came before a single weight was read. The host now gets its own streaming bound, host_stream_bytes(): MemAvailable - 2 GiB, which covers the staging buffers (already counted in weights.staging, 3x the largest layer) and reclaimable page cache, never the resident weights. When /proc/meminfo is unreadable the caller keeps the conservative min(GPU, host) bound, so nothing changes where the reading is unavailable. make_plan takes host_free alongside the budget: 0 (staging does not fit) refuses with the existing error; otherwise only the device budget bounds the window. admit also takes peer_bytes so N ranks on one machine can reserve each other's share of the device instead of racing each other's allocations during the estimate: each rank passes (N-1) * (footprint / N), and both ranks then agree on one stable window. Every deployment that already passes admission still passes: its host RAM held the weights, so the old bound was satisfied and the new one is strictly looser on the host. Unified-memory Macs count their one pool once and were never affected. Measured on a host with two 96 GB cards and 64 GB of RAM, a GLM-5.3-Flash EXL3 3-bit checkpoint (~100 GB): before, 'largest fitting prompt-plus-reply window: 0 tokens' at every context size; after, the full 262,144-token window with both ranks loading in ~50 s and serving at 125-128 tok/s. Tests: tests/test_cuda_capacity_streaming.py pins the contract through make_plan with mocked mem_get_info and /proc/meminfo readings -- a host whose RAM is smaller than the weights admits a window; a host that cannot hold staging refuses with 0; the budget alone sets the window; and the streaming bound never shrinks a host that has room to spare.
|
Thanks, @akol1. This makes sense for discrete GPUs with less RAM than VRAM: the loader streams one tensor at a time, so the host only needs the staging buffers, not the checkpoint. It came in after today's 0.6.0 cutoff, so it goes into 0.6.1. 0.6.0 runs on RTX 40 cards, so we'll test it on a rented one there. One thing we'll check first: on a GB10 the host and the GPU share one pool, and that budget has to stay exactly as it is. |
|
Thanks, this is landed for 0.6.1 with your commit and name. On a discrete GPU, admission now checks host RAM against the staging buffers a load streams instead of the whole checkpoint, and refuses before loading if even those don't fit. On a GB10, where host and GPU share one pool, the budget is computed exactly as before: every reply SHA matched before and after, resumed and concurrent ones included. We reproduced the discrete-GPU case in host tests rather than on a card, so a run of 0.6.1 on yours, once it's out, would confirm it end to end. It ships with 0.6.1, and we'll close this then. |
|
This is in TensorFold 0.6.1, with your commits under your name in the release history: https://github.com/ashhart/TensorFold/releases/tag/v0.6.1 Thank you, @akol1! |
Patch 1 — streaming admission (
src/tensorfold/cuda/capacity.py)Problem.
available_bytesbounds the startup budget bymin(GPU free, host MemAvailable). The CUDA loader streams — one tensor at atime through host staging and
.to(dev)(families/*/cuda/weights.py) — sothe host never holds the checkpoint. But the bound demands it: a host with
more VRAM than RAM cannot start any model larger than its RAM, at any context
size. A unified-memory Mac counts its one pool once and was never affected;
a discrete-GPU host with modest RAM was bound by the host reading regardless
of how large its GPUs are.
Change.
host_stream_bytes(): the host needs the staging buffers (already countedin
weights.staging, 3× the largest layer) and reclaimable page cache —not resident weights. The bound is
MemAvailable − 2 GiB,Nonewhen/proc/meminfois unreadable, in which case callers keep the conservativemin(GPU, host)behavior.available_bytes(torch, peer=0): the device budget as before, minus anoptional reservation.
make_plan(..., host_free=None):host_free == 0(staging does not fit)refuses with the existing 0-token error; otherwise only the device budget
bounds the window.
admit(..., peer_bytes=0): lets N ranks on one machine reserve each other'sshare so they agree on a stable window instead of racing each other's
allocations mid-measurement.
Every model that already passes admission still passes: its host RAM held the
weights, so the old bound was satisfied and the new one is strictly looser on
the host. The device bound is identical. Unified-memory hosts are unaffected.
Reserve observation. The device reserve is
max(4 GiB, total/10). On96 GB cards that is 9.5 GiB, and the admitted window went from 226,781 to the
full 262,144 tokens when we ran at 5% instead — decode was stable both ways.
A knob (or a documented rationale) for the fraction would help hosts whose
VRAM-to-RAM ratio is unusual. Not included here: it changes refusals for
existing deployments and deserves its own discussion.
Test file:
tests/test_cuda_capacity_streaming.py— the streaming admission contract throughmake_planwith mockedmem_get_infoand/proc/meminforeadings; no device needed for the pure-math cases.