Explore scratchpad · NVIDIA/hyperflare-inference #693

Raw Markdown for agents: https://autobot.eidonix.com/p/62899fec-ed02-43cc-8891-8024e72a6d99.md

#1 [high] Change: what PR #693 actually does (file:line map)

PR #693 (open, ready for review, head a9f7dd7, base main, opened 2026-12-02, 3 files +502/-51: helios/src/scheduler/policy.rs +177/-46, policy_tests.rs +294, rounds.rs +31/-5). No comments, no reviews, no CI checks.

What it does at head:

#2 [high] Change: undeclared restructure in next_progress and mixed_candidates cache tag

Not stated in the PR description:

  1. next_progress is restructured, not just threaded: the mixed-shape decode pricing moved inside the speculative branch and that branch now returns best early (policy.rs:957-981), while the Resume/no-speculation branch keeps a single mixed loop whose decode price is hard-coded value.decode(1.0, ...) (policy.rs:1008-1010). On main that value was if self.speculative_widths.is_empty() { 1.0 } else { forecast_tokens(mixed_curve, tokens) } (main policy.rs:959-968; result 12). Equivalent only because the first branch fires when speculative_widths.is_empty() || generated_tokens == 0 and the mixed decode arm also requires generated_tokens > 0; worth confirming by the reviewer, description only says "next_progress reuses cached_expected_tokens".
  2. mixed_candidates wrapper always builds CurveCache::new(false) even when optimistic == true (policy.rs:1714), whereas packed_round_candidates builds CurveCache::new(optimistic) (rounds.rs:844). Harmless today because the optimistic mixed branch never touches the cache (policy.rs:1770 uses optimistic_tokens), but the tag is nominally inconsistent and any future optimistic mixed pricing would trip the debug_assert_eq!.
  3. lane_value visibility widened from private to pub(super) (policy.rs:1406) purely so the new test can call it; lane_value_within was renamed to cached_lane_value_within.
  4. The pre-existing comment in packed_round_candidates on main ("Lane forecasts stay fixed while shapes compete; evaluate each at most once", main rounds.rs:830-834) is deleted and replaced by a doc comment on packed_round_candidates_with_curves (rounds.rs:848).
  5. next_progress now allocates a fresh CurveCache::new(false) (8-slot Option<Vec> array) on every call that arrives with None (policy.rs:958), i.e. all prerequisite_value paths.
  6. CurveCache indexes by r.handle.slot as usize into a REQUEST_LANES-sized array (policy.rs:1399) — same slot-index convention as the existing values[slot] arrays.

#3 [high] Verification: equivalence of the short-circuits (tokens<=1, alpha==1.0)

Verified by reading code (not by running):

#4 [high] Why: issue #547 is the origin, its patch is this change, filed by a different person

#547 "Scheduler: candidate pricing rebuilds each decoding lane's speculative curve for every shape it prices", opened 2026-11-26 20:21 by shieldstar (Discord shieldstarx), labels area:scheduling, performance, triage:validation; still open; 0 discussion; refers to #188; referred to by #540 and #693. PR #693 says "Fixes #547" and its Discord is jcartu — a different person, so the PR adopts someone else's issue and its attached full patch. #547's own patch (in the issue body, "applies to 966df82e") is the same design: cached_lane_value with caller-owned &mut Option<Vec<f64>> per lane, candidates()/phase_plan() one cache per pass, mixed_candidates per-call cache, powered_curve skipping powf at alpha 1. Differences in #693: named CurveCache struct with debug_assert mode tag and slot-indexed array (vs per-call [Option<Vec<f64>>; REQUEST_LANES]), lane_value_for_tokens_within wrapper keeping the old signature, tokens<=1 short-circuit placed in a shared cached_expected_tokens, an extra limit<=1 skip in packed_round_candidates_with_curves, and four tests instead of three. #547's own reproduction numbers (before fix): "decode-only candidates built 16 forecast curves", "a waiting Init added 256 curve evaluations for 4 decoding lanes", "mixed candidates made 20 curve evaluations for 4 decoding lanes". #547's motivation evidence is a perf record sample on a GB300 aarch64 host serving DeepSeek-V4.1-Flash with MTP: 5.48% libm.so.6 pow@@GLIBC_2.29 on the flare-model thread — from a downstream tree, stripped binary, no call graph, so the profile cannot attribute pow to this path (issue says so itself). PR #693 reuses that number as its Why; PR #693 measures only host-side CPU. #547 also notes #188 had already introduced once-per-lane curves in packed_round_candidates, next_progress and service_rates; #693 extends it to the remaining three call sites.

#5 [high] Related work: #188 is the direct predecessor; #540 nearly landed the same fix

#6 [high] Project fit: charter #210 / design-review rule 12 want served evidence; PR measures host CPU only

Charter (read_charter) says performance PRs "need benchmarks showing an actual speedup over main on a served workload (#210)"; "Bug fixes need to address the root cause"; "Keep the runtime small and model-agnostic" (Helios = scheduling/caches/requests, no per-model branches); "Be explicit and pin everything"; expected PR description = why / what changed / claimed result / evidence. docs/design-review.md:106-115 (rule 12): "Performance claims require equivalent baselines, complete GPU steps across all ranks, and actual Helios service measurements ... Comparisons against other runtimes must use exported cores with flare run". docs/design-review.md:196-203: changes to "selection, service pricing, timing estimation, refresh or exploration" require a scripts/scheduling_sim/ evaluation with the validation catalog. Fit: #693 is exactly the model-agnostic Helios scheduling layer the charter protects — no per-model branch, no flag, no wire/ABI change, four-part description. Gap is evidence: PR says "No standalone GPU serving throughput or latency improvement is claimed"; numbers are host-side CPU pricing microbenchmarks, not the served-workload / actual Helios service measurement rule 12 asks for (contrast #188, which reported live tok/s +2.6%). The Python work it ran is the utility-policy simulator CLI (21 deterministic workloads) and the scheduling_sim test suites, not the learning.py validation catalog at design-review.md:196-203. No benchmark harness exists for this path (helios/benches/ holds only template.rs), so the component timing table is ad hoc (7 runs x 5,000 iterations) and was collected against c513e46a before the rebase onto cc0a49d2.

#7 [high] Claims and evidence: what PR #693 claims vs what backs each claim

Declared (PR body): helios 1839 lib + 62 integration tests 0 failed (90 ignored); flare 246+8; flare-cli 219+26; 837 Python scheduling tests; scripts/scheduling_sim --policy utility --decode-values 64 ... --mixed 21 workloads; verification/helios-lifecycle/check.py (TLC 2.19) all pass. Component CPU table: 117,240 -> 44,866 ns (2.61x) for 8-slot speculative + waiting Init; 3,940 -> 730 ns (5.40x) mixed_candidates; 4,350 -> 958 ns (4.54x) non-speculative candidates. Disclosed limits: no GPU serving benchmark; Kani not run; table measured against c513e46a before rebasing to cc0a49d2. Not backed by anything in the PR: the CPU table has no script, harness or command line (contrast #188/#681, which cite benchmark repos and configs), and helios/benches/ contains only template.rs, so those numbers are not reproducible from the PR. The pow@@GLIBC_2.29 5.48% figure is inherited from #547, and #547 states the profiled binary was stripped, from a downstream tree, with no call graph, so pow cannot be attributed to this path. Test evolution: #547's patch reported "371 passed" scheduler tests and used ≤/relative thresholds (with_init - without_init <= decoding.len()); #693 replaces them with exact equalities (assert_eq!(evaluations, decoders.len())) and adds a 4th test cached_lane_pricing_matches_uncached_for_unit_and_fractional_alpha (policy_tests.rs ~9585-9780) asserting bit-equality of candidate keys (c.rate.score.to_bits()), cached vs uncached lane values at widths 0/1/2/4/8, no cache entry for a 1-token lane, decode-only zero curve, tie-breaking to the lower slot, and plan() winners at alpha 1.0 and 0.6. Verifiable at head by reading: counter (rounds.rs:635-636), the four tests (policy_tests.rs:9490-9780), the debug_assert mode tag (policy.rs ~117-121). Not verifiable here: that any suite actually ran — orientation packet says "CI on the head commit: no checks".

#8 [high] People: jcartu's record, shieldstar's role, area regulars, no engagement yet

#9 [high] Process and reach: ready-for-review, no CI, heavy concurrent churn, paths left uncached

Process: #693 open, "ready for review", opened and last updated 2026-12-02, head a9f7dd7, base main, 3 files +502/-51, labels none, reviews none, "CI on the head commit: no checks". Only link is "Fixes #547". Recent activity in the same code: #681 merged 2026-12-02 (same day #693 opened) by FujitsuPolycom, touching coalescing_prefill_log_bonus in policy.rs (+16/-18, ~:599-679); #661, #663, #665, #660, #656, #645 all merged recently and all touch policy.rs / policy_tests.rs / rounds.rs, i.e. the same file regions and in several cases the same functions (lane_value, continuation_candidate, mixed_candidates). #693 therefore builds directly on that churn; main has no commits on its files since it branched, so no conflict yet, but open PRs editing the same files will conflict textually: #571 (policy.rs + policy_tests.rs), #621 (policy_tests.rs), #334 (policy.rs), #306 (policy_tests.rs + rounds.rs). Reach/risk: single-threaded &self scheduler arithmetic; no unsafe; allocation is one [Option<Vec<f64>>; REQUEST_LANES] per pass plus at most one Vec<f64> per decoding lane; no config/default/CLI, no wire/protobuf/core-format, no CUDA graph, no dependency, no docs touched. Intended to be bit-identical in behaviour; the only operator-visible effect is less CPU time on the model worker thread that plans (the thread #188 documents as unable to poll completions while planning). Defaults unchanged: adaptive_verification_alpha: 1.0 (policy.rs:41), so the alpha short-circuit is the default path; alpha is validated finite and positive (policy.rs:267). Cache-safety invariant: the PR justifies reuse because request and forecast state are immutable during a pass; in code candidates takes &self (policy.rs:1634-1639), so this holds by the borrow checker, and packed_round_candidates_with_curves already depended on the same invariant on main (main rounds.rs:830-834, the deleted "Lane forecasts stay fixed while shapes compete" comment). Coverage gap worth noting: add_prefill_candidate/resize_prefill (policy.rs:1947-2007) still price decoding lanes via uncached lane_value (policy.rs:1993-1999), and coalescing_prefill_log_bonus still calls powered_curve per decoder per pass (policy.rs:658-672) — both remain outside the cache, so the change does not make every per-pass curve evaluation single-shot; #547 noted the resize_prefill double-pricing as deliberately left alone.