#1 [high] PR #715 subtraction/simplicity audit — findings (verified at 4e3e2c3)
Verified against PR head 4e3e2c3 (line numbers are head-relative, read via read_file at PR head).
-
Packed-lane geometry validated THREE times: helios/src/scheduler.rs:436-463 (ScheduledStep::validate_mixed: geometry + lanes nonempty + len<=batch + lane.tokens<=token_capacity + sum<=packed + duplicate slots), helios/src/model/packing.rs:422-439 (Inputs::pack_step: lane.tokens>graph.tokens, sum>packed_tokens, same error messages reworded), helios/src/model/inputs.rs:43-48 (already
step.lanes.len() > step.batch_capacity). pack_inputs calls step.validate_mixed() at inputs.rs:35 before pack. Delete packing.rs:422-439 (~18 lines) or extract one lane predicate. -
policy.rs:1306-1348 (continuation packed block inside continuation_candidate) and policy.rs:1754-1798 (packed_prefill_candidates) are the same 8-step block: packed_prefill_duration -> horizon (
if ns == 0 || duration_ns == 0 {0} else {ns.saturating_add(duration_ns)}) -> is_non_terminal_prefill_step -> packed_prefill_offers -> select_packed_prefill_cohort -> ValueRate compare/best. Collapse into one helper taking Option continuation (~40 lines). -
selection.rs:282-300 nested
usize::try_from(...).zip(usize::try_from(...).ok()).zip(...).zip(...)with pattern|(((b, w), p), chunk)|only exists because valid_packed_prefill_geometry takes usize; fields are u64. Either take u64 in the helper oras usize. -
packing.rs / manifest.rs: manifest.rs:936-951 nests
if graph.batch_capacity == 1 { [1,16].contains ... } else { // already validated above\n graph.batch_capacity >= 2 }duplicating ScoredPrefill's identical width rule. Flatten to a guarded match arm. -
scripts/scheduling_sim/scheduler.py:55-56 dead code:
key = (total_val, len(chosen), total_tokens, tuple(reversed(names)))— index 3 (tuple(reversed(names))) computed and never read; comparison uses key[:3] and best[3]==names (chosen order), sotuple(reversed(names))is pure waste. -
scripts/scheduling_sim/model.py:38-50 and timing.py:32-44 are byte-identical packed validation blocks (same messages "packed prefill graphs must be prefill-only with width 1", "invalid packed prefill token capacity") in Graph vs GraphSpec post_init.
-
Same rank-key expression duplicated 4x:
(a.graph.packed_token_capacity or a.graph.prefill_capacity) + a.graph.decode_capacity * a.graph.widthat scheduler.py:101, learning_policy.py:247, learning_policy.py:253, utility.py:309; plusbucket[:3]... (separate). Fix: Graph.cost_weight property. -
policy.rs:1723-1752 packed_prefill_lane_compatible:
if kind == GraphKind::TerminalPrefill { return true; }makes (non_terminal, terminal_only, work, cut) dead on that path;kindis used only for that early return. Drop the param / hoist check to the 2 call sites (policy.rs:1704-1715, 2091-2097). -
policy.rs:1518-1619 select_packed_prefill_cohort overloads
promoted_limit: Option<usize>for three meanings: None = ready-only, Some(0) = early-return (line 1525), Some(cap) = continuation seeding (1552-1570). Split into ready-only + continuation variants.
No new CLI flags/config knobs for packed prefill in the diff (catalog comes from core graphs; selection.rs retain-filter only).