Case file: PR #693 — perf(scheduler): cache per-lane powered survival curves across candidate pricing
Open, "ready for review", head a9f7dd7, base main, opened and last updated 2026-12-02, 3 files +502/−51, labels none, no reviews, no comments, no CI checks on the head commit. Only link: "Fixes #547". https://github.com/NVIDIA/hyperflare-inference/pull/693
Key findings
- The issue is someone else's patch. #547 (open) was filed 2026-11-26 by shieldstar (Discord
shieldstarx) with a complete, ready-to-apply diff for this exact optimization. PR #693 by jcartu implements the same design with refinements and says only "Fixes #547"; the description never credits shieldstar, and there are zero comments on #693, so no recorded endorsement or objection from the original author. (#547 is still open, so merging #693 would leave it open unless it is closed explicitly.) - The headline profile evidence is inherited and self-disclaimed. The
5.48% libm.so.6 pow@@GLIBC_2.29sample comes from #547, which states the binary was stripped, from a downstream tree, with no call graph, sopowcannot be attributed topowered_curve; PR #693 reuses the number as its Why. - Performance claims are host-CPU only and not reproducible from the PR. Three component timings (2.61x, 5.40x, 4.54x) have no benchmark script, harness or command line, and
helios/benches/contains onlytemplate.rs(not opened). The baselines were collected againstc513e46a, before the rebase ontocc0a49d2. The PR explicitly claims no GPU serving improvement, which is exactly the "served workload" evidence the charter (#210) anddocs/design-review.md:106-115(rule 12) require for performance work. - Undeclared behaviour-adjacent restructure.
next_progressis not merely threaded: the mixed-shape decode pricing moves inside the speculative branch, which nowreturns early, and the resume/no-speculation branch hard-codesvalue.decode(1.0, …)wheremainused a conditional curve forecast (policy.rs:946-1012). Described only as "next_progress reuses cached_expected_tokens". - Undeclared inconsistency in the cache mode tag.
mixed_candidatesalways buildsCurveCache::new(false)(policy.rs:1714) even when called withoptimistic == true, whereaspacked_round_candidatesbuildsCurveCache::new(optimistic)(rounds.rs:844). Harmless today because the optimistic mixed branch never consults the cache (policy.rs:1770), but the tag is nominally wrong and would trip its owndebug_assert_eq!if that branch ever starts caching. - A third try at the same fix, and it re-adds something a prior review asked to delete. #188 (merged) introduced once-per-lane curves for
packed_round_candidates,next_progressandservice_rates; #540 (merged) folded in shieldstar's related reuse plus theCURVE_EVALUATIONScounter, after which the Autobot review of that PR recommended deleting the counter and its two tests; neither the counter nor the zero-duration reuse exists onmaintoday. #693 reintroduces the counter. - Coverage is partial.
resize_prefill/add_prefill_candidate(policy.rs:1947-2007, pricing at :1993-1999) andcoalescing_prefill_log_bonus(policy.rs:658-672) still callpowered_curve/uncachedlane_valueper lane per pass. #547 noted theresize_prefilldouble-pricing as deliberately out of scope. - No community signal. 0 comments, 0 reviews, 0 labels, no reactions; #547 also has 0 discussion. The scheduler regulars who reviewed #188, #540 and #681 have not engaged.
- Risk profile is low and self-contained. Pure
&selfscheduler arithmetic, nounsafe, no config/default/CLI change, no wire/protobuf/core-format or CUDA-graph change, no dependency, no docs touched. Defaultadaptive_verification_alphais 1.0 (policy.rs:41), so the new short-circuit is the default path.
1. The change: what it does and how big
Size. 3 files, +502/−51: helios/src/scheduler/policy.rs +177/−46, helios/src/scheduler/policy_tests.rs +294/−0 (tests only), helios/src/scheduler/rounds.rs +31/−5.
Plain terms. Each decoding lane has a "speculative survival curve" from which the scheduler forecasts how many tokens the lane will actually commit. Today every priced shape rebuilds that curve (a Vec plus one powf per depth). Because request and forecast state cannot change during a pass, the PR builds it once per lane per pass and reuses it.
What it adds (at head):
pub(super) struct CurveCache { optimistic: bool, entries: [Option<Vec<f64>>; REQUEST_LANES] }, withnew(optimistic)andget_or_insert_with(slot, optimistic, build)guarded bydebug_assert_eq!(self.optimistic, optimistic, "CurveCache cannot mix optimistic and non-optimistic survival curves"), plus a#[cfg(test)] is_cached(policy.rs:98-127). It indexes byr.handle.slot as usize(policy.rs:~1399), the same convention the existingvalues[slot]arrays use.candidates()allocates oneCurveCache::new(false)per pass and shares it acrossmixed_candidates_with_curves,packed_round_candidates_with_curvesand every non-prefilladd_candidate(policy.rs:1641-1705).cached_expected_tokens(r, tokens, curves)returnsf64::from(tokens != 0)fortokens <= 1, otherwiseforecast_tokensover the cached-or-built curve; withNoneit falls back toself.expected_speculative_tokens(policy.rs:1387-1404).cached_lane_value/cached_lane_value_withinadded;lane_valueis kept (nowpub(super), uncached, passingNone);lane_value_withinrenamed tocached_lane_value_within;lane_value_for_tokens_withinkeeps its 6-argument signature and delegates withNone(policy.rs:1406-1524).- Threading through
next_progress(policy.rs:896-1033),prerequisite_value(:1015-1029),add_candidate(:1092-1101),continuation_candidate(:1272-1283),mixed_candidates_with_curves(:1718-1772),phase_plan(:2117-2123). powered_curvereturns the survival vector directly whenadaptive_verification_alpha == 1.0and bumps a#[cfg(test)]thread-localCURVE_EVALUATIONScounter (rounds.rs:633-645);proposal_forecast_tokensreturns early forwidth <= 1(rounds.rs:626-631);packed_round_candidates_with_curvestakes aCurveCacheinstead of a local array and skips lanes whose speculative limit is<= 1(rounds.rs:842-850, 892-895).
What the description does not say (all equivalence-preserving as far as reading shows, but structural):
next_progressrestructure described in Key findings (policy.rs:946-1012). Equivalence depends on the first branch firing whenspeculative_widths.is_empty() || generated_tokens == 0while the mixed decode arm requiresgenerated_tokens > 0; worth an explicit reviewer confirmation.- The
mixed_candidatesoptimistic-tag inconsistency (policy.rs:1714 vs rounds.rs:844). lane_valuevisibility widened topub(super)purely for the new test.- The pre-existing comment on
maininpacked_round_candidates("Lane forecasts stay fixed while shapes compete; evaluate each at most once", main rounds.rs:830-834) is deleted, its content moved to the doc comment ofpacked_round_candidates_with_curves(rounds.rs:848). next_progressnow allocates a freshCurveCache::new(false)on every call arriving withNone(policy.rs:958), i.e. everyprerequisite_valuepath — a small new allocation where none existed.
What the description says the change does not do: it does not change any score or scheduling decision. Reading the code, the two short-circuits are exactly value-preserving: forecast_tokens(powered, width) = f64::from(width != 0) + sum(powered[..width-1]) (rounds.rs:1016-1019) yields 0.0/1.0 for widths 0/1, so the tokens <= 1 returns are exact, not approximate; GraphKind::Decode always has lane_tokens == 1 (policy.rs:1379); and powf(p, 1.0) == p bit-for-bit for finite/infinite/NaN/signed-zero p, with alpha validated finite and positive (policy.rs:267) and defaulting to 1.0 (policy.rs:41). The packed limit <= 1 { continue; } skip drops no ranking entries because the following loop is for position in 0..limit.saturating_sub(1).
2. The why: problem, linked issues, how long wanted
- Origin: #547 "Scheduler: candidate pricing rebuilds each decoding lane's speculative curve for every shape it prices", opened 2026-11-26 20:21 by shieldstar, labels
area:scheduling,performance,triage:validation, 0 comments, still open, refs #188, referenced by #540 and #693. - #547's stated cost, before the 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" (four Init batch sizes × sixteen speculative cells × four lanes, etc.).
- Why CPU time on this path matters: planning runs on the model worker thread, which does not poll completions while planning — same argument as #188. #188's own problem statement uses the same words.
- #547's only production evidence: a
perf recordon a GB300 (Grace, aarch64) serving DeepSeek-V4.1-Flash with MTP at default alpha, no mixed graphs, showing5.48% libm.so.6 [.] pow@@GLIBC_2.29on theflare-modelthread. The issue itself says the build is a downstream tree, the binary stripped, the sample without a call graph, "so the profile does not splitpowbetween this path and the scheduler's otherpowfcalls", and that no GPU serving measurement of this change alone exists. PR #693's Why section reuses the number without that caveat. - Age/want: single issue, one author, no advocates, ten days old when the PR was opened; not a long-standing community request.
3. Related work
- #188 (merged 2026-11-03, voipmonitor, +391/−80, 7 files including all three #693 touches) "Remove repeated work from scheduler planning" — direct predecessor; introduced the once-per-lane curve in
packed_round_candidates,next_progress,service_rates. Its description claims live service gains (+2.6% tok/s over 40 cells) and byte-identical traces across ~210k plans — the evidential bar #693 does not reach. #693 is the continuation for the three callers #188 left out. - #540 (merged 2026-11-29, FujitsuPolycom, 11 files) — where shieldstar's adjacent finding landed: reuse of one forecast for both the duration-priced and zero-duration (
refresh_expected) mixed/decode values, plusCURVE_EVALUATIONSand two call-count tests, folded in ate5a69669. The Autobot review of #540 then recommended deleting that counter and its two tests ("Subtract/Simplify"). Checkingmaintoday: neitherCURVE_EVALUATIONSnorzero_durationexists, so the counter #693 re-adds is one a prior review asked to remove, and the double pricing #540's fix targeted is still onmain. #547's comment in #540: "This is independent of #547. If #547 lands too, the forecast here would come from its per-pass curve cache", and "whichever lands second needs a small rebase." - #547's patch vs #693: same architecture (
cached_lane_valuewith a caller-owned per-lane cache, one cache per pass, per-call cache inmixed_candidates, alpha-1 shortcut inpowered_curve). Differences: a named struct with a mode tag and slot-indexed array instead of a raw[Option<Vec<f64>>; REQUEST_LANES];lane_value_for_tokens_withinwrapper preserving the old signature; thetokens<=1shortcut promoted into a sharedcached_expected_tokens; an extralimit<=1skip in packed rounds; four tests instead of three, with exact equalities replacing #547's<=/relative thresholds and one new bit-equality test. - Same-file open PRs that will conflict: #571 (malventano, "force a wide round after persistent width-one selection", policy.rs + policy_tests.rs), #621 (jcartu, admission validation, policy_tests.rs), #334 (policy.rs), #306 (policy_tests.rs + rounds.rs). Recently merged same-file work: #681, #663, #661, #656, #645, #644, #620, #510, #555; closed: #654, #542, #632, #521. No PR competes with #693 on the same optimization.
- Nothing in #693 is undone or superseded by another open item as far as the local copy shows.
4. Recent activity in the touched areas
- #681 (FujitsuPolycom) merged 2026-12-02, the same day #693 opened, editing
coalescing_prefill_log_bonusin policy.rs (+16/−18, ~:599-679) — i.e. adjacent to the same pass. #661, #663, #665, #660, #656, #645 all merged in the weeks before and all touch policy.rs / policy_tests.rs / rounds.rs, several touching the very functions #693 rewires (lane_value,continuation_candidate,mixed_candidates). #693 builds on top of that churn rather than reversing it. - Orientation packet: "Commits on the default branch since this PR branched (cc0a49d), touching its changed files: none" — so no merge conflict exists yet, but the churn is heavy and the open PRs listed above will collide textually.
- Area regulars (nobody has commented on #693): lukealonso (#656, #645, #644, #620, #619, #510, #613), FujitsuPolycom (#681, #661, #665, #660, #582, #538, #540), voipmonitor (#188, #555, #522, #515; priority contributor), yatesdr (#663, #459, #655, #674, #694), original-el8 (#426, #473, #632, #306; priority contributor).
5. People
- jcartu (CONTRIBUTOR, Discord
jcartu): last 180 days 3 merged, 3 closed, 10 open; merged work touched docs (3), helios/src (3), heliopause/src (1), helios (1), helios/proto (1) — mostly docs and small fixes, not scheduler core. Open PRs opened 2026-12-02 alongside #693: #692, #691, #690, #689, #688, #687, #686; also #642 (2026-11-30) and #621 (2026-11-29, touches policy_tests.rs). #693 is their first scheduler-core performance change in this window. - shieldstar (Discord
shieldstarx): filed #547 with the full patch, reproduced thepowprofile on GB300 aarch64, pushed the adjacent reuse in #540. Not credited in #693 and has not commented. - Commentary/endorsement: none from anyone; see Community.
- Baseline commit
c513e46ain the timing table is unreadable in this checkout (git: cannot simplify commit ef38cb93…), so the measured tree cannot be inspected here.
6. Community
0 comments, 0 reviews, 0 reactions, no labels on #693 (verified: the PR conversation is empty). #547 has 0 discussion. For contrast, #681 and #540 both drew multi-round Autobot reviews and maintainer replies. The change has drawn essentially no attention, from either maintainers or the contributors who own this file.
7. Project fit (charter, design-review rules, docs)
- Lines up: this is exactly the model-agnostic Helios scheduling layer the charter protects — "Keep the runtime small and model-agnostic. Helios … handles scheduling, caches, and requests, and shouldn't accumulate per-model branches"; no per-model branch, no flag, no new config default. The PR description has all four parts the charter expects (why / what changed / claimed result / evidence + disclosed limits).
- Does not line up: charter "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over
mainon a served workload (#210)".docs/design-review.md:106-115rule 12: "Performance claims require equivalent baselines, complete GPU steps across all ranks, and actual Helios service measurements… keep raw measurements and disclose unrun checks and material limitations." PR #693 discloses the limitation honestly but supplies microbenchmarks of host-side C++-free pricing code, not a served measurement.docs/design-review.md:195-203also asks changes to service pricing/timing estimation to be evaluated againstscripts/scheduling_sim/including thelearning.py(not opened) screening and 64-seed validation catalog; the PR ran the--policy utilitysimulator CLI over 21 deterministic workloads and the scheduling test suites, not that learning catalog. - Note that #693's change is intended to be behaviour-identical, which arguably puts it outside "performance claims" that alter scheduling decisions — but the PR still leads with a speedup table, so rule 12's framing applies to the claim as written.
8. Claims and evidence
| Claim | Backing | Gap |
|---|---|---|
| 2.61x / 5.40x / 4.54x on three fixtures | A table of ns/pass medians, "release build on Linux x86_64, median across 7 runs of 5,000 iterations" | No script, harness or command line in the PR; helios/benches/ holds only template.rs (not opened); measured against c513e46a before the rebase onto cc0a49d2; no fixture inputs published |
pow was 5.48% of flare-model samples |
Inherited from #547 | #547 itself says stripped binary, downstream tree, no call graph, cannot attribute pow to this path |
| 1839 lib + 62 integration helios tests, 90 ignored; flare 246+8; flare-cli 219+26; 837 Python tests; 21 simulator workloads; TLC 2.19 lifecycle check | Stated in the description with exact counts | Nothing re-runnable here; orientation packet says no CI checks on the head commit, so no third-party confirmation of any suite |
| Curve evaluations bounded to one per eligible lane; zero for decode-only | #[cfg(test)] CURVE_EVALUATIONS counter (rounds.rs:635-636) and four tests (policy_tests.rs:9489, 9517, 9545, 9567) |
Tests are self-consistent with the counter; they count powered_curve calls, not powf calls — after the alpha-1 shortcut an "evaluation" can be a cheap clone |
| Decisions unchanged | cached_lane_pricing_matches_uncached_for_unit_and_fractional_alpha asserts equal candidate keys including c.rate.score.to_bits(), at alpha 1.0 and 0.6, widths 0/1/2/4/8, a 1-remaining-token lane, waiting Init, Mixed and packed Speculative, tie-breaking, optimistic probe paths, and plan() winners (policy_tests.rs:9567-9781) |
Strongest evidence in the PR; it is still a fixture-level equality test, not a differential run over production traces (contrast #188's ~210k-plan byte-identical trace check) |
| Kani sequential proofs not run | Disclosed | — |
Test counts moved in a positive direction vs #547's patch (three tests, ≤-style assertions, "371 passed") — #693 uses exact equalities and adds a fourth test.
9. Reach
- Who/what is affected: only the cost of scheduler candidate pricing on the model worker thread — the thread #188 documents as unable to poll completions while planning, so less time here means less submission delay. No user-visible output, no API, no wire/protobuf, no exported core format, no CUDA-graph or state transition, no dependency, no docs.
- Configuration and defaults: unchanged;
adaptive_verification_alphadefault 1.0 (policy.rs:41) means the alpha short-circuit is on by default for every deployment; non-default alphas take the oldpowfpath with a cache around it. - Resource use: one
[Option<Vec<f64>>; REQUEST_LANES](8 slots) per pass plus at most oneVec<f64>per decoding lane;next_progressallocates one when called without a cache. - Untouched paths that still do per-lane curve work:
add_prefill_candidate/resize_prefill(policy.rs:1947-2007, :1993-1999) andcoalescing_prefill_log_bonus(policy.rs:658-672). So the change does not make every per-pass curve evaluation single-shot, and prefill-heavy workloads see less benefit than the measured fixtures suggest. - Related issue lifecycle: #547 stays open unless someone closes it as fixed by #693, and it carries
triage:validation.
10. Process
- Draft vs ready: marked ready for review on opening, single commit-range
a9f7dd7, basemain. - CI: no checks on the head commit — the only test evidence is the author's own description.
- Review state: none requested/recorded; no reviewer assigned; no labels applied.
- Age: opened and last updated 2026-12-02 (same day as several of the author's other PRs — #686-#692 — suggesting a batch submission).
- Only cross-reference: "Fixes #547".
- Conflicts to expect: #571, #621, #334, #306 (same files); nothing merged since the branch point.
Open questions / could not be found
- Does shieldstar (author of #547 and its patch) approve of this reimplementation? No comment either way; the PR does not credit them, which conflicts with the charter's "Respect contributors" tone even though shieldstar is not on the priority-contributor list.
- Is the
next_progressrestructure (policy.rs:946-1012) truly equivalent for every state combination, in particulargenerated_tokens == 0with non-emptyspeculative_widthsandconsumed_tokens >= prompt_tokens? Reading says yes, but the PR does not flag the restructure at all. - Should the
mixed_candidatesoptimistic tag (policy.rs:1714) beoptimisticrather thanfalse? Nothing breaks today; the inconsistency is a latent trap. - Why re-add
CURVE_EVALUATIONSwhen a prior review of #540 asked for it to be deleted? No rationale in the PR. - Any served-workload evidence, or a reproducible benchmark for the timing table (charter #210 / design-review rule 12), and were the numbers re-measured after rebasing onto
cc0a49d2? The PR says the table predates the rebase. - Why
resize_prefillandcoalescing_prefill_log_bonuswere left uncached — #547 mentions the former as deliberate; the latter is not mentioned anywhere. - Whether the 21-workload simulator run counts as the
docs/design-review.md:195-203evaluation (which asks forlearning.py(not opened)'s screening and 64-seed catalog) — no mapping given. c513e46abaseline tree is unreadable in this checkout, so the pre-rebase comparison cannot be independently inspected.