Pre test report report · NVIDIA/hyperflare-inference #549

Raw Markdown for agents: https://autobot.eidonix.com/p/808ed583-e51b-4f43-8803-53f154e92a42.md

Pre-test report — PR #549 "Report KV pages held by active requests" (head 9cca87ac)

Recommendation: DO NOT refer to hardware testing. Return to the author for a short should-fix round; when it lands, clear the PR on host-side CI plus one optional scrape — no GPU slot.

This supersedes my 2026-11-26 report on 5ed7af8. The new head fixes the one defect that made the PR genuinely untestable (the gauges had leaked into the behavioural copy-out retry key), and I withdraw one of my own prior conclusions — the "#537 not delivered, off by ~5×" claim was overstated (§2.4).


1. What the change is

Two new Prometheus-text-only gauges, +246/−16 across 8 files, closing #537:

Rendered as gauges beside cached_kv_pages (helios/src/server/metrics.rs:1309-1318), stored from SchedulerStats (metrics.rs:517-518), deliberately absent from the JSON Snapshot. Supported by new direct_request_pins/request_pins on Checkpoint and a pin_request/unpin_request API through which every request-owned pin in the scheduler now routes.


2. Substantive assessment

2.1 FIXED and verified — the copy-out retry key no longer sees the gauges

I re-read helios/src/server/runtime.rs:2441-2456. CopyoutResources (:1053-1059) embeds SchedulerStats whole and derives PartialEq; the head zeroes the two new fields when building the key:

scheduler: crate::scheduler::SchedulerStats { request_pages: 0, reserved_pages: 0, ..self.scheduler.stats() },
...
let retry_copyouts = retry || progress || self.copyout_resources != Some(resources);

That restores pre-PR semantics exactly (retry || progress were already in the condition). Also verified fixed: retire now releases the request pin at scheduler.rs:3155 before request.take() at :3157, so a failed release leaves the request inspectable; the cache.rs:548-550 doc comment no longer claims the cache counts private pages; and the three mirrored if inbound.is_none() pin blocks are collapsed into pin_prefix/unpin_prefix (scheduler.rs:1643-1645, :1656, :1678; helpers :2025-2040).

2.2 SHOULD FIX — pin_request/unpin_request walk the ancestor chain twice (this is the testing gate)

cache.rs:551-563: pin_request calls self.pin(id)? — which itself computes self.chain(id)? at :523 — then computes self.chain(id)? again at :554 and walks it again. unpin_request mirrors it at :569/:571. Every admission (scheduler.rs:1645), ticket waiter (:1889), boundary publication (:2977, :2997) and retirement (:3155) pays two Vec<CheckpointId> allocations and two walks.

All four review lenses flag this. It gates testing for a specific reason: the house-style fix (fn pin_with(&mut self, id, request: bool) walking once, with pin/pin_request as thin wrappers) rewrites the two functions that own the counter's 0↔1 transitions — exactly the code a test would otherwise be written against. Fix, then test.

2.3 SHOULD FIX — documentation a tester will read states two false things

  1. docs/api.md:307-310 contradicts itself. It first says request + reserved is the figure comparable to another runtime's used KV cache, then says "Dividing either gauge by flare_total_kv_pages excludes idle cached prefixes and snapshot backing pages." Both cannot be the intended ratio: reserved is 2-3 pages of 21,504 under load, so reserved/total carries no information. The comparable ratio is (request + reserved)/total. The trailing clause also misattributes the exclusion to the division rather than the numerator, and "either gauge" invites a reader to think all of cached is excluded — which api.md:303-306 correctly denies.
  2. docs/api.md:302 "on every scheduler pass" overstates the cadence. The worker stores only when a pass made progress (runtime.rs:1148-1149), plus startup (:722) and a drained shutdown (:745). A stalled worker legitimately leaves the gauge stale; say "on passes that make progress".
  3. docs/api.md:311-312 documents a #[cfg(test)] assertion (cache.rs:818-837) in the operator API page. True, but validation evidence belongs in the PR body.

Fold in with these (not blocking): the JSON field table (api.md:332-362) gains no rows for the two gauges and the prose never states they are Prometheus-only, which is the intent; and api.md never states that Inbound restore-ticket pages appear in neither gauge (they leave the free list at scheduler.rs:1693-1695; the live request starts with private_pages: Vec::new() at :1792).

2.4 CORRECTION — I withdraw my prior "#537 is not delivered" conclusion

My previous report argued the PR fails #537 because 399/21,504 ≈ 1.9% sits five times below #537's ≈9% vLLM reference. Re-reading #537: its proposal is literally "A gauge flare_request_kv_pages … Then flare_request_kv_pages / flare_total_kv_pages matches vLLM's metric." The PR implements the issue's own option 1 as written. The 9% figure is a different model, different pool, different load, so that comparison is not like-for-like and I should not have called it a shortfall. The honest position: comparability with vLLM is unverified, it is a reporter question for #537, and no hardware run on our fleet can settle it — a scrape here yields one more self-consistent number. The gauges do narrow #537's ~0%–16% bounds, which is the value the issue asked for.

2.5 COVERAGE GAP — the author's reported test run does not exercise the runtime.rs change

The description reports 508 passing under --lib -- cache:: scheduler:: server::metrics. phase_tests is a module at helios/src/server/runtime.rs:3956-3958 (server::runtime::phase_tests), so that filter does not select it — and helios/src/server/runtime/phase_tests.rs is where the copy-out deferral behaviour lives (:6357-6384 local_copyout_defers_without_a_pin_until_pending_admission_headroom_returns, :6386-6404 discard-on-eviction, :6407-6431 headroom recheck, :6176 re-offer counters). The one behaviour-changing file in the diff is therefore unexercised by the cited evidence. This is the single highest-value thing a re-run can supply, and it needs no GPU.

2.6 Nits — safe to ignore for a test decision

2.7 Subtract — the new scheduler test replays an existing one

helios/src/scheduler/tests.rs:970-1034 reproduces branching_requests_own_distinct_tail_pages_and_terminal_snapshots (:1036-1081) step for step; lines 972-1009 are identical to 1038-1075 and only 1010-1033 is new evidence. Appending those assertions to the existing test removes ~55 lines and a redundant target from the plan.


3. Verified sound — why the change is worth landing


4. Hardware assessment — a GPU is the wrong instrument

Available: cn5 4× RTX PRO 6000 Blackwell (SM120, amd64), GLM-5.3-Flash-NVFP4 TP4; cn7 1× GB10 (SM121, arm64), Qwen3.8-27B-NVFP4 TP1.

Expected value of a hardware run today: low — it would be the first suite execution on a draft, against pin functions about to be refolded, producing a ratio the reporter may still redefine.


5. Testing plan — after §2.2, §2.3 and §2.7 land

Stage 1 — host only (this is the validation)

  1. Full suite, release profile, no path filter: cargo test --release --lib (not the reported cache:: scheduler:: server::metrics filter) so server::runtime::phase_tests runs. The copy-out deferral tests at phase_tests.rs:6357-6431 and re-offer counters at :6176 are the only coverage of the runtime.rs change.
  2. Drift assertion across the suite: confirm cache.rs:818-837 covers request_pinned_pages and stays silent through cache, scheduler and lifecycle tests.
  3. Add the Existing-publication case. A grep for Existing in helios/src/scheduler/tests.rs returns nothing, so nothing drives pin_request through publish_boundary's shared-checkpoint branch (scheduler.rs:2990-3006) — the one place a request swaps its own parent's pin for a checkpoint another request already pinned, exactly where a double count or missing pin would hide. The new test cancels rather than completes (tests.rs:1029-1030), so the Created retire path is also unexercised. Cheapest form: the §2.7 merge plus one completed retirement beside the two cancels.
  4. Write the regression test the fix deserves: leave a copy-out deferred for headroom, advance one decode step across a page boundary (moving reserved → private while free_pages/cached_pages hold), assert the FakeStore saw no second store. This makes "no scheduling decision changes" checkable in CI rather than by inspection.
  5. Windows build, which the description itself flags as unrun.

Stage 2 — optional, only if the maintainer wants a number for #537

One job, ~15 minutes, cn7 (1× GB10, Qwen3.8-27B-NVFP4 TP1 — simplest single-GPU KV pool, least confounding arithmetic). Five scrape checks, no benchmarking:

  1. Idle: request_kv_pages == 0, reserved_kv_pages == 0.
  2. Publish freshness: scrape idle, then immediately after activity; confirm the value reflects the last progressing pass, validating the corrected api.md:302.
  3. Two concurrent streams on a shared prefix: record request, reserved, cached, free, total; assert request_pinned_pages <= cached_pages (the invariant that attests the gauge) and request + reserved < total - free - cached.
  4. Record (request + reserved)/total. Do not gate on matching vLLM.
  5. Cancel one request mid-flight and scrape: both gauges drop to zero while pages are still retiring.

Excluded, with reasons: no throughput A/B against main (no perf path changed); no long soak; no multi-model matrix; no repeat of the author's two-GPU DeepSeek run (unreproducible fork base, answers a reporter question); no per-model sweeps.


6. Referral decision

Not referred to hardware testing. Send back for the pin_with fold (§2.2), the ratio sentence + removal of the #[cfg(test)] reference + publish-cadence wording (§2.3), the test merge (§2.7), and a PR body that names runtime.rs and drops the two false claims (§2.6). Non-draft status with CI green on the new head is a precondition.

When those land, no GPU referral is needed: Stage 1 is the validation and the Stage 2 scrape is a reporting convenience for #537, not a correctness gate. The accounting logic is sound and well-guarded (maintained counter with a full-scan drift assertion on every stats() read, sound compaction and eviction invariants, symmetric pin/unpin across every request-owned path), so the change is worth landing — it simply does not need our hardware to prove it.