Final review report · NVIDIA/hyperflare-inference #661

Raw Markdown for agents: https://autobot.eidonix.com/p/b6951af6-b04b-4931-a1c0-16fcee9bc67a.md

Recommendation: Changes Requested

The core Rust scheduling changes (interpolated_prefill_duration, chunkable non-terminal Prefill under active age-priced streams, deferred_prefill non-terminal-catalog exclusion, and the age-priced Prefill feedback barrier) are clean, memory-safe, and model-agnostic, with sound TimingOrigin::Discovery handling in commit() and no concurrency or overflow defects found. However, this is a default-on balanced-policy performance change that currently fails two merge gates: (1) it diverges Helios from scripts/scheduling_sim/learning_policy.py's qualified initial_discovery = "native" policy without running the mandatory 64-seed scripts/scheduling_sim/learning.py gate (docs/design-review.md:195-208) and without a head-commit (29f2b5b) served A/B or CI run, and (2) the PR description's throughput pipelining claim contradicts scheduler.rs:989-998, 1180-1183 / policy_tests.rs:7784-7826, while the new service_rates fallback test (policy_tests.rs:7738-7741) has a false-pass blindspot that never exercises prefill_must_complete_terminally_from == true.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Unrun mandatory timing-learning gate (docs/design-review.md:195-208) and pre-head A/B evidence (fdb10bb5 vs 29f2b5b):
    • Verified behavior/impact: docs/design-review.md:201-206 requires changes to timing estimation or exploration to be validated against the screening and 64-seed catalog in scripts/scheduling_sim/learning.py and explicitly states "Do not diverge Helios from the simulator's qualified policy without updating and validating the rule across that catalog." Contrary to the assumption that the simulator cannot represent unmeasured timings, scripts/scheduling_sim/learning_policy.py:45, 235-273 (initial_discovery = "native", documented at docs/scheduling-theory.md:551-558) explicitly models Helios's unknown-first discovery; the new tests/test_scheduling_utility.py:422-442 only exercises fixed-cost UtilityScheduler, not unknown-cost interpolation. In addition, all SM120 A/B numbers were measured on fdb10bb5 (before resize_prefill's deferred_prefill guard at policy.rs:1789-1792), the GB10 numbers are pre-#656 (571a4471), and no CI run is attached on head 29f2b5b.
    • Concrete fix: Rebase onto current main, run the CI verification suite (cargo test --locked --release, pytest, check.py, kani), re-run the SM120 served A/B on the exact head commit, and either model interpolated unmeasured-prefill exploration in scripts/scheduling_sim/learning_policy.py and run scripts/scheduling_sim/learning.py (updating docs/scheduling-theory.md:551-558) or obtain explicit maintainer sign-off waiving the simulator gate for this rule.

Should Fix

  1. Reconcile throughput pipelining behavior and PR description (helios/src/scheduler/policy.rs:35-37, 50-52, helios/src/scheduler.rs:989-998, 1180-1183, helios/src/scheduler/policy_tests.rs:7784-7826):
    • Verified behavior/impact: PolicyConfig::throughput() zeroes decode_age_price but keeps terminal_age_price: 1.0, and has_active_age_priced_stream() returns true for any resident policy::terminal_cleanup(r) stream when terminal_age_price > 0.0. Consequently, prefill_step_requires_feedback() drains non-terminal Prefill chunks even under --scheduler-policy throughput whenever a terminal-cleanup (Snapshot) stream is resident. Both docs/scheduling-runtime-design.md:620-622 and the PR's own test policy_tests.rs:7784-7826 explicitly assert this, directly contradicting the PR description's claim "solo prefill and throughput (0.0) keep two-frame pipelining" (and the reported 28/24/19 launch-parity check does not cover a resident terminal-cleanup stream).
    • Concrete fix: Retaining terminal_age_price: 1.0 in throughput() is sensible for prompt KV-page reclamation, so update the PR description to state the terminal-cleanup exception (matching docs/scheduling-runtime-design.md:620-622) and verify throughput launch parity with a resident terminal-cleanup stream — or, if throughput is meant to preserve pipelining unconditionally, adjust the barrier predicate and update docs/scheduling-runtime-design.md:620-622 and policy_tests.rs:7784-7826 accordingly.
  2. Fix false-pass test blindspot for prefill_must_complete_terminally_from (helios/src/scheduler/policy_tests.rs:7738-7741, helios/src/scheduler.rs:955-987, helios/src/scheduler/service.rs:225-231):
    • Verified behavior/impact: policy_tests.rs:7738-7741 asserts service_rates(short_prompt).0 == None for a 256-token prompt (deferred_prefill = false, caps = [128..16384], term_caps = [256..16384], window = 128) with the comment "A short 256-token prompt must complete terminally (window = 128), so fallback does not apply." In fact, prefill_must_complete_terminally_from (scheduler.rs:957-987) checks capacity = 128, gets resolve_prefill_kind_from == GraphKind::Prefill (scheduler.rs:896-901 because 128 is absent from terminal_prefill_catalog and deferred_prefill == false), and returns false. The service.rs:228 fallback therefore does run on short_prompt, and the assertion passes solely because Prefill(128) was left unmeasured in the fixture (policy_tests.rs:7716) — meaning !self.prefill_must_complete_terminally_from(...) at service.rs:228 is completely unexercised by the test.
    • Concrete fix: Measure Prefill(128) (or test a deferred_prefill = true 256-token prompt / a catalog where term_caps starts at 128) so prefill_must_complete_terminally_from actually evaluates to true and proves service.rs:228 suppresses the fallback when no legal Prefill chunk exists; also clarify the scheduler.rs:955-956 docstring to reflect that terminal-capable Prefill shapes absent from terminal_prefill_catalog remain legal when !deferred_prefill.

Subtract / Simplify

  1. Deduplicate the 30-line unmeasured-prefill interpolation block (helios/src/scheduler/policy.rs:999-1031 and :1349-1381): continuation_candidate and add_candidate contain byte-identical match predictor { Some(p) => ..., None => { nat_fit ... last_interp ... } } blocks differing only in variable names (following/width/request vs kind/capacity/r). Extract a single helper (e.g., prefill_candidate_ns(...) -> Option<u64>) to delete ~25 duplicated lines and prevent drift between the two sites.
  2. Keep PrefillSlotPlan off non-prefill add_candidate arms (helios/src/scheduler/policy.rs:79-86, 420-456, 1323, 1524-1538): PrefillSlotPlan is only read inside prefill branches, yet it is threaded as a trailing &mut [PrefillSlotPlan; REQUEST_LANES] through every non-prefill arm of candidates() (Vision, Speculative, Init, Restore, Snapshot, Resume, Decode) and re-caches cut already memoized by PlanningScope (checkpoints.rs:11-19). To preserve the plan() CPU win without plumbing it through non-prefill paths, consider a dedicated add_prefill_candidate helper or passing Option<&mut ...> only where prefill slots are scored.
  3. Delegate prefill_catalog_for_terminal to prefill_catalog (helios/src/scheduler/policy.rs:342-358): prefill_catalog_for_terminal repeats the same three catalog branches as prefill_catalog; delegating via self.prefill_catalog(if kind == GraphKind::ScoredPrefill { kind } else if terminal_only { GraphKind::TerminalPrefill } else { GraphKind::Prefill }) removes the duplicate switch.
  4. Consolidate peer comparison in interpolated_prefill_duration (helios/src/scheduler/cost.rs:734-744, 759-772): Keeping the cheap pre-filter before pred.predict makes sense, but the (capacity, same_kind) ordering is written out four times (hi/lo × skip/accept); a tiny directional helper keeps the early continue while cutting ~15 lines of repetitive branching.

Nits

Dropped on verification