Repository navigation
Conversation
`/metrics` reports cached and free KV pages but not the pages live requests hold, so an operator cannot compute the KV share in use by requests, and pages reserved for their future growth are invisible: they are neither free, cached, nor written. Issue NVIDIA#537 asks for the pages held by active requests. A per-scrape scan of the checkpoint graph is not acceptable because `Cache::stats` deliberately avoids scanning `nodes`, so the cache keeps a maintained page count and the scheduler adds the counts of its live slots. `PrefixCheckpointCache::pin_request` and `unpin_request` record direct request pins and transitive request pins per checkpoint and keep `request_pinned_pages` at the tail-page count of checkpoints whose transitive request pin count is nonzero, so a page shared through a pinned ancestor counts once for every request that references it. Compaction asserts that the removed ancestor and its heir agree on request pins, and a checkpoint leaves `nodes` only at zero pins. The scheduler now takes every request-owned pin, and the ticket-parent pins that belong to host-store admission, through the request API, and reports `request_pages` as live slots' private pages plus the cache count and `reserved_pages` as live slots' reserved pages. `Metrics` stores both values and renders `flare_request_kv_pages` and `flare_reserved_kv_pages` in the Prometheus text only; the JSON snapshot is unchanged. `docs/api.md` defines both gauges and states that dividing the first by `flare_total_kv_pages` excludes idle cached prefixes and snapshot backing pages. The claimed result is visibility only: the KV pages held by active requests and the pages reserved for their growth become scrapeable, and the reserved gauge explains the remainder of non-free pages. No allocation, eviction, or scheduling decision changes. Evidence: `cargo test --locked --release --manifest-path helios/Cargo.toml --target-dir ~/.cache/hyperflare-target --features runtime-core,server --lib -- cache:: scheduler:: server::metrics` passed 508 tests. That run exercises the extended `Cache::stats` drift assertion, which compares the maintained request-pinned page count with a full scan of every checkpoint on every stats read, so every cache and scheduler test checks the counter. `request_pins_count_each_shared_page_once` asserts that two request pins on branches sharing an ancestor count three pages, that plain pins leave the count unchanged, that releasing a checkpoint without a request pin is an error, and that the count returns to zero. `request_kv_pages_count_shared_prefix_pages_once` asserts both gauges against the requests' own private and reserved pages after a shared prefix, and that both reach zero after retirement while cached pages stay nonzero. `counters_expose_fixed_names_without_request_payloads` covers the new gauges' types and values. Windows builds and the rest of the helios suite are left to CI. Signed-off-by: Wynn Drahorad <[email protected]> Design-Signed-Off-By: Claude Opus 5.5 (omp agent); design-review=eb2f
|
A case file has been opened for 549. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Autobot ReviewFull Review for Agents · Value Proposition · Case File Recommendation: Changes RequestedScope and approach are right — the count is maintained as pins change so Blockers:
Should fix:
Subtract / Simplify:Could remove ~90 of +218 added lines (up to ~112 if
Nits:5 To opt out, include #autobot:ignore in your post or comment. |
Review of the previous commit found four defects. `SchedulerStats` derives `PartialEq` and is embedded whole in the deferred-copy-out retry key (`CopyoutResources`), so the two new page gauges changed that key whenever a decode crossed a page boundary, re-offering host copy-outs with no cache-resource movement and contradicting the claim that no scheduling decision changes. The scheduler repeated the request-versus-ticket pin choice at three admission sites. `retire` emptied the request slot before releasing its request pin, so a failed release would drop the request instead of leaving it inspectable. And the new documentation described the gauges as read from scheduler state on each scrape, described request-pinned pages as double counted, and omitted the pages that retirement and admission tickets still hold. The retry key now builds `SchedulerStats` with `request_pages` and `reserved_pages` zeroed, since those move without any cache resource changing. `pin_prefix` and `unpin_prefix` take the pin kind once from the admission path and replace the three repeated branches, keeping the ticket-parent pin ahead of `ensure_resources`. `retire` releases the request pin before taking the request out of the slot. `docs/api.md` states that the worker publishes the gauges on each scheduler pass, that request-pinned checkpoint pages also appear in `flare_cached_kv_pages`, that neither gauge counts pages draining through retirement or an in-flight restore, and that `flare_request_kv_pages + flare_reserved_kv_pages` is the figure comparable to another runtime's used KV cache; the `pin_request` comment now describes only the cache's half of the count, since private pages live in the scheduler. The claimed result is unchanged: visibility into request-held and reserved KV pages, with no allocation, eviction, or scheduling decision affected. The retry key fix restores that claim. Evidence: `cargo test --locked --release --manifest-path helios/Cargo.toml --target-dir ~/.cache/hyperflare-target --features runtime-core,server --lib -- cache:: scheduler:: server::metrics` passed 508 tests after these changes, which includes the extended `Cache::stats` drift assertion over the request-pinned count and the scheduler lifecycle models that exercise admission, compaction, retirement, and the deferred-copy-out path. Windows builds and the rest of the helios suite remain with CI. Signed-off-by: Wynn Drahorad <[email protected]> Design-Signed-Off-By: Claude Opus 5.5 (omp agent); design-review=eb2f
|
@flare-autobot review the pushed changes. The per-request metrics PR is new; the other two carry review fixes. |
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe previous round's blocker is fixed at 9cca87a — the two gauges are now zeroed in the copy-out retry key — as are the retire pin ordering and the wrong
Have your agent review the Full Review for complete findings, To opt out, include |
The KV-page paragraph in `docs/api.md` offered two incompatible ratios for one measurement, blamed division for pages the numerators never contained, cited a `#[cfg(test)]` assertion in operator documentation, and claimed publication on every scheduler pass. Rewrite it around one ratio, `(flare_request_kv_pages + flare_reserved_kv_pages) / flare_total_kv_pages`, name the population as requests owning a model slot with restore-ticket pages excluded, state that request-pinned checkpoint tail pages count in both the request and cached gauges, and give the actual cadence: passing scheduler passes, startup, and the post-shutdown drain. `pin_request`/`unpin_request` walked the checkpoint chain twice, once through `pin`/`unpin` and again for request accounting, allocating two chain vectors per request pin and release. One private `pin_with`/`unpin_with` pair now walks it once, keeps the readiness, refcount, and direct-pin guards, and adds a `debug_assert!` at the request-pin 1->0 transition that moves `request_pinned_pages`. Pin behavior is unchanged. The scheduler test duplicating the branching-request fixture and the cache test duplicating the branching-pin fixture are folded into those tests. They now also assert the request/reserved gauges, the cancellation drain, the shared page counted once, and that a plain copy-out pin does not move the request gauge. `SchedulerStats` active, request, and reserved counts now come from one pass over slots instead of three. Validation: `cargo check --locked --manifest-path helios/Cargo.toml --features server` passed. `cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server --lib -- server:: scheduler:: cache::` reported 814 passed, 1 failed (the known `messages_image_hints_end_after_expansion_for_text_and_segmented_templates`, which needs FLARE_TEST_TEMPLATE_DIR), 11 ignored, 852 filtered out; the two merged tests pass. Limitation: no behavior change is claimed, and no live scrape measured the ratio. Signed-off-by: Wynn Drahorad <[email protected]> Design-Signed-Off-By: Claude Opus 5.5 (omp agent); design-review=eb2f
The request-histogram documentation and two expected rows of the counter exposition test were inserted at the same lines as the KV-page gauge change (NVIDIA#549) adds its paragraph and rows, so whichever of the two merged second would stop on a textual conflict although the changes are independent. The histogram paragraphs in docs/api.md now follow the paragraph about the JSON format of the /metrics route instead of directly following the route's introduction, and in counters_expose_fixed_names_without_request_payloads the cache_lookup_tokens field and the parked_requests row move to the end of their lists. The text and assertions are unchanged; the test checks each row with `contains`, so row order does not matter. The two changes now merge in either order without manual resolution. cargo test --features runtime-core,server --lib -- server::metrics passed 19 tests, and `git merge-tree` of this branch with the KV-page branch reports no conflict. Signed-off-by: Wynn Drahorad <[email protected]> Design-Signed-Off-By: Claude Opus 5.5 (omp agent); design-review=eb2f
|
Live validation summary. Hardware: one RTX PRO 6000 Blackwell serving the prepared
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes Requestedbca7358 fixes every item from the previous round and folds the duplicate tests; what remains is one API-doc sentence, one restored test assertion, and about 55 of the +202 added lines that can simply be deleted. Nothing here asks for new code, tests, flags, or docs.
Have your agent review the Full Review for complete findings, To opt out, include |
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedNo new commits:
Have your agent review the Full Review for complete findings, To opt out, include |
|
Overall the design looks solid — maintaining Blocking
Should fix
Minor
|
Admission chose between a request pin and a ticket-parent pin through a private `pin_prefix`/`unpin_prefix` pair taking the kind as a bare `bool`, a third way to name a pin kind beside the cache's `pin_request`/`pin` methods and the `pin_checkpoint` pair. The three admission sites now call the named cache methods directly, selected by `request_pin`, and the pair is deleted. `SchedulerStats` construction walks the slot array once, counting active requests, retiring slots, anchor guards, inbound-phase requests, and request and reserved pages together. `retire` reuses the prefix and failure state it binds before publication instead of re-reading the slot before the request-pin release. Pin and release behavior and every reported statistic are unchanged. Validation: `cargo check --locked --manifest-path helios/Cargo.toml --features server` passed. `cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server --lib -- server:: scheduler:: cache::` reported 809 passed, 1 failed (`messages_image_hints_end_after_expansion_for_text_and_segmented_templates`, which needs FLARE_TEST_TEMPLATE_DIR), 11 ignored, 852 filtered out. Signed-off-by: Wynn Drahorad <[email protected]> Design-Signed-Off-By: enterprise/deepseek-v4.1-flash (omp agent); design-review=eb2f
`unpin_request` rejects a release on a checkpoint that holds no direct request pin, which keeps a double release from corrupting `request_pins` and the request-pinned page count. No test reached that guard. The branching-pin cache test now asserts that releasing a request pin on the shared parent, which holds only descendant request pins, is an error. `pin_with` and `unpin_with` fetch the pinned node once for both direct counters, and `unpin_with` reads the checkpoint once for both release guards. The `debug_assert!` before the ancestor `request_pins` decrement is removed: debug builds already panic on `u64` underflow, and the test-only drift assertion in `Cache::stats` checks the request-pinned page count on every read. Pin behavior is unchanged; the request-pin guard is covered by a test. Validation: `cargo check --locked --manifest-path helios/Cargo.toml --features server` passed. `cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server --lib -- server:: scheduler:: cache::` reported 809 passed, 1 failed (`messages_image_hints_end_after_expansion_for_text_and_segmented_templates`, which needs FLARE_TEST_TEMPLATE_DIR), 11 ignored, 852 filtered out. Signed-off-by: Wynn Drahorad <[email protected]> Design-Signed-Off-By: enterprise/deepseek-v4.1-flash (omp agent); design-review=eb2f
The `flare_request_kv_pages` and `flare_reserved_kv_pages` descriptions named their population as "active requests" in code but "requests owning a model slot" in `docs/api.md`, and described reserved pages as "not yet written", although `commit` moves a reservation into a request's private pages before the GPU writes it. The `docs/api.md` paragraph also documented draining pages and publication cadence, which no other page gauge there describes. The `SchedulerStats` doc comments, the metric HELP text, and `docs/api.md` use "requests owning a model slot" and define reserved pages as pages set aside for growth that no request holds yet and that `flare_cached_kv_pages` does not count. The draining and cadence sentences are removed from `docs/api.md`. The copy-out retry key comment in `runtime.rs` is one line. The branching-request scheduler test inlines its page sums into the gauge assertions and drops a comment that restated them. Gauge values, assertions, and the documented usage ratio are unchanged. Validation: `cargo check --locked --manifest-path helios/Cargo.toml --features server` passed. `cargo test --locked --manifest-path helios/Cargo.toml --features runtime-core,server --lib -- server:: scheduler:: cache::` reported 809 passed, 1 failed (`messages_image_hints_end_after_expansion_for_text_and_segmented_templates`, which needs FLARE_TEST_TEMPLATE_DIR), 11 ignored, 852 filtered out. Signed-off-by: Wynn Drahorad <[email protected]> Design-Signed-Off-By: enterprise/deepseek-v4.1-flash (omp agent); design-review=eb2f
/metricsreports free and cached KV pages but not the pages live requests hold, so an operator cannot compute the KV share in use, and pages reserved for requests' growth are invisible (neither free, cached, nor written). #537 asks for this.Cache::statsdeliberately avoids scanning the checkpoint graph, so the cache maintains a count as request pins change, and the scheduler adds its live slots' private and reserved pages.What changed
helios/src/cache.rs. Request pins (pin_request/unpin_request) share one chain walk with plain pins and additionally count each pinned checkpoint's tail pages once while any request pins it (request_pinned_pages). Compaction moves the count into the surviving checkpoint. Plain pins for host copy-out and export are not counted.helios/src/scheduler.rs. Every request-owned pin uses the request API, and retirement releases it before the slot is emptied.SchedulerStatsgainsrequest_pages(live slots' private pages plus the cache count) andreserved_pages.helios/src/server/runtime.rs. The deferred host copy-out retry key zeroes both new fields, so page movement during decode does not re-trigger copy-outs.metrics.rs,docs/api.md. Gaugesflare_request_kv_pagesandflare_reserved_kv_pages, published when a scheduler pass makes progress. Request-pinned checkpoint pages also appear inflare_cached_kv_pages.(flare_request_kv_pages + flare_reserved_kv_pages) / flare_total_kv_pagesis the share comparable to vLLM'skv_cache_usage_perc.Result
Pages held and reserved by active requests become scrapeable; allocation, eviction, and scheduling are unchanged. Cost: one counter update per page-count crossing on request pin and release, and one pass over live slots per stats call, in the loop that already counted them.
Evidence
cargo test --features runtime-core,server --lib -- server:: scheduler:: cache::: 809 passed; 1 failed, a template test that needsFLARE_TEST_TEMPLATE_DIRand is unrelated. A test-only assertion compares the maintained count with a full scan on everyCache::statscall. Scheduler and cache tests cover shared prefixes (three distinct pages count 3, not 4), plain pins, compaction, and cancellation back to zero.local-inference-lab/Qwen3.8-Flash-Next-FLAREgb202 package (20,480 pages) with 16 concurrent streams, mid-run scrapes reported 54–80 request pages and 16–22 reserved pages. On a two-GPU DeepSeek-V4.1-Flash deployment with two concurrent chats, the gauges read 399–402 and 2–3 of 21,504 pages.This PR and #548 (request histograms) are independent and merge cleanly in either order.
Closes #537
Discord: oystersmiles