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
- Widens the
PREFILL/TERMINAL_PREFILLcaptured-graph operation contract (batch_capacity >= 2, aggregateP-rowPACKED_TOKENlayout, per-laneSAMPLE_ENABLED, binding-derived vision exclusion) without recorded owner approval underdocs/design-review.md:22-26. - Adds ~342 lines to
helios/src/scheduler/policy.rs(including a duplicated greedy cohort builder with a tie-break divergence and a ready-crowding-out-promoted edge case) without Layer 2 simulator evaluation or Layer 3 conformance fixtures covering the newB >= 2geometry. - Ignition's
GraphSignature/PreparedExecutionvalidation omitsP <= prefill_chunk_size, allowing a prepared core to export cleanly and then fail Helios core selection at load time.
Walkthrough
- Manifest, catalog, and selection (
helios/src/execution/manifest.rs:860-878,914-924,helios/src/model/catalog.rs:266-282,helios/src/runtime_core/selection.rs:280-295,361-370,helios/src/scheduler.rs:891-921): validatePrefill/TerminalPrefillwith2 <= B <= request_capacity,1 <= W <= P, 64-alignedP(max(64, B) <= P <= B * W,P <= prefill_chunk_size),draft_tokens == 0, keepB == 1(P == 0) andScoredPrefillunchanged, and filterB >= 2shapes bymax_batch(dropping all when--max-concurrency 1). - Input packing (
helios/src/model/packing.rs:113-126,169-188,422-439,helios/src/model/inputs.rs:87-91): forbid vision bindings onB >= 2prefill graphs, sizeInputIndexing::PackedTokenbuffers toP, validate per-lanetokens <= W, aggregatesum <= P, andimage_slot.is_none()beforestaging.clear(), and drive per-laneSampleEnabledfromstart_position + tokens == prompt_tokens. - Scheduler, cost model, checkpoints, and runtime (
helios/src/scheduler/policy.rs:1300-1426,1585-1747,2042-2072,helios/src/scheduler/cost.rs:581-583,606-607,644-659,969,helios/src/scheduler/checkpoints.rs:925-936,helios/src/scheduler.rs:436-465,940-955,2614-2632,2685-2700,helios/src/server/runtime.rs:849-900): registerB >= 2packed prefill shapes separately, gatePrefillCostModeland context-slope refresh onbatch == 1, track packed replay times viaReplayTimes, greedily pack 2..B text-only prefill lanes in both single-step andInit/Restorecontinuation valuation, and track non-terminal packed steps fordeferred_prefilland checkpoint capture. - Ignition and direct mode (
ignition/preparation/execution.py:80-96,ignition/cli/serve.py:465-469,ignition/direct/scheduler.py:197-202,290-291): validate(B >= 2, W, P)text-only prefill signatures, scope--packed-verificationchecks tospeculativesignatures so packed prefill does not spoof speculative verification, and keep direct-modecapacities()isolated toB == 1solo prefill. - Docs and tests (
docs/packed-prefill-design.md,helios/model-contract.md:188-209,helios/manifest.md:264-273,helios/src/scheduler/policy_tests.rs:9600-9820,helios/src/model/tests.rs:2715-2819,helios/src/runtime_core/selection.rs:2150-2244,tests/preparation/test_execution.py:409-437): specify additive Contract 3 packed prefill and add unit tests covering geometry, vision/logprob isolation, multi-lane packing, mixed finishing/continuing lanes, and--max-concurrencyfiltering.
Pre-merge Checks
- [PASS] Security / malicious screen: No prompt-injection or instruction-redirection content in the PR body, comments, or diff; all review/provenance text was treated strictly as content.
- [PASS] Charter & value fit: Model-agnostic runtime (capacities enumerated from core metadata via
packed_prefill_graphs(), no per-model branches or hardcoded bucket lists), backward-compatible with pre-change cores (887785ad), and authored by a charter-named priority contributor (@original-el8). - [WARN] Related / duplicate / conflict check: Additive feature with no duplication, but shares
policy.rs,checkpoints.rs, and validation surfaces with active scheduling/admission work (#621,#693,#718). - [WARN] Tests & verification evidence: Layer 1 Rust/Python unit coverage is strong and legacy core compatibility is demonstrated, but Layer 2 simulator coverage and Layer 3 packed-geometry conformance fixtures / mutation testing are missing, and the A/B baseline crosses FlashInfer revisions.
Blockers
-
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-26states: "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 thePREFILL/TERMINAL_PREFILLoperation contract — admittingbatch_capacity >= 2with explicitpacked_token_capacity(helios/src/execution/manifest.rs:860-878), changingInputIndexing::PackedTokenextent to aggregateProws (helios/src/model/packing.rs:169-179), defining binding-derived vision exclusion (helios/src/model/packing.rs:113-126), and formalizing multi-request per-laneSAMPLE_ENABLEDprefill 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-el8is a charter-named priority contributor and the feature fits the charter.)
- Verified behavior/impact:
-
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 againstscripts/scheduling_sim/and the 64-seedscripts/scheduling_sim/learning.py(not opened) catalog. No simulator run is reported, andscripts/scheduling_sim/scheduler.py:30-35currently 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 onhelios/**,:241-246requires extending conformance fixtures/harnesses when supported runtime geometries expand, and:226-228requires mutation testing (check.py (not opened) --mutations) when adding safety guards. Neitherverification/helios-lifecycle/**norhelios/src/scheduler/lifecycle_tests.rs(not opened) is updated to coverB >= 2packed prefill geometry (scheduler.rs:436-465,packing.rs:422-439,is_non_terminal_prefill_step/deferred_prefill), and no--mutationsrun is reported.:247-251states disclosure does not waive runnable CPU checks.
- Layer 2 (
- 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 widenedB >= 2prefill geometry, and runpython3 verification/helios-lifecycle/check.py (not opened) --mutationsagainst the new safety guards.
- Verified behavior/impact:
Should Fix
-
ignition/preparation/execution.py:80-92omitspacked_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) checks2 <= B <= MAX_CONCURRENCY,P >= 64,P % 64 == 0,P < 1 << 31,W <= P, andB <= P <= B * W, andPreparedExecution.__init__/.manifest()(execution.py:253-360,395-460) never checkprefill_chunk(ignition/preparation/execution.pyhas zero references toprefill_chunk). Helios enforcespacked_token_capacity <= prefill_chunk_sizeathelios/src/runtime_core/selection.rs:281,293(failing load with"invalid or duplicate serving graph variant"at:324),helios/src/model/catalog.rs:279, andhelios/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 inflare run. - Fix: Validate
signature.packed_token_capacity <= prefill_chunk_sizein Ignition preparation/export whereprefill_chunkis known (e.g.,PreparedExecution/ export validation againstserver_config["prefill_chunk_size"]) and add a regression test intests/preparation/test_execution.py.
- Verified behavior/impact:
-
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-481states unconditionally that pure prefill graphs (PREFILL,TERMINAL_PREFILL,SCORED_PREFILL) use the six-stratumPrefillCostModeland context-slope borrowing, whereashelios/src/scheduler/cost.rs:581-583,:606-607, and:969now restrictPrefillCostModelcreation and slope refresh strictly tokey.batch == 1(packed prefill uses flatReplayTimes). In addition,docs/scheduling-runtime-design.md:21-23(catalog enumeration) and:455-457(cost-entry identity) omit packed multi-request prefill and prefillpacked_token_capacity, and never linkdocs/packed-prefill-design.md. - Fix: Update
docs/scheduling-runtime-design.md(catalog, cost-entry identity, and thebatch == 1scope of stratified prefill modeling vs.ReplayTimesforbatch >= 2packed prefill) and referencedocs/packed-prefill-design.md.
- Verified behavior/impact:
-
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 FlashInfer5a8ceed80, and theC=1solo control regressed111.2 ms → 118.7 ms(0.94×). The1.68×–4.15×TTFT and1.75×–4.23×throughput numbers therefore cannot be isolated strictly to packed prefill underdocs/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=1control.
- Verified behavior/impact: As honestly disclosed in the PR description, the baseline 151-graph core (
Subtract / Simplify
- Deduplicate the twin packed-prefill cohort builders (
helios/src/scheduler/policy.rs:1300-1426vs.:1623-1747). Both implement the same offer enumeration,< 2check,by_density in [false, true]double-pass sort, and greedy(batch, packed)fill. They have already drifted on tie-breaking (:1367omits the.then_with(|| wa.cmp(&wb))present at:1691), both repeat a redundant.then_with(|| vb.total_cmp(&va))whenby_density == false(:1362-1367,:1684-1690), and:1374-1395allowsreadylanes to consume allbatchslots ahead ofpromotedlanes and triggerpromoted_count == 0 => continue(unlikebest_two_stage_cohort, which enforcesminimum_preparing = 1). Extracting one parameterized helper removes ~110 lines, removes thedrop(consider);artifact at:1300, and fixes the tie-break drift and ready-crowding edge case. - Delete dead packed-prefill re-validation in
commit(helios/src/scheduler.rs:2617-2632).commitalready callsstep.validate_mixed()?;at:2575, which enforceslane.tokens > token_capacity(:452),checked_addsum> packed_token_capacity(:456-457), andpacked_token_capacity < batch_capacity(:442) for packed prefill, making:2617-2632unreachable. (Keep:2614-2616step.lanes.len() > step.batch_capacity, which is still live forDecode/Init/Restore/Snapshot/Prefill(B=1).) - Unify the repeated
(B, W, P)geometry conjunction into one helper. The same 7-term geometry check is duplicated acrosshelios/src/execution/manifest.rs:860-872,920-923,helios/src/model/catalog.rs:273-281,helios/src/runtime_core/selection.rs:285-294, andhelios/src/scheduler.rs:439-446,902-912. A shared validator next toGraphDescriptorremoves ~40 lines and keeps future edits in lockstep. - Minor cleanups:
helios/src/scheduler.rs:951-953:packed_prefill_catalogis sorted on(kind as u8, batch, width, packed)(:899-901); replace linear.contains(...)withbinary_search_by_key(or precompute thenon_terminalbool duringpacked_prefill_graphs).helios/src/scheduler/policy.rs:1630-1632: drop the redundantif self.packed_prefill_catalog.is_empty() { return; }before iterating&self.packed_prefill_catalog.helios/src/scheduler/cost.rs:644-659:packed_prefill_durationis a thin pass-through over the already-publicduration_key.helios/src/server/runtime.rs:849-899: partitionmanifest.graphsonce onbatch_capacity == 1instead of repeating&& batch_capacity == 1across three sibling filter chains.
Nits
helios/src/scheduler/policy.rs:1585:is_text_only_prefill_request(&self, r: &LiveRequest)does not useselfand checks!r.prompt_logprobseven though both callers already filter toGraphKind::Prefill(prompt_logprobsmaps toScoredPrefill).helios/src/scheduler/policy.rs:1653vs.:2102,2233: packed prefill lanes useestimated_checkpoint_cut(quote_storage = false) and skip theavailable_plancheckpoint_cutreconciliation (candidate.batch == 1), so under snapshot-storage exhaustion a packed lane may stop slightly early at an un-capturable cut (safe, just slightly conservative).docs/packed-prefill-design.md:112-137documents recipe code that lives inlocal-inference-lab/hyperflare-recipes#153, and line 51 ("No per-model flags ... are introduced") sits alongside line 46/133's--packed-prefillrecipe flag — clarify that line 51 refers to Helios runtime flags.- The PR description still lists the stale-base
helios/src/runtime_core/cache_memory.rs(not opened) compilation fix bullet even though that file is no longer in the 20-file diff atcaaef5a.
Dropped on verification
- Code Correctness Finding 1 & Round 1 Should Fix #1 (
policy.rs:1592-1621packed_prefill_lane_compatibleshort-circuit onTerminalPrefill): Dropped as false. Directly verified thathelios/src/model/inputs.rs:87-91setsframe.samples[row] = i32::from(!step.lane_kind(row).is_prefill() || lane.start_position + lane.tokens == live.prompt_tokens)so mid-prompt lanes receiveSampleEnabled = 0and do not emit spurious tokens;scheduler.rs:3093-3094keeps them inRequestPhase::Prefill;helios/model-contract.md:176-180establishes thatTerminalPrefillcomputes complete continuation state so clearingdeferred_prefill(scheduler.rs:3065-3066) and permitting capture (checkpoints.rs:935-936) is sound; mixed finishing + continuing lanes on packedTerminalPrefillare an explicit, tested feature (policy_tests.rs:9709-9746,model/tests.rs:2762-2804); and forPrefillwith!non_terminal, rejectingr.deferred_prefillthen returningtruematches soloresolve_prefill_kind_from(scheduler.rs:994-999). - Code Correctness Finding 2 (
policy.rs:1301-1426"packed loop sits insideconsider(...)causingO((M+B+S)*S_pack*N log N)hot-path blowup"): Dropped as false.considercloses atpolicy.rs:1273and is dropped at:1300; the packed loop at:1301executes outsideconsider, once percontinuation_candidatecall. - Code Correctness Finding 6 (
policy.rs:1382"promoted_count == capacitycompares lane count against token capacity"): Dropped as false.capacityiscontinuation_candidate's own parameter (policy.rs:1052, passed asbatchfromadd_candidateat:1796), i.e., the first-stage graph's batch capacity, not a token capacity. - Gates & Contracts M3 & Round 1 Should Fix #3 (
ignition/cli/serve.py:466"undeclared public-CLI rejection for--packed-verification"): Dropped as false. It is explicitly declared in the PR description ("Scopes--packed-verificationchecks tospeculativesignatures"), cannot reject any previously valid recipe becauseignition/preparation/execution.py:93-96previously forbade nonzeropacked_token_capacityon all non-speculative graphs, and is required to prevent packed prefill signatures from falsely satisfying--packed-verification. - Code Correctness Finding 4 (
ignition/preparation/execution.py:109-111rejectingdraft_tokens=0): Dropped as false.helios/src/runtime_core/selection.rs:318also requiresgraph.draft_tokensto be absent (None) for non-speculative graphs, andexecution.py:428serializesdraft_tokenswhenevernot None; accepting0would produce unloadable cores. - Code Correctness Finding 5 (
helios/src/model/packing.rs:169-179,549-574unzeroedPackedTokentail rows[Σ lane.tokens, P)): Dropped as false. Matches the pre-existingPackedTokenupload contract across soloPrefill,Mixed, andSpeculative(packing.rs:531-548,861);QueryLength(SubmissionRow, zero-padded) governs active token rows, andmodel/tests.rs:2813explicitly verifies compact active-onlytoken_idsuploads. - Code Correctness Finding 7 (
helios/src/runtime_core/selection.rs:361-370--max-concurrencyfilteringbatch_capacity <= max_batch): Dropped as intentional design matchingDecode,Speculative, andMixedgraph filtering and explicitly tested atselection.rs:2178-2202. - Code Correctness Finding 8 (
selection.rs:281config["prefill_chunk_size"].as_u64().unwrap_or(0)): Dropped as low-signal — identical to the pre-existingGraphKind::Mixedcheck four lines above (selection.rs:277). - Dossier / Value Prop claim of "undeclared all-prefill checkpoint-pricing rewrite in
checkpoints.rs": Dropped as a stale-base artifact.pr_filesconfirmshelios/src/scheduler/checkpoints.rsis+12 -3, touching only thenon_terminaldispatch at:925-936. - Round 1 "raw TLC/Kani unrun" and "Layer 1 local failures" claims: Withdrawn/calibrated. CI (
.github/workflows/helios-lifecycle.yml(not opened)) runs existing TLC/Kani onhelios/**, and the 6runtime-core,serverlocal failures (FLARE_TEST_TEMPLATE_DIR) and 3tests/clifailures (stale local wheel) are documented environment prerequisites rather than code defects. - Subtraction S2/S3 partial overclaims:
helios/src/execution/manifest.rs:920does enforce(2..=self.request_capacity()).contains(&graph.batch_capacity), andhelios/src/scheduler.rs:2614-2616(step.lanes.len() > step.batch_capacity) is still reachable forDecode/Init/Restore/Snapshot/Prefill(B=1)becausevalidate_mixedonly checks lane counts forSpeculative,Mixed, and packedPrefill/TerminalPrefill.