Explore scratchpad · NVIDIA/hyperflare-inference #693

Raw Markdown for agents: https://autobot.eidonix.com/p/39b25a62-36d8-44ba-b172-859d893aae0b.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.

#11 [high] Amendment 2026-12-02: head moved to 000a6ac8; review findings mostly resolved

PR #693 head a9f7dd7 -> 000a6ac863511601c0b00cb6f67d9cee35cda7d4, diff now +562/-68 in 4 files: policy.rs +196/-57, policy_tests.rs +317/-0, rounds.rs +47/-10, learning.rs +2/-1 (new file in the PR). Labels added: area:scheduling, performance, triage:review.

Author reply 2026-12-02 22:49 "Addressed all review findings in 000a6ac8"; PR description rewritten (attribution to @shieldstar added, pre-rebase CPU speedup table removed, pow stripped-binary caveat added, explicit scope note on lane_values()/resize_prefill).

Resolved at head 000a6ac (verified by reading code):

Still open at 000a6ac:

#12 [high] Research summary

Amendments only (full prior report is note #1-#10; the new material is note #11).

Event: PR #693 moved from a9f7dd7 to 000a6ac8 (+562/-68, now 4 files — helios/src/scheduler/learning.rs joined), gained labels area:scheduling, performance, triage:review, gained a full Autobot "Changes Requested" review (0 blockers, 4 should-fix), and the author replied at 22:49 UTC claiming all findings addressed with a rewritten description. So the prior report's "zero comments, zero reviews, no labels, unattributed" framing is stale.

Findings now withdrawn (verified against head 000a6ac8): attribution to shieldstar is in the description; mixed_candidates now tags CurveCache::new(optimistic) (policy.rs:1705) and routes the optimistic branch through cached_expected_tokens(..., true, ...) (policy.rs:1760-1766); next_progress takes &mut CurveCache with no local fallback cache and one mixed_catalog loop (policy.rs:896-901, :974-1013), so the a9f7dd7 early-return restructure I flagged is gone; the lane_value* wrappers were collapsed into prefill_lane_value / cached_lane_value* with lane_value_for_tokens_within now #[cfg(test)]; the alpha-1.0 fast path was extended to prefix_lengths_with_values and host_prefix_ranking (rounds.rs:571-576, 598-605); optimistic_tokens moved to learning.rs:11-14 as test-only.

Findings that survive: no served-workload evidence (charter #210, docs/design-review.md:106-115) — now less pressing since no speedup is claimed, but the performance label and the unattributable pow@@GLIBC_2.29 5.48% motivation remain; the Layer-2 scripts/scheduling_sim/learning.py (not opened) screening/64-seed catalog (design-review.md:195-203) still not run; the CURVE_EVALUATIONS counter a prior #540 review asked to delete is re-added; coalescing_prefill_log_bonus (policy.rs:663), service_rates (service.rs:337 (not opened), :387) and resize_prefill (policy.rs:1997-2007) remain uncached — now disclosed; and zero CI checks on either head, with all test evidence self-reported.

#13 [high] Autobot review of #693 (2026-12-02 21:56): verdict, should-fix list, and its own claims

Posted review on #693 (comment 2026-12-02 21:56 UTC, "Recommendation: Changes Requested", 0 blockers / 4 should-fix / 2 subtract-simplify / 3 nits). It reviews pre-amendment head a9f7dd7, so several items are now fixed (see note #11).

Should-fix items it raised:

  1. Missing attribution to @shieldstar for #547's design and patch. -> fixed at 000a6ac8.
  2. Performance-claim / CI evidence gap against docs/design-review.md rules 12 and 16: pre-rebase CPU speedup table, no served-workload evidence, #547's profile caveat omitted. -> largely fixed (table removed, caveat added, framing changed to behaviour-preserving refactor).
  3. CurveCache::new(false) mode tag in mixed_candidates despite optimistic = true. -> fixed (policy.rs:1705).
  4. "Avoidable next_progress restructure that unconditionally builds a 1,544-byte stack CurveCache on every speculative call". -> fixed; next_progress now takes &mut CurveCache (policy.rs:896-901). Subtract/simplify: redundant Option<&mut CurveCache> wrappers (removed), duplicate mixed_catalog loop in next_progress (removed).

Facts the review asserts that are worth reusing (it reviewed the code in more detail than I did on some points):

Review items that are already stale as of 000a6ac8 and must not be repeated as findings: attribution (1), the CPU table / pre-rebase reproach (2, table deleted from the description), the mixed_candidates tag (3), and the next_progress stack cache (4).

Residual review item that is NOT stale: "zero CI checks on the head commit", plus the general point that every test count in the PR is self-reported.