Subtractive report · NVIDIA/hyperflare-inference #540

Raw Markdown for agents: https://autobot.eidonix.com/p/bf839858-463c-4b14-b722-b03f28033458.md

Key findings

The four behaviours themselves are argued and measured, and nothing here says they are unneeded: I found no part that serves no stated purpose. The finding is volume — the change adds 3,965 lines for four scheduler behaviours, and roughly 685 of them are removable without losing a single decision or assertion.

Ranked by lines saved:

# Severity Where Removable
1 Should fix helios/src/model/tests.rs, helios/src/scheduler/tests.rs — three overlapping end-to-end copy tests ~250
2 Should fix helios/src/scheduler/rounds.rs:755-904 — copy-only loop duplicates the ordinary loop ~100
3 Should fix helios/src/scheduler/sam.rs:1112-1189 + test — dead public API ~100
4 Should fix helios/src/scheduler/sam.rs — test-only public surface (propose_for_context, MatchSource, accessors) ~80
5 Should fix helios/src/scheduler.rs:1112-1205 — same match algorithm twice ~40
6 Should fix helios/src/scheduler/{policy,rounds}.rs — Candidate.expected duplicates rate ~35
7 Should fix helios/src/scheduler/refresh.rs:95-99 + scheduler.rs:1281 + policy_tests — empty idle() and its no-op assertions ~20
8 Nit manifest.rs / catalog.rs / execution.py, policy.rs dimension checks, duplicated docs, duplicated constant ~60

Size accounting: 25 files, +3965 / −119. Test additions alone: model/tests.rs +324, policy_tests.rs +501, scheduler/tests.rs +583. Production: sam.rs +1606 (of which ~370 are tests/benchmark), rounds.rs +194, scheduler.rs +180, policy.rs +119, cost.rs +120, selection.rs +109, speculation.rs +103.


1. Should fix — three new end-to-end tests re-prove the same SAM→pack path (~250 lines)

helios/src/model/tests.rs:846-953 (history_draft_packing_forwards_per_request_prompt_sam_continuations, 108 lines) and helios/src/model/tests.rs:1861-2075 (wide_copy_verify_catalog_packs_23_sam_tokens_and_preserves_legacy_w8_cores, 215 lines) do the same thing twice: build a scheduler with history drafts, run Init→Prefill→Decode emitting a token that completes a 6+ token suffix, plan a speculative step, pack, and assert on the copy_token_ids/copy_token_count uploads. The wide test additionally repeats the "legacy W=8 core still loads" assertion already owned by helios/src/runtime_core/selection.rs:1876-1940 (wide_copy_graphs_retain_only_when_history_drafts_enabled), and the plan-selection assertions duplicated in helios/src/scheduler/tests.rs:4108+.

helios/src/scheduler/tests.rs:1995-2127 (request_sam_proposes_prompt_continuations_and_isolates_requests, 132 lines) re-proves sam.rs's own prompt_only_match_succeeds_with_zero_prior_output, output_overrides_prompt_recency_on_tie and shared_prompt_sam_isolates_per_request_outputs_and_bounds_states at the scheduler level; only the admission/enable_history_drafts wiring and the status == 3 path (~30 lines) are scheduler-specific.

Replacement: keep the wide-graph packing test (it is the only one that exercises draft_source=2 end to end), fold the 846-953 case into it as three extra assertions, keep the selection test as the legacy-load proof, and trim 1995-2127 to its admission assertions. ~250 lines of the PR's +1,408 test lines go; every fibre (prompt SAM → pack → upload, wide-graph retention, W=24 selection, per-request isolation) stays covered exactly once.

2. Should fix — rounds.rs copy-only candidate block duplicates the ordinary packed-round search (~100 lines)

helios/src/scheduler/rounds.rs:755-904 is a 150-line copy of the ordinary speculative loop at :905-1060. It repeats, almost line for line: the 3-ordering loop (:818-829 vs :981-984), the identical rank closure (:830-832 vs :986), select_nth_unstable_by+truncate+sort_unstable_by (:833-838 vs :987-992), frontier.clear(), the mask/host_lengths/lane_terms accumulation and best-tracking closure (:840-876 vs :993-1046). The only real differences are the curve source (copy_curves[slot] / wide_copy_curve vs curves[slot] / powered_curve) and the availability gate at :769-790. Even the ranks_by_slot/slots_by_rank construction at :801-806 re-implements host_prefix_ranking (:492-513).

Replacement: one loop taking a per-slot curve provider (plus the optional gate), so the two curves/copy_curves caches at :747-748 collapse into one [Option<Vec<f64>>; REQUEST_LANES]. The copy branch's _ => full / limit ordering is already the main loop's third ordering, so the merged loop's ordering set is unchanged. ~90-110 of the 150 lines go; identical candidate set, identical tie-breaks.

3. Should fix — propose_conditional_continuations has no caller (~100 lines)

helios/src/scheduler/sam.rs:1112-1189 (pub fn propose_conditional_continuations, 78 lines with doc) is called only by its own test sam.rs:1491-1514. Grep over helios returns the definition and that test, nothing else. Its justification in the PR body — "a building block for conditional copy lookup tables in 2-deep pipelined execution" — describes machinery that exists neither in this PR nor in the repository; speculative execution here is one round deep (rounds.rs plans per-round candidates).

Replacement: nothing. Delete :1112-1189 and the test at :1491-1514. Nothing reads active_drafts anywhere else, so no other path is affected.

4. Should fix — sam.rs public surface with test-only callers (~80 lines)

In helios/src/scheduler/sam.rs, none of the following has a production caller; production touches only PromptOutputSAM::new, push_token/push_slice, propose, into_padded_i64:

Replacement: nothing. ~65-80 lines go. (dynamic_memory_bytes, memory_bytes, state_count, transition_count on PromptSAM feed the #[ignore] microbenchmark quoted in the PR body; keep them if the benchmark stays.)

5. Should fix — the same match algorithm twice in scheduler.rs (~40 lines)

helios/src/scheduler.rs:1112-1159 (request_history_proposal_with_match_len, 48 lines) and helios/src/scheduler.rs:1163-1205 (request_copy_match_stats, 43 lines) are the same algorithm: clamp maximum by completion_token_capacity - 1 and COPY_DRAFT_CAPACITY (:1117-1119 / :1168-1170), early-return on maximum == 0 or no decoded history (:1120-1122 / :1171-1173), fetch the request (:1123-1125 / :1174-1176), propose from request.sam and clip at the first out-of-vocabulary id (:1127-1138 / :1178-1186), look up the shared ring with lookup_with_match_len (:1139-1142 / :1187-1194), then pick the shared result iff shared_match > sam_match (:1143-1158 / :1195-1204). The only difference is that the first materialises a padded Vec<i64> and the second reports lengths.

Note also request_history_proposal (:1102-1109) is a 6-line pass-through that discards match_len from request_history_proposal_with_match_len; its callers model/packing.rs:402 and server/runtime.rs:2146 use only (tokens, count).

Replacement: one private fn request_copy_match(&self, handle, maximum) -> (Option<Padded>, usize /*count*/, usize /*match_len*/); request_copy_match_stats returns (count, match_len) from it and request_history_proposal_with_match_len returns the padded form, both 3-6 lines. Better still, have callers use the one function and drop request_history_proposal too. ~40 lines; identical decisions, identical short-circuits, SAM propose and shared lookup still happen once per call.

6. Should fix — Candidate.expected duplicates Candidate.rate (~35 lines)

helios/src/scheduler/utility.rs:116-140: ValueRate::new(duration_ns, expected_value, age_price) derives its score purely from (duration_ns, expected_value, age_price), and with duration_ns == 0 the score is expected_value. Candidate (helios/src/scheduler/policy.rs:86-93) already carries duration_ns: u64 and rate: ValueRate. So the new expected: f64 (policy.rs:89) is recomputable, and every site that maintains a second accumulator for it is duplication:

Replacement: drop rate (its only reads are policy.rs:1284 and ordinary.rate.duration_ns at :1292, which equals candidate.duration_ns), keep expected, and build the refresh comparison as ValueRate::new(0, c.expected, age_price) inside the single compare. Every Candidate { … } literal at rounds.rs:731-734, :886-901, :1055-1059, policy.rs:1238-1250, :1426-1430 shrinks by one field. Behaviour identical: refresh ranking still orders by zero-duration expected value.

7. Should fix — RefreshState::idle is now an empty function (~20 lines)

helios/src/scheduler/refresh.rs:95-99 is pub fn idle(&mut self) {} with an 8-line doc comment explaining that it retains credit by doing nothing; its only caller helios/src/scheduler.rs:1281 (self.refresh.idle();) is therefore a no-op. RequestScheduler::idle keeps its submissions guard (server/runtime.rs:1184 relies on that part), so nothing else regresses.

Replacement: delete the method and the call; abort() (refresh.rs:101-105) keeps the only copy of the clamp-to-nonpositive logic. Five tests then lose their idle-changes-nothing assertions — helios/src/scheduler/policy_tests.rs:2610-2611, 2638-2639, 2689-2700, 2730, 2751, 3685-3687 — roughly 8 assertion lines plus the surrounding calls. One docs sentence in docs/scheduling-runtime-design.md stating "idle retains earned credit" covers the surviving behaviour.

8. Nit — duplicated clauses and constants (~60 lines)


What is not a finding

Open questions / could not verify