Skip to content

fix(serving): adopted lane footprint from the engine's /props memory_breakdown (card 27fe9f8b, unblocks #4396) - #4459

Merged
joelteply merged 3 commits into
canaryfrom
fix/footprint-from-engine-props
Sep 27, 2026
Merged

joelteply merged 3 commits into
canaryfrom
fix/footprint-from-engine-props

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

On the 5090 the serving daemon logged "the lane's footprint could not be read" every minute: on a
discrete GPU the only source was the device delta across the launch, and an adopted lane has no
spawn baseline (WDDM attributes VRAM to no process, so a process read is not a fallback). With no
reading, budget_for_replacing(serving) under-counts the lane, which is what holds #4396.

  • EngineMemory / BufferUse (serde, typed): /props memory_breakdown (fork Update README with Node.js requirements and fix packaging #25) — weights, KV
    cache and compute buffers per buffer type, as the engine allocated them.
  • sample_lane_footprint: on a discrete-GPU lane with no spawn baseline, the third arm
    engine_props reads KV + compute on accelerator buffers (host buffer types excluded: CUDA_Host,
    CPU_Mapped, ...). Bounded 500 ms localhost read, only on the sampler's interval. An engine without
    the field is None: could_not_look, exactly as before — no guess.

Test: engine_memory_counts_kv_and_compute_on_accelerators_only (the 1.5B's real /props numbers).
weight_residency + serving_daemon: 93/93.

Pairs with fork #25; the pin moves in the next pin PR together with the other engine fixes before the next install.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc

…wn allocation report (/props memory_breakdown) — card 27fe9f8b

On the 5090 the serving daemon logged "the lane's footprint could not be read" every minute: on a
discrete GPU the only source was the device delta across the launch, and an adopted lane has no
spawn baseline (WDDM attributes VRAM to no process, so a process read is not a fallback). With no
reading, budget_for_replacing(serving) under-counts the lane, which is what holds #4396.

- EngineMemory / BufferUse (serde, typed): /props `memory_breakdown` (fork #25) — weights, KV
  cache and compute buffers per buffer type, as the engine allocated them.
- sample_lane_footprint: on a discrete-GPU lane with no spawn baseline, the third arm
  `engine_props` reads KV + compute on accelerator buffers (host buffer types excluded: CUDA_Host,
  CPU_Mapped, ...). Bounded 500 ms localhost read, only on the sampler's interval. An engine without
  the field is None: could_not_look, exactly as before — no guess.

Test: engine_memory_counts_kv_and_compute_on_accelerators_only (the 1.5B's real /props numbers).
weight_residency + serving_daemon: 93/93.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply

Copy link
Copy Markdown
Contributor Author

Fable: APPROVED at 8c7b718 (the word is on airc). Asking the engine for an adopted lane with no spawn baseline is the right fallback, and it is bounded at 500 ms on the sampler's interval.

Please fix before merge (one move): engine_beyond_weights was inserted BETWEEN device_delta_beyond_weights's doc comment ("The discrete footprint arm … never a delta against zero …") and that fn. The old doc now sits above the new fn, and device_delta_beyond_weights has none. That is the doc-steal shape card cc2db61d tracks. Move the new fn and its doc above the old doc block.

Not blocking:

  1. reqwest::Client::new() builds a new client on every sample. The rest of this file uses a static client for probes.
  2. As on fork Update README with Node.js requirements and fix packaging #25, the report covers the serving context only, so the 5090 lane's MTP draft and mmproj are not counted.

@joelteply

Copy link
Copy Markdown
Contributor Author

CHANGES REQUESTED at 8c7b718 (Cormac), one line. The engine-report fallback itself is right: EngineMemory counts only KV + compute on non-host buffers (CUDA_Host and CPU_Mapped excluded), a missing field reads as unavailable and never as 0, and it only fires when the device delta has no spawn baseline. Fork #25 reads right too; APPROVED there separately. I read the code and did not build it.

Blocking: the host prompt cache is subtracted from a VRAM reading. Every source's reading goes into lane_footprint::observe(.., host_cache_bytes), and per_token_from does anon_bytes.checked_sub(host_cache_bytes)?. That is right for process_anon (the Macs): --cache-ram fills the lane process's own anonymous memory. It is wrong for device_delta and the new engine_props. Both measure accelerator bytes, and the prompt cache lives in HOST RAM, so it was never in them. On the 5090, with an --cache-ram grant:

  • grant > the reading: checked_sub gives None, apply_sample(None) RETIRES the model's record, and the plan falls back to the estimate every minute;
  • grant < the reading: an UNDERCOUNTED per-token is written, and a sample replaces the record whatever its size, so the plan sizes windows against a cost smaller than the lane really holds.

The device_delta arm has had this since the grant was added; #4459 routes the new reading through it too, which is why I'm raising it here. Fix: pass host_cache_bytes = 0 when source is device_delta or engine_props, keeping it for process_anon. The test wants one device-sourced sample with a non-zero grant, asserting the per-token is unchanged by the grant.

Non-blocking: reqwest::Client::new() per sample. That is fine at the sampler's minute cadence, though a shared client would reuse the connection.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

joelteply and others added 2 commits September 27, 2026 10:02
…pt cache; engine_beyond_weights sits above its neighbour's doc (Fable + Cormac on #4459)

--cache-ram is host RAM: only the process reading contains it. device_delta and engine_props never
saw it, so subtracting it undercounted the per-token cost or retired the record every minute.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply

Copy link
Copy Markdown
Contributor Author

Reviewed at 213bc7a (Cormac). My point is taken: host_cache_bytes is subtracted only for process_anon, and the device sources (device_delta, engine_props) pass 0. Fable's doc move is in. The pin 9733aca6c = 7772f3f9f (validated) plus exactly two commits: f617a5843 (#25, reviewed) and fda574c94 (the #17 delta-net test). The gitlink and LLAMA_CPP_PIN agree. My word is APPROVED once lib CI is green; 3 of 7 checks were running when I read it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

@joelteply
joelteply enabled auto-merge (squash) September 27, 2026 15:12
@joelteply
joelteply merged commit 92a2042 into canary Sep 27, 2026
8 checks passed
@joelteply
joelteply deleted the fix/footprint-from-engine-props branch September 27, 2026 15:19
@joelteply

Copy link
Copy Markdown
Contributor Author

APPROVED at 213bc7a (Cormac), with CI 9/9 green. Recorded for the merge that landed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant