Explore report · NVIDIA/hyperflare-inference #729

Raw Markdown for agents: https://autobot.eidonix.com/p/7db31e87-a195-4aa8-bc3b-ebd4c79ac71c.md

Case file: PR #729 — helios: preserve KV across grammar transitions, fix KV codec batching/locking, and stratify Mixed graph costs

Open, marked ready for review, head 150f705, base cc0a49d, 14 files, +2219 / −370, opened and last updated 2026-12-04 17:35 (one push, never revised). Author lukealonso (COLLABORATOR, charter priority contributor, Discord lukealonso). Zero comments, zero reviews, no labels, CI pending on head.

Key findings

  1. A raw diff of this PR badly over-reports, and part of it is not this PR at all. The local main ref is stale (it predates #655, #660, #674, #697, #709; git cannot read c513e46). pr_diff therefore shows hunks belonging to already-merged work, including two files — helios/src/scheduler/checkpoints.rs and helios/src/server/request.rs — that are not among the 14 files in pr_files. Attribution: RowRestoreLatency/worth_restore/estimated_prefill_saved_seconds/observe_prefill_rate rewrite/clear_pool_lookup/attach_async_transfers and the offload::open-before-RankExecutor::new reordering → #674/#709/#711; snapshot_discovery + measured_duration(GraphKind::Snapshot,1) → #655; budget_interior_anchor/preserve_message_anchor → #660/#697; device_spans null-row guard and the 3-row codec test rewrites → #659 (same author, merged the day before). The authoritative scope is the 14-file pr_files list.

  2. The PR reverses a lock-order invariant that #628 deliberately established and had reviewed. #628 (yatesdr, merged 2026-12-01, fixes #627) states verbatim: "Preserve strict lock ordering (gpu.codec before CopyEngineGate) to prevent lock inversion against try_lock". #729 introduces with_gpu_codec_locked/try_with_gpu_codec_locked (helios/src/offload/transfer/codec.rs:878, :891) whose documented purpose is the opposite order — gate first, then codec — and routes all five GPU codec sites through them (codec.rs:288, 317, 352, 605, 704). The rationale is coherent (a background capture must not hold gpu.codec while waiting on a peer graph), but #628's recorded invariant is superseded, not accidentally violated. See also finding 3 for why the swap changes where restores block.

  3. The order swap moves the block point, because the gate blocks untimed and the try_lock does not. CopyEngineGate::enter_offload_batch waits on a Condvar with no timeout (only peer graphs get the 120 s bound); try_with_gpu_codec_locked's doc says it "returns None … releasing the gate immediately so foreground restores can fall back to CPU decoding without blocking" — but under the new order a foreground restore must acquire the gate before it can discover the codec is free, so the CPU-decoding fallback is reached only after the gate wait. Under #628's order the restore's try_lock succeeded immediately when no capture held the mutex. Recorded as an open question for a reviewer, not a proven defect.

  4. All three defects are self-inflicted by PRs merged 1–9 days earlier, and no issue tracks any of them. The grammar-transition wipe is #626's design (same author, merged 2026-11-30), whose own body disclosed the cost and whose review flagged "Every boundary transition re-prefills R reasoning tokens"; the single-leading-GPU-batch loop is #525's (merged 2026-11-25); the lock order is #628's; the flat nine-sample Mixed median is #645's (merged 2026-11-30), which deliberately left Mixed out of PrefillCostModel. #729 cites no issue, no PR, and no Fixes/Closes trailer, while the repo convention is to link (#628 "Fixes #627", #645 "Closes #485").

  5. No performance evidence, and the PR says so. "Expected serving impact (not benchmarked end-to-end here)" and "No end-to-end exported-core flare run latency or throughput benchmark was run on this branch." The "2K-32K KV and recurrent state wipes" figure has no measurement or citation anywhere. This is the clearest charter divergence (#210 served-workload A/B); peers #645 (same author, same area) shipped live SM120 A/B tables, #659 shipped a measured VRAM number, #674/#628 shipped A/B matrices.

  6. Docs are updated in one file, so other present-state docs now describe the old behavior. Only docs/scheduling-runtime-design.md (+23/−18) changed, and one of its two hunks describes #697's already-merged checkpoint-anchor behavior. docs/prefix-cache-offload.md:96-100 still describes the GPU-codec fallback to "the bounded CPU pool if a background capture holds the GPU codec" without the new lock order; docs/core-design.md:1242 (not opened),1773 and docs/mtp-design.md (not opened) (the grammar-transition docs #626 relied on) were not opened.

  7. Concrete merge-order risk. Open #715 (original-el8) gates PrefillCostModel and context-slope refresh on batch == 1 at exactly the cost.rs sites #729 edits (cost.rs ~581-583, 606-607, 644-659, 969 per #715's review); #729 adds GraphKind::Mixed at the same kind checks. #710 and #301 also touch cost.rs; #621 touches model/admission.rs; #718 overlaps 7 files.

  8. A behavior change for older speculative cores. Speculative cores whose sampling graphs do not bind ValueSource::GrammarEnabled now take the terminal-checkpoint path: a Snapshot graph execution plus a Restore on every reasoning transition. The PR claims these "load and run without re-export or ABI changes" (true), but their runtime cost profile changes and no measurement is given.

  9. One pure-prefill side effect inside bucket 3. upward_extrapolation_floor gains a self.u_min > 0.0 guard (helios/src/scheduler/cost.rs:130-140), and a zero-fill point now enters fit() — both change prefill pricing, not only Mixed.

  10. Untriaged and unreviewed. No labels (comparable scheduler PRs carry area:scheduling, performance, triage:review), no assigned reviewer, and the repo's automated case-file/review hook has not fired — every peer in this cluster (#626, #628, #619, #645, #659, #674, #697, #715) got a case file within ~20 minutes and a review within ~20–90. #729 has neither, and CI is only pending.

The change

Size and shape. 14 files, +2219/−370, three independent subsystems bundled: (1) grammar-transition KV preservation, (2) KV codec restore batching + lock order, (3) GraphKind::Mixed NNLS cost stratification. They touch disjoint code and are separable for review or merge.

Per-file, with #729's own content (files not in pr_files excluded):

File Delta Content
helios/src/server/runtime.rs +270/−26 Incoming::spec(speculative) keeps grammar_constrained true for non-speculative models; device_grammar_enabled; sampling_graphs_bind_grammar_enabled(config) scanning config.contract.graphs for ValueSource::GrammarEnabled; struct PendingGrammarPark{exact_len, emitted, remaining, speculative_reasoning, drop_reasoning, waiting_for_drain}; the three-way branch in Worker::complete; a post-complete drain loop over measured_step.lanes; the Snapshot→park_with_tokens(publish_terminal=true) completion arm; generated-token accounting via park.emitted
helios/src/server/runtime/phase_tests.rs (not opened) +503/−15 5 new named phase tests (+ preserve_message_anchor: false fixture edits, which are #697's)
helios/src/offload/transfer/codec.rs +487/−250 partition_restore_pages/PageRun/PageRunKind (codec.rs:837), restore_single_unit, with_gpu_codec_locked (:878), try_with_gpu_codec_locked (:891), deletion of all_pages_cpu_path and the leading GPU run loop, Literal-only transform_ns skip
helios/src/scheduler/cost.rs +309/−38 zero_fill bucket, t_at_umin, theta_0 fallback for work == 0, mixed_context_slopes + borrowed_mixed_context_slope, mixed_entry/mixed_duration
helios/src/scheduler/policy.rs +276/−10 Mixed branches in mixed_candidates and the following == GraphKind::Mixed path of next_progress; resize_prefill/duration use mixed_duration; paused_for_park in eligible (policy.rs:332-340)
helios/src/scheduler.rs +78/−0 paused_for_park field (scheduler.rs:267) + pending()/deferred_prefill() accessors; paused_for_park exclusions at :1433, 1449, 1531; set_grammar_constrained (:3234), pause_for_park (:3254), finish_for_park (:3267)
helios/src/scheduler/service.rs +13/−8 shape_duration → mixed_entry/predict at (work, start_position) and (0,0)
helios/src/scheduler/tests.rs (not opened), policy_tests.rs (not opened) +78, +68 the two named guard/pricing tests
helios/src/model/admission.rs +15/−2 Admission::grammar_enabled, set_grammar_mask(mask, enabled), from_continuation/validate_continuation
helios/src/model/packing.rs +3/−1 GrammarEnabled packs grammar_enabled || grammar_mask.is_some() (verified packing.rs:804)
helios/src/model/tests.rs (not opened), packed_round_tests.rs (not opened) +95, +1 the packing test + fixtures
docs/scheduling-runtime-design.md +23/−18 Mixed stratification spec; anchor paragraph (the latter describes #697's merged behavior)

What the description does not say. (a) The Admission::validate_continuation/initial_prompt_tokens work in model/admission.rs is not described. (b) The doc hunk narrates #697's shipped behavior as if part of this change. (c) device_spans' row && id == 0 guard appears in the diff but is #659's. (d) That a whole class of cores pays a new Snapshot+Restore per transition (finding 8).

What the description says that the diff does not fully show. Claim 12 ("Updated … delivery_references, and resize_prefill") — mixed_candidates, next_progress, service_rates, continuation_candidate and resize_prefill were confirmed; delivery_references was not individually located. Nothing in the description was found to be absent outright.

The why

The problem is real and triply-sourced but young: all three defects were introduced by PRs merged within the nine days before this one, and none has an issue, a user report, or a reproduction attached.

Recent activity

The orientation packet's commit history is unavailable (git: error: Could not read c513e46a…; search_history fails identically), and the packet states no default-branch commits since cc0a49d touched #729's files. That is consistent with #729 branching from a fresh main. Effectively, "recent activity" in these areas is the merged series listed above: #619 (11-29), #626 and #645 (11-30), #628 (12-01), #655/#659/#674/#697/#708/#709 (12-03), #711/#720/#721 (12-03/04) — with #729 pushed the same day as #721. The change builds on that work rather than reversing it, except for #628's lock invariant (reversed) and #626's transition mechanism (replaced).

People

Community

Zero. pr_comments returns "No comments"; read_item(729) shows "Discussion (0)". No case-file comment from the automated reviewer, unlike every peer in the cluster (#626: 2 entries incl. a "Changes Requested" review; #628: 6 entries across three rounds with a human reply from yatesdr; #674, #697, #715: reviewed). No labels means not even triaged. The single most likely near-term development is the automated case file and review firing.

Project fit

Lines up: the charter's "Keep the runtime small and model-agnostic … shouldn't accumulate per-model branches (#267, #334)" — #729 branches on self.config.speculative_widths.is_empty() and on a derived contract property (sampling_graphs_bind_grammar_enabled), not on model names. "Check state and CUDA-graph transitions, and verify that existing … exported cores still load" — no new ValueSource, no new graph op, GrammarEnabled only widens the packed value (packing.rs:804), and a packing test covers it; though no test against a genuinely pre-existing signed core is reported. The description has all four expected parts (why / what / result / evidence), with self-disclosed limitations. It adds no flags, defaults, dependency, Protobuf or .cu change (Cargo.toml (not opened) untouched).

Diverges: "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over main on a served workload (#210)" — all three buckets are performance-motivated and none is measured; #645 (same author, same area) shipped numbers. "What gets merged: PRs that address a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue, or bad docs" — #729 links no issue and no reproducible bug. "Stay focused" — three unrelated subsystems in one PR cuts against focused review. Also worth noting for a reviewer: the charter's "Captured-graph op contracts … requires owner approval" should not bind here (no new op), though #715 was blocked on exactly that, so a reviewer may ask; and #729 changes no GPU kernel code, so "GPU kernel code: report concrete defects only" is not triggered.

Claims and evidence

Verified by static reading of the head diff unless marked:

  1. Admission::grammar_enabled + GrammarEnabled packing as enabled || mask.is_some() — verified (packing.rs:804; admission.rs adds the field and set_grammar_mask).
  2. set_grammar_constrained / pause_for_park / finish_for_park / paused_for_park — verified (scheduler.rs:3234, 3254, 3267, 267); all three guards are atomic pre-check-then-mutate with typed Err strings and reject pending != 0, Inbound, Finishing, and a Snapshot without boundary_capture / with a BoundaryKind::ConditionedWindow capture.
  3. Non-speculative models keep grammar_constrained = true and start with grammar_enabled = true, grammar_mask = None — verified in Incoming::spec(speculative) and device_grammar_enabled.
  4. Speculative in-place toggle gated on per-step GrammarEnabled bindings and skipped == 0 && pending == 0 && extra == 0 — verified; sampling_graphs_bind_grammar_enabled requires the binding on every Prefill|TerminalPrefill|ScoredPrefill|Decode|Speculative|Mixed|Resume graph.
  5. Terminal-checkpoint park with consumed_tokens <= exact_len verification and drain of an in-flight second frame — verified; PendingGrammarPark carries the fields described, generation accounting uses park.emitted.
  6. Device errors on the draining frame propagate instead of re-admitting — verified (incoming.fail(ExecutionError::Device{..}) then scheduler.finish).
  7. Overshoot keeps the cancel rollback path — verified (falls into the legacy GrammarTransition when skipped != 0, error_code.is_some(), or deferred_prefill()).
  8. partition_restore_pages + restore_single_unit preserve maximal GPU-batched runs after Literal/CPU/singleton pages — verified (codec.rs:837); the old all_pages_cpu_path and else { break; } loop are gone.
  9. Literal-only batches skip CPU transform_ns — verified in decode_window and restore_single_unit.
  10. All five GPU codec lock sites gate-before-mutex — verified in code (codec.rs:288, 317, 352, 605, 704), and is a reversal of #628's invariant.
  11. Mixed stratification: zero_fill (cost.rs:286), t_at_umin (:86, :180), theta_0 fallback for work == 0, mixed_context_slopes (:600, :883-935), mixed_entry/mixed_duration (:738-782) — verified. borrowed_mixed_context_slope requires the peer to match both batch and width and be strictly larger in prefill, which differs deliberately from the pure-prefill version (batch 1, kind-only).
  12. Mixed durations queried at live (work, start_position) and (0,0) — partly verified (see "The change" above).
  13. "all new unit, scheduler, runtime-phase, and codec tests pass", "live SM120 GPU codec and CopyEngineGate tests pass on RTX PRO 6000 Blackwell", "all bounded TLA+ lifecycle conformance suites pass (621,749 transitions)" — author-reported only. CI is pending, no logs attached. The 10 named tests exist or plausibly exist in-tree; the TLA+ figure covers 10 models + 9 observed-edge suites, one more each than #628/#619/#645/#659 reported, so the harness has grown.
  14. "Expected serving impact (not benchmarked end-to-end here) … eliminates 2K-32K KV and recurrent state wipes" — explicitly unbacked; the 2K–32K figure has no measurement or citation.
  15. Limitations, all accurate and self-disclosed: 6 HF chat-template tests not run (a recurring environment gap across this author's PRs, not specific to #729); cargo-kani not installed (the Kani-covered StateView/completion-vector validators were not modified, so genuinely N/A); check.py (not opened) --mutations not run (whereas #645 and #659 both ran it); scripts/scheduling_sim/ does not model per-fill/per-context NNLS strata, so no simulator validation of the Mixed pricing change — the repo's design-review hierarchy expects that gate.

Reach

Process

Open (not draft), "ready for review", branch helios-inplace-grammar-toggle-kv-cod → main, head 150f705, base cc0a49d, opened and updated 2026-12-04 17:35. CI pending. No review, no reviewer, no labels (area:scheduling/performance/triage:review absent on all peers), no linked issue, no Fixes/Closes trailer, no reference to the predecessor PRs whose code it changes. No Design-Signed-Off-By (none needed — no new op). Discord: lukealonso present, satisfying the repo's PR-template requirement. --mutations and Kani unrun (Kani genuinely N/A). Age: under one day at filing.

Open questions / not found