Re review report · NVIDIA/hyperflare-inference #715

Raw Markdown for agents: https://autobot.eidonix.com/p/cee9d0c2-724a-499e-9293-85a7999d4632.md

Recommendation: Changes Requested

Between Round 1 (84f789a) and head caaef5a, the branch rebased onto newer main (dropping the stale-base helios/src/runtime_core/cache_memory.rs (not opened) hunk so the diff is now 20 files / +1638 -56), with no post-review code fixes or maintainer sign-off yet. Direct verification at caaef5a clears the Round 1 and Round 2 code-correctness alarms on packed_prefill_lane_compatible, continuation_candidate, packing.rs, and ignition/cli/serve.py — the core packed-prefill implementation is sound and cleanly isolated from B == 1 and ScoredPrefill. However, both hard governance/verification blockers remain unresolved (no recorded owner approval for the widened prefill operation contract, and missing Layer 2 simulator / Layer 3 widened-geometry conformance & mutation coverage), alongside three verified should-fix items (an Ignition-vs-Helios P <= prefill_chunk_size validation gap, normative contradictions in docs/scheduling-runtime-design.md, and a non-equivalent A/B baseline).

Merge Risk

Level: High

Walkthrough

Pre-merge Checks

Blockers

  1. Extended captured-graph operation contract has no recorded owner approval (docs/design-review.md:22-26, AGENTS.md:376-381 (not opened)).

    • Verified behavior/impact: docs/design-review.md:22-26 states: "Introducing a captured-graph operation family requires prior explicit approval from project owner Luke Alonso lalonso@gmail.com. Shape and capacity variants are allowed within an unchanged operation contract. A new operation contract requires approval even if it reuses a graph kind or enum value. A design acknowledgment does not grant approval." This PR changes the PREFILL/TERMINAL_PREFILL operation contract — admitting batch_capacity >= 2 with explicit packed_token_capacity (helios/src/execution/manifest.rs:860-878), changing InputIndexing::PackedToken extent to aggregate P rows (helios/src/model/packing.rs:169-179), defining binding-derived vision exclusion (helios/src/model/packing.rs:113-126), and formalizing multi-request per-lane SAMPLE_ENABLED prefill semantics (helios/model-contract.md:188-209). No maintainer comment, review, or linked approval exists on #715.
    • Fix: Obtain an explicit maintainer approval comment from Luke Alonso on #715 (or link the approval thread) for the extended Contract 3 prefill operation contract. (This is a sign-off gate, not a rejection — @original-el8 is a charter-named priority contributor and the feature fits the charter.)
  2. Testing-hierarchy Layers 2 and 3 are incomplete for the added cohort algorithm, timing rules, and widened prefill geometry (docs/design-review.md:195-251).

    • Verified behavior/impact:
      • Layer 2 (docs/design-review.md:195-208): Changes to cohort algorithms (helios/src/scheduler/policy.rs:1301-1426,1623-1747) and timing estimation (helios/src/scheduler/cost.rs:581-583,606-607,644-659,969) require evaluation against scripts/scheduling_sim/ and the 64-seed scripts/scheduling_sim/learning.py (not opened) catalog. No simulator run is reported, and scripts/scheduling_sim/scheduler.py:30-35 currently models at most one prefill lane per graph (for view in [None, *prefills] if graph.prefill_capacity else [None]).
      • Layer 3 (docs/design-review.md:226-228,241-246): While CI (.github/workflows/helios-lifecycle.yml (not opened)) runs existing TLC and Kani checks on helios/**, :241-246 requires extending conformance fixtures/harnesses when supported runtime geometries expand, and :226-228 requires mutation testing (check.py (not opened) --mutations) when adding safety guards. Neither verification/helios-lifecycle/** nor helios/src/scheduler/lifecycle_tests.rs (not opened) is updated to cover B >= 2 packed prefill geometry (scheduler.rs:436-465, packing.rs:422-439, is_non_terminal_prefill_step / deferred_prefill), and no --mutations run is reported. :247-251 states disclosure does not waive runnable CPU checks.
    • Fix: Extend and run scripts/scheduling_sim/ + learning.py (not opened) (or record owner agreement that Layer 2 is inapplicable to packed prefill), add Layer 3 lifecycle conformance coverage for the widened B >= 2 prefill geometry, and run python3 verification/helios-lifecycle/check.py (not opened) --mutations against the new safety guards.

Should Fix

  1. ignition/preparation/execution.py:80-92 omits packed_token_capacity <= prefill_chunk_size, allowing Ignition to export a core that Helios rejects at load time.

    • Verified behavior/impact: GraphSignature.__post_init__ (ignition/preparation/execution.py:80-92) checks 2 <= B <= MAX_CONCURRENCY, P >= 64, P % 64 == 0, P < 1 << 31, W <= P, and B <= P <= B * W, and PreparedExecution.__init__ / .manifest() (execution.py:253-360,395-460) never check prefill_chunk (ignition/preparation/execution.py has zero references to prefill_chunk). Helios enforces packed_token_capacity <= prefill_chunk_size at helios/src/runtime_core/selection.rs:281,293 (failing load with "invalid or duplicate serving graph variant" at :324), helios/src/model/catalog.rs:279, and helios/src/scheduler.rs:910. Example: GraphSignature("terminal_prefill", 8, 256, ("tokens",), packed_token_capacity=2048) passes Ignition under --prefill-chunk-size 1024, then fails to load in flare run.
    • Fix: Validate signature.packed_token_capacity <= prefill_chunk_size in Ignition preparation/export where prefill_chunk is known (e.g., PreparedExecution / export validation against server_config["prefill_chunk_size"]) and add a regression test in tests/preparation/test_execution.py.
  2. Canonical scheduler design doc (docs/scheduling-runtime-design.md) contradicts shipped timing and catalog behavior (AGENTS.md:231 (not opened)).

    • Verified behavior/impact: docs/scheduling-runtime-design.md:466-481 states unconditionally that pure prefill graphs (PREFILL, TERMINAL_PREFILL, SCORED_PREFILL) use the six-stratum PrefillCostModel and context-slope borrowing, whereas helios/src/scheduler/cost.rs:581-583, :606-607, and :969 now restrict PrefillCostModel creation and slope refresh strictly to key.batch == 1 (packed prefill uses flat ReplayTimes). In addition, docs/scheduling-runtime-design.md:21-23 (catalog enumeration) and :455-457 (cost-entry identity) omit packed multi-request prefill and prefill packed_token_capacity, and never link docs/packed-prefill-design.md.
    • Fix: Update docs/scheduling-runtime-design.md (catalog, cost-entry identity, and the batch == 1 scope of stratified prefill modeling vs. ReplayTimes for batch >= 2 packed prefill) and reference docs/packed-prefill-design.md.
  3. Headline performance A/B does not use an equivalent baseline (docs/design-review.md:109-115).

    • Verified behavior/impact: As honestly disclosed in the PR description, the baseline 151-graph core (887785ad) was exported from an earlier FlashInfer revision while the packed 157-graph core (4aea5c54) was exported against FlashInfer 5a8ceed80, and the C=1 solo control regressed 111.2 ms → 118.7 ms (0.94×). The 1.68×–4.15× TTFT and 1.75×–4.23× throughput numbers therefore cannot be isolated strictly to packed prefill under docs/design-review.md:109-111 ("equivalent baselines").
    • Fix: Run and report an equivalent A/B using cores exported from the same FlashInfer revision and runtime binary (or packed prefill off/on on an identical build), including the C=1 control.

Subtract / Simplify

  1. Deduplicate the twin packed-prefill cohort builders (helios/src/scheduler/policy.rs:1300-1426 vs. :1623-1747). Both implement the same offer enumeration, < 2 check, by_density in [false, true] double-pass sort, and greedy (batch, packed) fill. They have already drifted on tie-breaking (:1367 omits the .then_with(|| wa.cmp(&wb)) present at :1691), both repeat a redundant .then_with(|| vb.total_cmp(&va)) when by_density == false (:1362-1367, :1684-1690), and :1374-1395 allows ready lanes to consume all batch slots ahead of promoted lanes and trigger promoted_count == 0 => continue (unlike best_two_stage_cohort, which enforces minimum_preparing = 1). Extracting one parameterized helper removes ~110 lines, removes the drop(consider); artifact at :1300, and fixes the tie-break drift and ready-crowding edge case.
  2. Delete dead packed-prefill re-validation in commit (helios/src/scheduler.rs:2617-2632). commit already calls step.validate_mixed()?; at :2575, which enforces lane.tokens > token_capacity (:452), checked_add sum > packed_token_capacity (:456-457), and packed_token_capacity < batch_capacity (:442) for packed prefill, making :2617-2632 unreachable. (Keep :2614-2616 step.lanes.len() > step.batch_capacity, which is still live for Decode/Init/Restore/Snapshot/Prefill(B=1).)
  3. Unify the repeated (B, W, P) geometry conjunction into one helper. The same 7-term geometry check is duplicated across helios/src/execution/manifest.rs:860-872,920-923, helios/src/model/catalog.rs:273-281, helios/src/runtime_core/selection.rs:285-294, and helios/src/scheduler.rs:439-446,902-912. A shared validator next to GraphDescriptor removes ~40 lines and keeps future edits in lockstep.
  4. Minor cleanups:
    • helios/src/scheduler.rs:951-953: packed_prefill_catalog is sorted on (kind as u8, batch, width, packed) (:899-901); replace linear .contains(...) with binary_search_by_key (or precompute the non_terminal bool during packed_prefill_graphs).
    • helios/src/scheduler/policy.rs:1630-1632: drop the redundant if self.packed_prefill_catalog.is_empty() { return; } before iterating &self.packed_prefill_catalog.
    • helios/src/scheduler/cost.rs:644-659: packed_prefill_duration is a thin pass-through over the already-public duration_key.
    • helios/src/server/runtime.rs:849-899: partition manifest.graphs once on batch_capacity == 1 instead of repeating && batch_capacity == 1 across three sibling filter chains.

Nits

Dropped on verification