Module predicted_residency

Module predicted_residency 

Source
Expand description

That table evaluated BEFORE the checkpoint loads, so preflight can size the SSM decode ring against the predicted post-load KV headroom (#915). The derived-weight residency of the native-FP8 dense route, predicted from config.json alone — BEFORE the checkpoint loads.

WHY (#915 second pass). fp8_residency::DerivedResidency tallies the derived copies as the loader builds them, which is four minutes too late for the one decision that needs the number: preflight’s SSM decode-ring auto-fit runs before the first byte of the checkpoint is read, and its first pass therefore fitted the ring against PRE-LOAD free memory (78.6 GB on an 80 GB H100) instead of against the post-load KV headroom the KV budget stage actually enforces. Measured on 1xH100 2026-09-11 (h100-round2-report.md, stage 3/5): at --max-batch-size 16 and 32 the fitter stayed silent — 8 slots, 18.94 / 37.88 GB of ring — and the serve was refused minutes later by factory/build.rs’s No memory left for KV cache. The fit needs the post-load figure, and the only part of it that is not already known at preflight is how many bytes the loader will derive on top of the checkpoint.

It IS knowable: every derived copy on this route is shape arithmetic over the config, and which copies get built is fp8_residency::DenseFp8Plan::resolve, a pure function of the environment plus one backend question (are the two W8A8 prefill kernels loaded). This module evaluates both without a WeightStore.

Round-6 receipt (h100-round6-report.md; serve I, Qwen3.8-27B-FP8, ATLAS_DENSE_FP8=1, --lm-head-dtype bf16, tp 1): the loader’s own summary line reported derived 4.24 GB on top of a 28.75 GB checkpoint. Reproduced here from kernels/gb10/qwen3.8-27b/MODEL.toml’s shapes, plus the GDN head geometry, which no MODEL.toml carries and which ModelConfig therefore reads from the checkpoint’s own config.json (16x128 key heads, 48x128 value heads):

termper layerlayerstotal
attn FP8 K twin + V twin10,488,320 B160.168 GB
SSM fused [QKV|Z] FP8 weight83,886,080 B484.027 GB
SSM [QKV|Z] + out_proj block scales28,160 B480.001 GB
SSM in_proj_ba interleaved BF16983,040 B480.047 GB
total4.243 GB

Q and O twins are absent from that total because the round-6 target ships both W8A8 prefill kernels, so DenseFp8Plan declines them — which is why Fp8RouteInputs::w8a8_prefill_kernels is an input and not an assumption.

What this module deliberately refuses to predict. Anything that re-opens an NVFP4 fallback (ATLAS_DENSE_FP8_KEEP_NVFP4, the ATLAS_CUTLASS_NVFP4_* levers, ATLAS_ATTN_W4A4) returns DerivedBytesEstimate::Unavailable rather than a guess: those paths resurrect 18+ GiB of copies whose byte count the loader tallies through skip, not keep, so a prediction built on keep would be wrong by more than the quantity being predicted. The caller falls back to its pre-load behaviour and says so in the log.

Structs§

Fp8RouteInputs
The route gates load_layers applies, resolved from the things that exist before the checkpoint does.
PredictedDerived
The derived bytes the native-FP8 dense loader will allocate and KEEP, broken out so the preflight log can name each term.

Enums§

DerivedBytesEstimate
The answer, or an honest refusal to answer.

Functions§

predicted_derived_bytes
Bytes the native-FP8 dense loader will derive on top of the checkpoint.