Recommendation: Changes Requested
The packed-prefill feature itself is well-built and correctly gated: geometry validation (manifest.rs, catalog.rs, selection.rs, scheduler.rs) is complete and mutually consistent, B == 1 and ScoredPrefill paths are genuinely untouched, and the code adds no per-model flag or hardcoded bucket list. Two hard gates are nonetheless unmet — the extended prefill operation contract has no recorded owner approval (docs/design-review.md:22-26, AGENTS.md:376-381), and testing-hierarchy layers 2–3 were not run even though docs/design-review.md:247-251 explicitly forecloses the "unavailable host" excuse. Two verified scheduler/validation asymmetries also let packed prefill do things the solo planner provably never does and let Ignition accept a core Helios rejects.
Merge Risk
Level: High
- The change redefines what a
PREFILL/TERMINAL_PREFILLgraph is (multiple simultaneous requests per graph, a newPACKED_TOKENrow layout of extentP, per-laneSAMPLE_ENABLEDcompletion, eligibility derived from absent vision bindings), so it needs owner sign-off that the repo does not record anywhere. - New greedy cohort code lands on
helios/src/scheduler/policy.rs, the file five merged PRs (#645,#655,#661,#663,#697) touched in the five days before this one — and the same algorithm is written twice with three live divergences. - The headline 1.68×–4.15× A/B compares two different signed cores exported from different FlashInfer revisions, with the C=1 control moving 111.2 → 118.7 ms (0.94×), so the figures are not an isolated measurement of packed prefill.
Walkthrough
- Manifest / catalog / selection (
helios/src/execution/manifest.rs:860-878,helios/src/model/catalog.rs:266-282,helios/src/runtime_core/selection.rs:260-275,helios/src/scheduler.rs:891-921): acceptPrefill/TerminalPrefillwithB >= 2,1 <= W <= P, 64-alignedP,draft_tokens == 0,P <= prefill_chunk_size;B == 1must keeppacked == 0;selection.rs:341-350dropsB >= 2graphs when--max-concurrency 1. - Packing (
helios/src/model/packing.rs:113-126,:169-188,:422-439): vision bindings rejected onB >= 2prefill,PACKED_TOKENextent sized toP, andpack_stepvalidates lanes/sum/image beforestaging.clear()at:440, so a rejected lane cannot leave half-written buffers. - Scheduler (
helios/src/scheduler/policy.rs:1300-1426,:1623-1747,:1592-1621): two greedy cohort builders pack 2..B text-only lanes undersum(work) <= P, competing on the same age-pricedValueRateas soloPrefill,Decode/Speculative, andMixed;scheduler.rs:436-465re-validates the resulting geometry invalidate_mixed. - Cost model (
helios/src/scheduler/cost.rs:644-659,:581-583,:606-607):packed_prefill_durationkeys packed shapes on(kind,B,W,P);PrefillCostModelcreation and slope refresh are now gated onbatch == 1so packed shapes cannot poison the solo predictor. - Ignition (
ignition/preparation/execution.py:80-96,ignition/direct/scheduler.py:197-201,:290-291):GraphSignaturevalidates(B,W,P)geometry and rejects vision inputs; direct mode isolates the 4-tuple packed keys from theB == 1capacities()catalog. - Docs (
docs/packed-prefill-design.md,helios/model-contract.md:188-209,helios/manifest.md(not opened)): additive Contract-3 subsection;docs/packed-prefill-design.md:45-46,112-137documents recipe code that exists only inlocal-inference-lab/hyperflare-recipes#153.
Pre-merge Checks
- [PASS] Security / malicious screen: No injection or instruction-redirection content; a provenance/verification note in the briefing material and the author's A/B summary were treated as content, not instructions. One author comment, zero maintainer reviews.
- [PASS] Charter & value fit: Model-agnostic (capacities read from
packed_prefill_graphs()), nosupports_*flag, no hardcoded shape list —docs/design-review.md:27-35and:58-61are satisfied. - [WARN] Related / duplicate / conflict check: File overlap but no feature duplication with open #621, #693, #571, #718; #621 (admission validation) and #718 (prefill KV handoff) both touch the same validation surfaces and need ordering.
- [WARN] Tests & verification evidence: Layer 1 is broadly covered (
policy_tests.rs:9661-9790exercises solo preservation, burst packing,B*W > Pbudgeting, and vision/logprob isolation), but layers 2–3 are unreported and the A/B baseline is not equivalent.
Blockers
-
Extended captured-graph operation contract has no recorded owner approval.
docs/design-review.md:22-26(mirrored atAGENTS.md:376-381): "A new operation contract requires approval even if it reuses a graph kind or enum value. A design acknowledgment does not grant approval." This changes the prefill operation contract, not just its shapes: multiple simultaneously active requests per graph (helios/model-contract.md:198-207), a newPACKED_TOKENrow layout of extentP(helios/src/model/packing.rs:169-188), per-laneSAMPLE_ENABLEDcompletion semantics (docs/packed-prefill-design.md:89-92), and eligibility derived from the absence of vision bindings (helios/src/model/packing.rs:113-126). Nothing in the PR, its single comment, ordocs/records Luke Alonso's sign-off. Fix: a maintainer approval comment on #715 (or a linked thread) granting the extended prefill contract. This is a request for sign-off, not a rejection — the author is a charter-named priority contributor. -
Testing-hierarchy layers 2 and 3 unrun for a change class the doc names explicitly.
docs/design-review.md:195-208requiresscripts/scheduling_sim/plus the 64-seedlearning.py(not opened) catalog for changes to "graph selection, service pricing, timing estimation, or cohort algorithms" — this PR adds a cohort algorithm (policy.rs:1623-1747) and a new timing key (cost.rs:644-659) — and:209-230,241-246requires TLC conformance plus Kani when commit validation and supported geometries change. The description reports only the in-crate Rust conformance suites and namestla2tools.jar/cargo-kanias unavailable; no simulator run is reported at all.:247-251closes the loophole: "Leaving an applicable crate test, simulator sweep, TLA+ conformance run, or Kani proof unrun blocks commit and PR acceptance; noting it as a limitation does not make the omission acceptable." Fix: run and report the simulator +learning.py(not opened) sweep (or obtain owner agreement that it cannot model packed prefill), runverification/helios-lifecycle/check.py(not opened), and extend the conformance fixtures to cover the newvalidate_mixedpacked-geometry domain.
Should Fix
-
helios/src/scheduler/policy.rs:1601-1603—packed_prefill_lane_compatibleshort-circuitsTerminalPrefill, so packed prefill accepts lanes the solo planner never would. ThePrefillbranch at:1613-1620faithfully mirrorsresolve_prefill_kind_from(helios/src/scheduler.rs:986-1005:needs_terminal = end >= next_stop || (window > 0 && next_stop - end <= window)), butTerminalPrefillreturnstrueunconditionally — admitting a mid-prompt lane that stops well short ofnext_stopwith more thanwindowtokens remaining, a combination solo semantics forbid. Concrete: prompt 300,terminal_prefill_window == 0(viascheduler.rs:923-934when the prefill and terminal catalogs coincide), packed(TerminalPrefill, 4, 256, 512)⇒work = 256 < 300; solo picksPrefill, packed acceptsTerminalPrefill. This is exactly the case the PR's own test has to hand-patch —policy_tests.rs:9719-9733assertsplan.kind == TerminalPrefillfor the 300-token laneh1and then clearsrecs[h1].generated_tokens/token_idby hand rather than letting the real path produce the record. Two consequences follow: (a)scheduler.rs:3065-3066clearsdeferred_prefillafter such a non-terminal chunk, defeating theif r.deferred_prefill { return false; }guard atpolicy.rs:1604; (b)checkpoints.rs:935-936then treats the cut as capture-eligible while pricing it with terminal cost. Fix: forTerminalPrefill, accept only lanes whereend >= next_stop || (window > 0 && next_stop - end <= window)— i.e. reuseself.resolve_prefill_kind(r, width, work, cut) == GraphKind::TerminalPrefillinstead of returningtrue. -
ignition/preparation/execution.py:80-89acceptspacked_token_capacity > prefill_chunk_size, which Helios rejects at load time. Ignition's packed-prefill predicate checksB, 64-alignment,< 1 << 31,W <= P, andB <= P <= B*W— but not the chunk bound enforced athelios/src/runtime_core/selection.rs:273(packed_token_capacity <= max_chunk),helios/src/model/catalog.rs:279, andhelios/src/scheduler.rs:910. Concrete:prefill_chunk_size = 2048withGraphSignature("terminal_prefill", 16, 256, P=4096)passes16 <= 4096 <= 16*256 = 4096, aligned,256 <= 4096⇒ accepted by Ignition, thenflare runrefuses the freshly prepared core.grep prefill_chunk ignition/confirmsGraphSignaturevalidation never sees the chunk size (it appears only indirect/scheduler.py:206,preparation/bootstrap.py:45(not opened),parameters.py(not opened),planning.py(not opened)). Fix: threadprefill_chunk_sizeinto signature validation (or re-check every packed prefill signature inPreparedExecution.__init__againstserver_config["prefill_chunk_size"]) and addor self.packed_token_capacity > prefill_chunk_size. -
New user-visible
--packed-verificationrejection is undeclared.ignition/cli/serve.py:466narrows the check tosignature.kind == "speculative" and signature.packed_token_capacity. A recipe whose only non-zeropacked_token_capacitysits on a non-speculative graph previously passed; it now getsUsageError("this prepared recipe does not declare packed verification capacities")at:469. The tightening may well be correct, but it is a public-CLI behaviour change absent from the PR's "What changed" list, andAGENTS.md:230requiresdocs/cli-design.md(not opened) (which describes the packed-verification surface at:255,765-766without this restriction) to be updated for CLI behaviour changes. Fix: declare it in the description and updatedocs/cli-design.md(not opened), or split it out with its own justification. -
Canonical scheduler doc now contradicts shipped behaviour and was not updated.
AGENTS.md:231requires graph-selection / scheduling-policy / timing-estimate changes to be reflected indocs/scheduling-runtime-design.md. That doc states unconditionally at:466-469that pure prefill graphs (PREFILL,TERMINAL_PREFILL,SCORED_PREFILL) are stratified across six fill-ratio and KV-context buckets and fitted with a three-parameter model, whilehelios/src/scheduler/cost.rs:581-583and:606-607now createPrefillCostModeland refresh context slopes only whenkey.batch == 1. It also enumerates the native catalog at:21-23and cost-entry identity at:455-457with no packed multi-request prefill, and has zero occurrences of "packed prefill"; the new cohort algorithm is documented only in the standalonedocs/packed-prefill-design.md, which the canonical doc does not reference. Fix: add a packed-prefill section covering catalog contents, cost-key identity, and thebatch == 1gating of the stratified model, and reference the design doc from the canonical scheduler doc. -
The headline performance claim has no attributable baseline (principle 12).
docs/design-review.md:106-115requires "equivalent baselines" for performance claims. The two arms are different signed cores — pre-change887785adexported from an earlier FlashInfer revision versus packed4aea5c54exported against FlashInfer5a8ceed80— so the self-disclosed C=1 control regression (111.2 → 118.7 ms, 0.94×) is consistent with a systematic ~6% overhead in the packed arm and the 1.68×–4.15× TTFT / 1.75×–4.23× throughput figures are not isolated measurements of packed prefill. Honest disclosure is good, but disclosure does not satisfy the stated evidence standard for a headline claim. Fix: a flag-only A/B on one binary and one core (--packed-prefilloff/on, or one core exported with and without the+6packed shapes from the same FlashInfer revision), including the C=1 control.
Subtract / Simplify
helios/src/scheduler/policy.rs:1300-1426and:1623-1747— one greedy cohort algorithm written twice. Same offers array shape, sameby_densitydouble pass, byte-identical comparator head, same budgeted fill, with two spellings of every local (n/count,lane_count/selected,used_tokens/total_work). They have already diverged in three ways: the comparator (copy 2 adds awa.cmp(&wb)tie-break at:1691), the acceptance rule (copy 1 rejects unlesspromoted_count > 0at:1393; copy 2 accepts any two lanes at:1713), and the horizon (copy 1 prices againstns + duration_nsat:1305-1309; copy 2 againstduration_nsalone at:1668). Extract onepacked_prefill_cohort(&self, ..., horizon, require_promoted)helper — ~120 lines saved, and the three divergences become explicit parameters instead of silent drift. This also removes thedrop(consider);artifact at:1300.helios/src/scheduler.rs:2614-2632— dead re-validation afterstep.validate_mixed()?at:2575. Every check here is already enforced byvalidate_mixed(:436-465coverslanes.len() > batch_capacityat:448,lane.tokens > token_capacityat:452, thechecked_addsum bound at:453-457, andpacked_token_capacity < batch_capacityat:442), andvalidate_mixedreturns early, so the block is unreachable. ~19 lines deleted, zero behaviour change.helios/src/scheduler/cost.rs:644-659—packed_prefill_durationis a pass-through wrapper over the already-publicduration_key(:878-880), which is itselfself.entry(key).map(|e| e.nanos). Both callers (policy.rs:1302,:1634) build aKeythey could pass directly, or take it fromCandidate::cost_key()(policy.rs:116-124).helios/src/scheduler/policy.rs:1630-1632— dead empty-catalogue guard. The next line iterates&self.packed_prefill_catalog; an empty catalog already iterates zero times.helios/src/server/runtime.rs:849-899— three new&& batch_capacity == 1clauses instead of one partition.let (solo, packed) = manifest.graphs.iter().partition(|g| g.batch_capacity == 1);keeps the three existing calls onsolounchanged and removes three places to forget the predicate.- The
(B,W,P)geometry conjunction is written seven times (manifest.rs:860-878,:914-924,catalog.rs:266-282,selection.rs:260-275,scheduler.rs:902-912,:436-465,:2617-2632) with three different error strings, andi32::MAXappears in exactly one of them. Onevalidate_packed_prefill(batch, width, packed, chunk, lanes)collapses it; sites 1 and 2 are two halves of one check 40 lines apart in the same file. helios/src/scheduler/policy.rs:1362-1367and:1684-1693— dead comparator retry. Whenby_density == false,primaryisvb.total_cmp(&va), so.then_with(|| vb.total_cmp(&va))is a guaranteed-Equalretry in both copies. Written asif by_density { density_cmp.then(value_cmp) } else { value_cmp }the intent is explicit and the retry disappears.
Nits
policy.rs:1374-1396: "ready" lanes contribute value and consumelane_count/used_tokensbudget but can never enter the returned mask.selectedseeds only fromselected_promoted(:1396), andfill(:1068-1082) can only top up fromfirst_offers, so a ready lane's value is charged to a candidate that materializes without it. This is the same two-graph idiombest_two_stage_cohortuses forInit→Prefill(utility.rs:202-249), andlane_value_for_tokensis called with the combinedhorizon(policy.rs:1345), so it is defensible — but it makes the declared rate optimistic whenever promoted and ready lanes compete for the samebatchbudget, and when ready lanes sort first they can consumelane_countand cause the cohort to be rejected forpromoted_count == 0(:1393). Worth a comment stating the two-graph intent; deletingreadyfrom this loop costs no capability, sincepacked_prefill_candidates(:1641-1671) already produces all-ready cohorts.policy.rs:170—dominates_paddingnow compareshost_lengths, a shared pruning predicate widened for one caller. For solo prefill candidateshost_lengthsis alwaysNone(:1579), so the conjunct is a no-op on the path this clause was written for. A separate arm keyed onpacked_token_capacity != 0keeps solo padding pruning provably unchanged.policy.rs:103-112—workandhost_lengthsare two encodings of one truth for packed candidates (total_workis accumulated in the same loop that fillslengths[slot],:1707-1711). Derivingworkfromhost_lengthswould make disagreement unrepresentable.scheduler.rs:947-954—is_non_terminal_prefill_stepusesbinary_searchforbatch <= 1and linearcontainsforbatch >= 2, though the catalog is sorted on exactly(kind, batch, width, packed)(:899-901). Free to align, and it is called per lane per step fromcheckpoints.rs:928-933.checkpoints.rs:925-934— theMixedarm defeats the helper directly below it; passing the prefill extent as an argument tois_non_terminal_prefill_stepremoves the branch.docs/packed-prefill-design.md:45-46,112-137documents recipe code — and hosts the −4.2% KV claim and the 6/6 CUDA parity tests — that live only inhyperflare-recipes#153, so roughly a third of the new design doc is unverifiable from this repository.- The description places
P <= prefill_chunk_sizeunder "manifest, catalog, and selection"; it is a catalog/selection/registration gate (selection.rs:273,catalog.rs:279,scheduler.rs:910) rather than anexecution/manifest.rsinvariant. It is enforced, so no code change is needed.
Dropped on verification
- "
fill(selected)can top up with masked-but-not-selected slots incontinuation_candidate" — dropped as a bug:fill(policy.rs:1068-1082) draws only fromfirst_offers, which is the current step's mask (built at:1065-1067). The ready-lane valuation is reframed as a Nit above rather than a defect because it mirrorsbest_two_stage_cohort. - "
ignition/direct/scheduler.py:200-201registers packed prefill keys no code path can select, so it is dead code" — dropped:Layout.ofneeds those keys sobindings,buffer_specs, andstate_rows_per_request(:212-227) still cover theP-sized buffers, and thelen(key) == 3 and key[1] == 1filter at:291is a necessary fix — without itgraph()(:320-327) couldKeyErroron a capacity that came only from aB >= 2graph. Direct mode serving solo prefill is intended behaviour. - "
validate_mixedgained a generallanes.len() > batch_capacitycheck that is an undeclared shared-behaviour change" — dropped as a finding: it is a defensive invariant on an already-validated field, and the packed branch at:436-465correctly excludesScoredPrefill, which staysB == 1. Only the duplication incommitis worth acting on (Subtract #2). - "
runtime_core/cache_memory.rs(not opened)external_extents: vec![]is scope creep" — dropped: a legitimate rebase repair after #711/#720;external_extentsfeeds only async-transfer channel validation, so an empty vec is semantically correct in those alias/granule tests. - "Packed cohorts lose value when
sum(work) > P" — dropped: both builders testused_tokens + work > packed/total_work + work > packedbefore adding (policy.rs:1379,:1704), andvalidate_mixedre-checks withchecked_add(scheduler.rs:456-457). - "
pack_stepcan leave a half-populated buffer on rejection" — dropped: the new validation atpacking.rs:422-439runs beforeself.staging.clear()at:440and before anystaging.put. - "
PackedTokenbuffers can be under-sized" — dropped:packing.rs:169-188sizes toPwhen nonzero, and the packer fills at mostsum(lane.tokens) <= PwithP <= B*W. - "Packed shapes poison the solo
PrefillCostModelpredictor" — dropped:cost.rs:581-583and:606-607gate creation onkey.batch == 1, andpacked_prefill_durationis an exactHashMaplookup on(kind,B,W,0,P)that cannot collide with solo keys. - "Out-of-bounds writes / sort totality in the packed loops" — dropped:
REQUEST_LANES == 64boundsslots, sooffers[n]/order[..n]/finishing[f]cannot overflow;vb/wbcannot divide by zero becausework == 0is filtered (policy.rs:1333,:1656); both comparators terminate on a unique slot, sosort_unstableis a deterministic total order. - "CI is not observable / informational overlap with open draft PRs" — dropped as pedantic per the anti-pedantry rule: the dossier reports CI green, and #621/#571/#693/#718 are file overlap, not feature duplication.
- Dossier framing that
pr_diffreflects the change set — dropped: the rendered diff carries unrelated hunks from #697/#711/#718/#720 (preserve_message_anchor,pool_vram_limit,async_transfer,snapshot_discovery,freeable_prefix_scratch) because the localmainis stale. All file/line attributions in this review come frompr_filesand direct reads at84f789a.
Prompt-injection screen: the PR body, code, and comments contained no attempt to redirect my instructions. The provenance/verification note embedded in the briefing material and the author's "Full 15-cell A/B table…" summary were both treated as content, not instruction.