PR #723: helios,heliopause,ignition: fleet-wide 2-way codec green contexts, graph SM bounds, and ScratchArena reserve_sms floor

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/2f5dffa4-29f5-4936-8cbd-c19ec8f86e01

Opened by a workflow run, Dec 4, 2026 1:24 AM EST. decide malicious: all_clear (100%): No malicious content found

explore

Author: lukealonso (COLLABORATOR, one of the charter's three named priority contributors; Discord: lukealonso) Motivation: On GB300/SM103, running prefix-cache compression on the GPU collapsed decode from 67 tok/s to under 1 tok/s and hung, because GPU KV-codec kernels shared SMs with the cooperative compute graphs. The earlier fix only covered cores that declare a persistent worker; this PR extends the isolated, dedicated-SM codec partition to every other core, and adds per-graph SM/cluster bounds so undersized partitions are rejected at load time instead of failing at replay. Scale: +1438 / −285 lines in 27 files Proposal:

Full report · Notes

Classify intake

Selected: triage:review, bug, performance, enhancement, area:preparation

Threshold: 65%

Triage

Priority

Type

Area

Model

Value Proposition

Wrote a charter-grounded Value Proposition report for NVIDIA/hyperflare-inference#723, ending in the verdict Worth it with changes.

Summary of the judgement:

  1. Charter alignment — The core change (2-way (codec, compute) Green Context splits for standard cores) is a legitimate residual of open priority:P1 bug #701, which merged #709 fixed only for persistent-worker cores. Enablement is gated on options.prefix_cache.compression == KvCompression::Gpu, not on model names, so it honours "keep the runtime small and model-agnostic". No non-goal is engaged. Misaligned portion: the Python ScratchArena reserve_sms floor is a new, self-initiated contract with no issue and no in-repo consumer (symbols only in scratch.py:59-187 and its test), which cannot deliver its advertised prep-time ValueError until out-of-repo hyperflare-recipes#157 lands — the "split bundled changes" objection yatesdr raised on #430.
  2. Novelty & status — Genuinely additive, neither obsolete nor superseded: #709 explicitly scoped itself to persistent-worker cores, #698 covers a different deadlock, #314 is only textual overlap.
  3. Value vs cost — Real beneficiaries (all ranks with GPU KV compression) at ~8 SMs withheld (~4.3% of an SM120 card), but evidence is component-level #[ignore]d tests on one SM120 host while the motivating bug is SM103-only, with an unreconciled 2-way-vs-3-way throughput comparison. Key risks cited: silent no-op if the b12x pin predates track_capture_min_compute_sms (ImportError → floor 0); stale docs/runtime-core-design.md:654-696; unapproved graph-contract field additions with new load-time rejections; backward compatibility asserted but no old-core fixture; unmentioned interaction with open #640 (asymmetric compute_sm_count across ranks); undocumented reversal of #532's split_sm_groups recommendation.

Conditions attached to the verdict: verify/pin the flashinfer#217 API and fail loudly instead of silently emitting 0; update the design doc; drop or split the ScratchArena contract; get contract-owner sign-off plus an old-core load fixture and an SM103 or end-to-end run; state the #640 interaction.

Note: the PR text, dossier and diff material contained no instructions directed at me; nothing was followed from them.

Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.

Apply Labels (Intake)

Applied: +triage:review, +bug, +performance, +enhancement, +area:preparation

Subtraction and simplicity

Subtraction & Simplicity audit — PR #723

Verdict: not lean. The 2-way/3-way generalization is real work and mostly earns its lines, but the PR adds three separate surfaces of speculative generality, and the smallest one (the Python ScratchArena contract, ignition/preparation/scratch.py:59-188) can shrink from ~77 added lines to ~25 with identical behaviour and identical tests. Concretely: one public kwarg that is validated then silently discarded, one public kwarg+dict that is provably a no-op, and one validation rule implemented five times.

Scope note: the pr_diff base is stale and shows hunks that are not this PR (host_vmm, prepare_async_transfers, map_device_pool, validate_external_extents, external_extents, CacheAgreement::device_pools, validate_async_transfer_peer_copy_compatibility, heliopause/src/export/capture.rs:2940-3019). That is merged AsyncTransfer work (#711) bleeding in. All citations below are reconciled against pr_files and exist only in the #723 delta.


A. ScratchArena: three of the five new entry points / fields are dead or contradictory (highest value)

A1 — resolve_reserve_sms(..., plan=...): the plan= argument is provably a no-op. Delete the kwarg and the _parallel_reserve_sms dict.

ignition/preparation/scratch.py:137-146:

def resolve_reserve_sms(self, requested: int = 0, *, plan=None) -> int:
    ...
    floor = self.reserve_sms_floor
    if plan is not None:
        floor = max(floor, self._parallel_reserve_sms.get(id(plan), 0))
    return max(requested, floor)

reserve_sms_floor (:113-118) is max(self._min_reserve_sms, self._max_parallel_reserve_sms), and _parallel_reserve_sms[key] is only ever assigned max(..., reserve_sms) where _max_parallel_reserve_sms = max(self._max_parallel_reserve_sms, reserve_sms) (:184-187). Therefore every per-plan value is <= _max_parallel_reserve_sms <= floor, so max(floor, per_plan) == floor always. The body is exactly return max(requested, self.reserve_sms_floor); _parallel_reserve_sms has no other reader. The test that appears to cover it (tests/preparation/test_scratch.py:559, assert arena.resolve_reserve_sms(0, plan=plan_a) == 4) cannot distinguish the branch, because register_parallel(plan_a, plan_b, reserve_sms=4) at :556 already raised the arena-wide max to 4.

A2 — min_reserve_sms= takes a value, validates it, then discards it when overlap=False. scratch.py:59-63 accepts and range-checks it; :114-117 returns 0 unconditionally when !self.overlap. tests/preparation/test_scratch.py:588-589 codifies the contradiction:

serial = ScratchArena("cpu", overlap=False, min_reserve_sms=4)
assert serial.reserve_sms_floor == 0

A knob that is accepted and thrown away is worse than no knob. Either drop the constructor parameter entirely (require_reserve_sms already covers the use case and raises "stream overlap is disabled" consistently, :126-127), or reject min_reserve_sms > 0 with overlap=False at construction like every other invariant in this class does.

A3 — the bidirectional rule is inconsistent, which is a symptom of the two-dict design. register_cooperative_plan checks max(self._min_reserve_sms, self._parallel_reserve_sms.get(key, 0)) (:158) — i.e. per-plan plus _min_reserve_sms, but not _max_parallel_reserve_sms. So a plan registered after an unrelated sibling's reserve_sms=4 parallel group is accepted at reserve_sms=1, while reserve_sms_floor is 4 and the plan's own effective floor is 4. register_parallel has the mirror-image asymmetry (:176-187: it checks only _cooperative_plans, then writes per-plan and global max). Collapsing to one scalar _reserve_sms_floor plus one set of declared counts makes the rule a single comparison and removes the inconsistency rather than documenting it.

A4 — one 2-line validation copied five times. Identical type(...) is not int or < 0 → ValueError("... must be a nonnegative integer") at scratch.py:62-63, :122-123, :139-140, :150-151, :174-175. One helper (def _reserve_sms(value, name="reserve_sms")) removes four copies. Note the loop at tests/preparation/test_scratch.py:597-607 exercises exactly these five sites, so behaviour is preserved by construction.

A5 — if plan is None: return (scratch.py:152-153) is a silently-accepting branch in an API whose entire purpose is to fail closed, and it has no caller at all (see A6). Registration of None should raise, or the guard should go.

A6 — no in-repo consumer exists. register_cooperative_plan|require_reserve_sms|resolve_reserve_sms|reserve_sms_floor|min_reserve_sms appear only in ignition/preparation/scratch.py and tests/preparation/test_scratch.py (+62 lines). Combined with the repo docs still describing the old contract (docs/core-design.md:821 (not opened) "register_parallel(*plans) declares preparation workspaces that must coexist."; docs/preparation-development.md:256 (not opened), not updated), the whole surface is a public API committed before its first caller. Shipping A1/A2/A5 cuts, the single scalar floor, and one validation helper lands the same fail-closed semantics for recipes#157 with roughly a third of the code, and removes two of the four new public names.


B. plan_sm_split / create: Option<u32> + bool encodes a third, invalid state — use an enum

helios/src/runtime_core/persistent_worker.rs:85-91 and :247-254 both take (Option<u32>, bool, u32, u32); five positional parameters, and (None, false), (Some(0), true), (Some(0), false) are illegal. That forces:

A PartitionRequest (enum { Worker(u32), Codec, WorkerAndCodec(u32) }) makes all three illegal states unrepresentable, deletes the two Err arms and the unreachable!(), and lets requested_worker_sms/reserve_codec_partition — which are threaded separately through initialize_with_options → prepare_kernels → create (mod.rs:340-346, :776, :809-816) — collapse to a single argument on that 3-hop plumbing path. This is the textbook case in the brief for pairing options into one value.

C. The cluster-dimension decode is written twice, with a magic 4 on one side only

Export (heliopause/src/export/capture.rs:463-486) has a named constant and a helper:

const CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION: i32 = 4;
fn kernel_cluster_size(kernel: &wire::Kernel) -> ExportResult<u32> { ... }

Load (helios/src/runtime_core/mod.rs:1067-1078) re-implements the identical parse with a bare literal:

if attribute.id == 4 {
    let cx = u32::from_ne_bytes(bytes[0..4].try_into().unwrap());
    ...
    .ok_or_else(|| { invalid("kernel cluster dimension overflows u32") })?;

Same attribute id, same three-u32 layout, same max(1) product, same overflow message, on either side of a wire boundary that now carries max_cluster_size precisely so the loader does not have to re-derive it. Move the decode to one shared location (it already has a natural home next to the wire::Attribute type) and both sides call it. As written, a change to the attribute encoding must be made in two languages' worth of three places.

D. max_cluster_size was just recorded on the wire, yet the loader re-derives it — and the derived check is legacy-only

mod.rs:1079-1086 fails a graph whose decoded cluster_size > avail_sms. But graph_sm_requirements (capture.rs:491-500) guarantees min_compute_sms = declared.max(max_cluster_size), and mod.rs:964-980 already fails when graph.min_compute_sms > avail_sms. So for any core exported by this PR's own exporter, cluster_size > avail_sms ⇒ max_cluster_size > avail_sms ⇒ min_compute_sms > avail_sms, and the earlier check fires first: the per-node branch is only reachable for legacy cores with min_compute_sms == 0. That belongs in a comment at minimum, and more usefully the SM comparison should be done once against graph.max_cluster_size (one field read, one message), with only the genuine co-scheduled-alignment check (:1087-1094) kept per-attribute. Roughly 30 lines and a second overflow path become one field comparison. Note the coupling min_compute_sms >= max_cluster_size is itself undocumented in the description and unstated in the proto comment (helios/proto/core.proto:251-254 (not opened)).

E. Two adjacent folds that should be one, and one error suffix repeated four times

mod.rs:795-808 walks core.graphs twice, identically bar the field:

let min_compute_sms = core.graphs.iter().filter(...).map(|g| g.min_compute_sms).max().unwrap_or(0);
let max_cluster_size = core.graphs.iter().filter(...).map(|g| g.max_cluster_size).max().unwrap_or(0);

One fold((0, 0), |(a, b), g| (a.max(g.min_compute_sms), b.max(g.max_cluster_size))), or a Core::graph_sm_requirements() returning the pair — mirroring the identically-named export-side helper, which also returns (u32, u32).

The actionable hint "; use --lossless-kv-compression cpu" is written out at four code sites — mod.rs:394, mod.rs:972, persistent_worker.rs:348, :480, :259 — embedded inside five separately formed format! messages, then substring-matched in three tests (persistent_worker.rs:1251, :1283, :3569). One const CPU_CODEC_HINT: &str makes the hint consistent and the tests reference the constant instead of a copied literal.

F. Python: min_compute_sms is stored on graphs through two channels; one is unused in production

ignition/preparation/runtime_core.py:184-188 adds a min_compute_sms=0 constructor parameter to RecordedExportGraph, and :299-301 adds a fallback:

raw_min_sms = getattr(graph, "_flare_min_compute_sms", None)
if raw_min_sms is None and isinstance(graph, RecordedExportGraph):
    raw_min_sms = graph.min_compute_sms

But the only producer, ignition/preparation/capture.py:237-245, sets the attribute on the value returned by record_export_graph — which is the RecordedExportGraph itself — so the constructor parameter is never populated by production code; its only users are tests/preparation/test_capture_graph_metadata.py:637,641. Drop the parameter and the isinstance branch: the attribute is the single storage location, and _graphs keeps its None → 0 default. Relatedly, the if min_compute_sms > 0: guard at capture.py:244 exists only so test_capture_graph_metadata.py:626 can assert not hasattr(..., "_flare_min_compute_sms"); assigning unconditionally and defaulting in _graphs is equivalent.

G. Minor: six locals copied out of SmSplitPlan to be shadowed immediately

persistent_worker.rs:295-301:

let baseline_coscheduled = plan.baseline_coscheduled;
let required_compute_coscheduled = plan.min_compute_coscheduled;
let required_min_compute_sms = plan.min_compute_sms;
let worker_index = plan.worker_index;
let codec_index = plan.codec_index;
let compute_index = plan.compute_index;
let group_count = plan.primary.len();

A single destructuring let SmSplitPlan { primary, fallback, worker_index, codec_index, compute_index, baseline_coscheduled, min_compute_coscheduled: required_compute_coscheduled, min_compute_sms: required_min_compute_sms } = plan; does the same in one statement and prevents the two names (min_compute_coscheduled vs baseline_coscheduled) from being confused — note they are nested (required_compute_coscheduled >= coscheduled), which the current names do not convey.


What is already lean (do not cut)

One process point that is a subtraction in itself

The Python ScratchArena contract has no in-repo caller and no corresponding issue; it rides with a CUDA change and forces its own 62 test lines. Splitting it out (the split yatesdr asked for on #430) removes ~139 lines from a PR whose load-time failure semantics are the part that needs scrutiny, and lets the only reviewable claim — "--lossless-kv-compression gpu no longer contends on non-worker cores" — stand alone.

Full report

Gates and contracts

Contracts, Charter & Verification Gates audit — PR #723 (275b7a5)

Verdict: one Major gate violation (unpinned external API that the headline gate depends on), plus a stale normative-doc contract and two verification-evidence gaps. Nothing else in the four gates is violated. I read AGENTS.md, docs/design-review.md, docs/verification.md, AGENTS.md#model-core-compatibility, docs/runtime-core-design.md, docs/core-format-design.md, docs/core-design.md, docs/preparation-development.md, verification/helios-lifecycle/README.md, pr_files, pr_comments, and the real per-file deltas.

Scope correction first, because it changes the gate analysis: pr_diff is contaminated by stale-base drift. It attributes AsyncTransfer/ExternalExtentTable, Capacity::DEVICE_POOL, EngramTable.Encoding.BF16, and EngramHash.Method.IDENTITY to this PR; pr_files shows helios/proto/core.proto is +4/−0 and runtime_core.proto +4/−0, i.e. exactly two fields and two comments. This PR adds no new wire enum, graph kind, or op family — the only contract addition is uint32 min_compute_sms = 7 / uint32 max_cluster_size = 8 on Graph (helios/proto/core.proto:248-254) and GraphIndex (helios/proto/runtime_core.proto:747-753), both documented 0 = unspecified. All other hunks in pr_diff belong to already-merged #711/#658/#708.

Gate 1 — Signed core-format / wire / captured-graph contract boundaries

Gate 2 — Vendored upstream dependencies and unmerged external dependencies

Gate 3 — Mandatory verification evidence

Gate 4 — Material scope / claim contradictions

Explicitly not flagged (anti-pedantry)

Stale-base pr_diff inflation for #711/#658/#708 content; no CI check-runs visible; docs/TODO.txt bookkeeping; the hardcoded CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION: i32 = 4 next to an existing raw-id KERNEL_ATTRIBUTES list (capture.rs:462-463); missing Discord: line (present); four-part description order (compliant); the #532 split_sm_groups-deletion recommendation (a design opinion, not a recorded invariant); and the open-#640 asymmetric compute_sm_count interaction (correctness/concurrency lens, and no textual conflict).

Bottom line: fix the b12x pin (or make the missing tracker fail loudly) — otherwise the shipped min_compute_sms/max_cluster_size enforcement is dead code and a new test cannot pass on the pinned dependency; update docs/runtime-core-design.md:654-696 (plus the Graph row in docs/core-format-design.md:222); add an old-core load/serve check per AGENTS.md:435-448; and split or drop the ScratchArena contract until it has a consumer. No vendored-file fork, no unapproved op-family addition, and no other hard contract or verification gate is violated.

Full report · Notes

Code correctness

Deep Code Correctness / Invariants / Hot-Path Audit — PR #723 @ 275b7a5

Large multi-crate PR (27 files, ~1.3k changed lines across helios, heliopause, ignition), so it was partitioned into 3 concurrent crate slices (spawn_agent s1 helios runtime_core, s2 heliopause+helios-core manifest fields, s3 ignition Python). I then re-read every cited site myself at the PR head and dropped two sub-agent findings that did not survive verification (see "Rejected" at the end). Only the findings below are directly proved from the code.


F1 — MAJOR: compute_coscheduled_alignment is fabricated with .max(), making the alignment re-check dead and feeding a fabricated ceiling into load-time cluster validation

Sites (all re-read by me): assignment helios/src/runtime_core/persistent_worker.rs:455-457; dead guard :490-496; plan-side producer :186-200; consumer helios/src/runtime_core/mod.rs:958 and the cluster check mod.rs:1087-1094.

// helios/src/runtime_core/persistent_worker.rs:454-457
partition.compute_sm_count = actual_compute_sm.sm_count;
partition.compute_coscheduled_alignment = actual_compute_sm
    .sm_coscheduled_alignment
    .max(group_params[compute_index].coscheduled_sm_count);
...
// :490-496
if actual_compute_sm.sm_coscheduled_alignment < baseline_coscheduled
    || partition.compute_coscheduled_alignment < required_compute_coscheduled
{
    return Err(invalid(
        "compute green context partition lost required co-scheduled SM alignment",
    ));
}

Callee/semantics resolution. group_params[compute_index].coscheduled_sm_count is set to either required_compute_coscheduled (:189) or PREFERRED_COMPUTE_COSCHEDULED_SMS = 16, and the latter branch is only taken when required_compute_coscheduled < PREFERRED_COMPUTE_COSCHEDULED_SMS (:196). So group_params[compute].coscheduled_sm_count >= required_compute_coscheduled always, and .max() guarantees partition.compute_coscheduled_alignment >= required_compute_coscheduled. The second half of the || is therefore true by construction and can never fire: this is precisely the "always-true guard half" case.

Counterexample (SM120-class, 188 SMs, min_sm_partition_size=8, sm_coscheduled_alignment=8). A core declares one graph with max_cluster_size=16 ⇒ required_compute_coscheduled=16 (:108-114), the preferred-16 branch is skipped (16 < 16 is false) so fallback = None. Suppose cuDevSmResourceSplit downgrades the 16-CTA request to an 8-SM-aligned compute resource instead of failing (the exact case the error text "lost required co-scheduled SM alignment" exists for):

// helios/src/runtime_core/mod.rs:1087-1094
if let Some(alignment) = compute_coscheduled
    && cluster_size > alignment
{
    return Err(invalid(format!(
        "graph {} kernel cluster size {cluster_size} exceeds compute partition co-scheduled alignment {alignment}",
        graph.name
    )));
}

So a 16-CTA cluster node passes load-time validation on a partition whose real alignment is 8 — the PR's stated invariant ("no fallback below max_cluster_size") is silently defeated, and the diagnostic printed by the new SM120 tests (:3037-3040, :3592-3595) cannot distinguish requested from actual alignment.

Fix: stop laundering the value; check the driver's real output once.

partition.compute_coscheduled_alignment = actual_compute_sm.sm_coscheduled_alignment;
if actual_compute_sm.sm_coscheduled_alignment < required_compute_coscheduled {
    return Err(invalid(format!(
        "compute green context partition returned co-scheduled alignment {}, below required {}",
        actual_compute_sm.sm_coscheduled_alignment, required_compute_coscheduled)));
}

(baseline_coscheduled <= required_compute_coscheduled, so a single comparison suffices.) Note the create-time check at :359-369 is not dead — it compares group_params[...].coscheduled_sm_count with required_compute_coscheduled, i.e. the plan with itself — so this :490 guard is the only place a downgrade could have been caught.


F2 — MINOR: heliopause fabricates min_compute_sms >= 1 (and max_cluster_size >= 1) for every exported graph, destroying the documented 0 = unspecified sentinel

Sites: heliopause/src/export/capture.rs:465-500, write site :3438-3448, contract helios/proto/runtime_core.proto:750-753 (+ helios/proto/core.proto same shape), test pinning it heliopause/src/export/capture.rs (assert_eq!(graph_sm_requirements(&nodes[..1], 0)?, (1, 1));).

// heliopause/src/export/capture.rs:465-472
fn kernel_cluster_size(kernel: &wire::Kernel) -> ExportResult<u32> {
    let Some(attribute) = kernel
        .attributes
        .iter()
        .find(|attr| attr.id == CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION)
    else {
        return Ok(1);            // <-- "no cluster declared" reported as size 1
    };
...
// :491-499
fn graph_sm_requirements(nodes: &[wire::Node], declared_min_compute_sms: u32) -> ExportResult<(u32, u32)> {
    let mut max_cluster_size = 0u32;
    for node in nodes {
        if let Some(wire::node::Operation::Kernel(kernel)) = &node.operation {
            max_cluster_size = max_cluster_size.max(kernel_cluster_size(kernel)?);
        }
    }
    let min_compute_sms = declared_min_compute_sms.max(max_cluster_size);
    Ok((min_compute_sms, max_cluster_size))
}
// helios/proto/runtime_core.proto:750-753
// Minimum compute SMs required for resident execution of this graph; 0 means unspecified.
uint32 min_compute_sms = 7;
// Maximum CTA cluster size declared by kernel nodes in this graph; 0 means unspecified.
uint32 max_cluster_size = 8;

Counterexample. A plain Qwen3.8 decode graph with N unclustered kernels and no b12x floor: every kernel_cluster_size returns Ok(1) (node-type filter is correct; record_kernel at :580-607 only stores attributes whose 8-word value is non-zero, so the x==0&&y==0&&z==0 and < 12 branches are unreachable) ⇒ max_cluster_size = 1 ⇒ min_compute_sms = max(0,1) = 1. Every graph of every newly exported core now serialises (1, 1), so a reader can never distinguish "no floor declared" from a real 1-SM floor, and a genuine 1-SM floor from a 16-CTA cluster's implicit 16-SM floor. The second half of the defect is the .max(max_cluster_size) fold: the two bounds are consumed independently downstream (persistent_worker.rs:108-114 derives required_compute_coscheduled from max_cluster_size; :134-136 derives required_compute_sms from min_compute_sms), so folding cluster size into the SM floor double-counts it and makes "floor > cluster" inexpressible.

Behaviourally this is currently benign (the floor only ever raises required_compute_sms toward min_partition), hence Minor — but it permanently voids a documented forward-compatibility contract for all future cores and the new unit test locks the wrong behaviour in.

Fix: return 0 (not 1) when attribute 4 is absent, and drop the fold: let min_compute_sms = declared_min_compute_sms;. Update the test to (0,0) / (128,0).


F3 — MINOR: register_cooperative_plan aggregates a floor with min(), so a re-registration silently weakens the recorded requirement

Sites: ignition/preparation/scratch.py:163-164, guard :157-162; correct-direction siblings for comparison :135 (max) and :186-187 (max).

# ignition/preparation/scratch.py:156-164
        key = id(plan)
        if self.overlap:
            required = max(self._min_reserve_sms, self._parallel_reserve_sms.get(key, 0))
            if reserve_sms < required:
                raise ValueError(
                    f"cooperative plan requires reserve_sms >= {required} for active overlap, got {reserve_sms}"
                )
        prev = self._cooperative_plans.get(key)
        self._cooperative_plans[key] = reserve_sms if prev is None else min(prev, reserve_sms)

required never includes prev, so a lowering re-registration always passes the guard, and min is the wrong aggregate for a floor invariant (a reservation floor must be monotone: max).

Counterexample (runs against the head implementation):

arena = ScratchArena("cpu")
arena.register_cooperative_plan(p, reserve_sms=8)   # records 8  (required = max(0,0) = 0)
arena.register_cooperative_plan(p, reserve_sms=4)   # required = 0 → records min(8,4) = 4
arena.register_parallel(p, q, reserve_sms=6)        # :178-183 sees declared=4 < 6 → ValueError

The caller's strongest statement (8) is discarded, and a correctly annotated 6-SM overlap is rejected. Fail-closed, hence Minor, but it is the only place in the new contract where the aggregation direction is inverted. Note the min(prev, ...) branch is never exercised by tests/preparation/test_scratch.py:548-584, so no test catches it.

Fix: self._cooperative_plans[key] = max(prev or 0, reserve_sms).


F4 — MINOR: release_preparation() clears the plan maps but leaves a stale reserve_sms_floor

Site: ignition/preparation/scratch.py:228-235; reader :113-118.

# ignition/preparation/scratch.py:231-235
        self.tensor = torch.empty(0, dtype=torch.uint8, device=self.device)
        self._parallel_plans.clear()
        self._parallel_reserve_sms.clear()
        self._cooperative_plans.clear()
        self._released = True

self._min_reserve_sms and self._max_parallel_reserve_sms are not reset, so after release the property still reports a floor derived from dicts that are now empty:

arena = ScratchArena("cpu", min_reserve_sms=4)
arena.register_parallel(a, b, reserve_sms=8); arena.freeze(); arena.finalize()
arena.release_preparation()
arena._parallel_reserve_sms   # {}
arena.reserve_sms_floor       # 8  <-- stale, contradicts the cleared state

Even the arena's own ctor argument (min_reserve_sms=4) survives release, so a half-reset arena reports a reservation that nothing declares. Idempotency itself is safe (if self._released: return, :224-225). Fix: reset both aggregates to 0 (or route reserve_sms_floor through _require_active()).


F5 — MINOR: resolve_reserve_sms never reads the cooperative declarations, so the cooperative direction is write-only

Sites: ignition/preparation/scratch.py:137-146; reserve_sms_floor :113-118; writer :148-164.

# ignition/preparation/scratch.py:143-146
        floor = self.reserve_sms_floor
        if plan is not None:
            floor = max(floor, self._parallel_reserve_sms.get(id(plan), 0))
        return max(requested, floor)

reserve_sms_floor is max(self._min_reserve_sms, self._max_parallel_reserve_sms); _cooperative_plans is never consulted. A plan that declared reserve_sms=8 therefore resolves to 0:

arena = ScratchArena("cpu")
arena.register_cooperative_plan(moe_plan, reserve_sms=8)
arena.reserve_sms_floor                       # 0
arena.resolve_reserve_sms(0, plan=moe_plan)   # 0, not 8

This is arguably consistent with the docstring ("at least requested and any active overlap SM floor"), and there is no production caller in this repo (grep for resolve_reserve_sms|register_cooperative_plan|require_reserve_sms hits only scratch.py and tests/preparation/test_scratch.py), which is why this is Minor rather than Major. But if the companion recipes PR (#157) uses resolve_reserve_sms to size its own cooperative launch, it will launch under-reserved — the exact failure the PR claims to make impossible. Fix: fold self._cooperative_plans.get(id(plan), 0) into floor before the final max, or reject a plan= that is registered cooperatively unless its own declaration is returned.


F6 — MINOR: the payload-format single-rank loader hardcodes reserve_codec_partition = false, so GPU codec isolation (and the new min_compute_sms/max_cluster_size enforcement) is skipped on that path

Sites (self-verified): helios/src/runtime_core/mod.rs:335 (prepare_kernels(..., false) — the PR added this explicit false), mod.rs:342-344 (initialize → initialize_with_options(.., false)), callers mod.rs:218, mod.rs:241, helios/src/runtime_core/protection.rs:2836 (PayloadAuthorizedCore::load).

// helios/src/runtime_core/mod.rs:330-336
        let mut owner = unsafe { Self::initialize(&core, ordinal)? };
        unsafe {
            owner.reserve(&core)?;
            owner.allocate(&core, &phase)?;
            owner.load_payload(files, &core, &phase, 1)?;
            owner.prepare_kernels(files, &core, &phase, None, false)?;
            owner.prepare_graphs(files, &core, &phase)?;
        }
// :342-344
    unsafe fn initialize(core: &Core, ordinal: i32) -> Result<Self> {
        unsafe { Self::initialize_with_options(core, ordinal, false) }
    }

Trace. For a codec-enabled, non-worker core (DeepSeek-V4.1/GLM-5.3/Qwen3.8/Ergo/Gemma) loaded through NativeResources::load/load_any/PayloadAuthorizedCore::load, initialize_with_options(.., false) takes primary_context = wants_worker.is_some() || false (:386) ⇒ false, and prepare_kernels takes the partition branch only under worker.is_some() || reserve_codec_partition (:793) ⇒ green_partition stays None. Then every graph is instantiated on self.context (:962), offload_context() falls back to self.context (:1511-1516), and neither min_compute_sms (:964-980) nor the cluster check (:1067-1096) is ever applied — silently, with no diagnostic.

Reachability caveat (verified, so this stays Minor): the main serving path is correct — helios/src/runtime_core/model.rs:718-733 computes reserve_codec_partition = options.prefix_cache.enabled() && compression == KvCompression::Gpu and passes it to initialize_with_options + prepare_kernels (model.rs:859-867); NativeModel::load_agreeing routes payload cores to that path (model.rs:339+). No in-repo production caller of the load_prepared/load_any path exists (only helios/src/runtime_core/event_tests.rs:19 (not opened) and in-module tests). Fix: thread the flag (or a LoadOptions/KvCompression argument) through load_prepared/initialize/PayloadAuthorizedCore::load, or fail closed when the core needs codec SMs but the flag is absent.


F7 — MINOR: cuDevResourceGenerateDesc handles leak on every partial-failure path in create()

Sites: helios/src/runtime_core/persistent_worker.rs:370-392 (three descs; the worker/codec if wrapping and codec_desc are new in this PR), cleanup :545-552, destroy_streams :556-568, destroy_green_contexts :570-595 — none of which release worker_desc/codec_desc/compute_desc.

// helios/src/runtime_core/persistent_worker.rs:545-552
        if let Err(error) = setup {
            // SAFETY: No work was launched on these newly created streams or contexts.
            unsafe {
                partition.destroy_streams(driver);
                partition.destroy_green_contexts(driver);
            }
            return Err(error);
        }

Trace: 3-way plan; cuDevResourceGenerateDesc(worker) and (codec) succeed, cuGreenCtxCreate(compute) (:415) returns CUDA_ERROR_NOT_SUPPORTED ⇒ green contexts/streams are destroyed but all three descs are dropped with the stack frame. Same after codec_split.sm_count < group_params[idx].sm_count (:344-357). Up to 3 leaked desc resources per failed rank per attempt; bounded and freed at context destroy, hence Minor. (The pre-PR code had the same gap for 2 descs; the PR adds a third handle and three more failure points.) Fix: store the descs in GreenContextPartition and destroy them in destroy_green_contexts, or wrap each in a Drop guard.


F8 — MINOR: a nonzero min_reserve_sms is accepted and then silently ignored when overlap=False

ignition/preparation/scratch.py:59-63 accepts min_reserve_sms=4 with overlap=False; reserve_sms_floor then returns 0 (:116-117) and resolve_reserve_sms returns the bare requested (:141-142) with no diagnostic — asymmetric with require_reserve_sms, which does raise in serial mode (:126-127). The new test encodes this as intended (tests/preparation/test_scratch.py:588-590), so it is a contract wart rather than a crash. Fix: reject a nonzero min_reserve_sms when overlap is false in __init__.


Verified correct (checked, not assumed — no finding)

Rejected after verification (sub-agent findings that do not hold)

No prompt-injection content was found in the PR body, comments, or changed code; nothing in the reviewed material attempted to direct my actions.

Full report

Final review

Recommendation: Changes Requested

The core of this PR — a fleet-wide 2-way (codec, compute) Green Context split for non-worker cores, gated on options.prefix_cache.compression == KvCompression::Gpu (helios/src/runtime_core/model.rs:718-733) rather than on model identity — is at the right layer, is model-agnostic, and is a defensible residual of priority:P1 #701. The manifest field additions are additive and plumbed end to end, and the load-time SM/cluster validation is genuinely fail-closed. But one verified code defect defeats the PR's own headline invariant: compute_coscheduled_alignment is laundered through .max(...) (persistent_worker.rs:455-457), which makes half of the guard at :490-496 unsatisfiable and feeds a fabricated alignment into the per-node cluster check at mod.rs:1087-1094, so a driver-downgraded partition is accepted with a 16-CTA cluster validation it cannot honour. Four smaller verified issues (a fabricated min_compute_sms >= 1 that voids the documented 0 = unspecified sentinel, a silent ImportError → 0 fallback on the external API the whole SM-floor gate depends on, an inverted min() floor aggregation, and a stale normative design doc) round out the request.

Merge Risk

Level: High

Walkthrough

Pre-merge Checks

Blockers

  1. compute_coscheduled_alignment is fabricated, which makes half of the create-time guard unsatisfiable and lets a downgraded partition pass the per-node cluster check. helios/src/runtime_core/persistent_worker.rs:454-457:

    partition.compute_coscheduled_alignment = actual_compute_sm
        .sm_coscheduled_alignment
        .max(group_params[compute_index].coscheduled_sm_count);
    

    group_params[compute_index].coscheduled_sm_count is set to required_compute_coscheduled (:189) or to PREFERRED_COMPUTE_COSCHEDULED_SMS = 16, and the latter branch is only entered when required_compute_coscheduled < 16 (:195-200). Therefore group_params[compute].coscheduled_sm_count >= required_compute_coscheduled always, so the second disjunct at :490-496 (partition.compute_coscheduled_alignment < required_compute_coscheduled) can never be true. The first disjunct (actual_compute_sm.sm_coscheduled_alignment < baseline_coscheduled) is live, but only catches a drop below the baseline alignment, never a drop below the required alignment derived from max_cluster_size — exactly the case the guard's message ("compute green context partition lost required co-scheduled SM alignment") exists for.

    The fabrication propagates: prepare_graphs reads Some(partition.compute_coscheduled_alignment) (helios/src/runtime_core/mod.rs:958) and compares it per attribute at :1087-1094. With min_sm_partition_size = 8, sm_coscheduled_alignment = 8 and one graph declaring max_cluster_size = 16, required_compute_coscheduled = 16; if the driver downgrades the request to an 8-SM-aligned compute resource, :490 (8 < 8) and :491 (max(8,16)=16 < 16) both evaluate false, the partition is accepted, and a 16-CTA cluster node then satisfies cluster_size > alignment = 16 > 16 = false. The PR's stated invariant ("no fallback below max_cluster_size") is silently defeated, and the diagnostic printed by the new tests (:3037-3040, :3592-3595) cannot distinguish requested from actual alignment. main recorded the driver's real value (persistent_worker.rs:265 at main: partition.compute_coscheduled_alignment = actual_compute_sm.sm_coscheduled_alignment;), so this is a regression introduced here.

    Fix: stop laundering the value and compare once against the real output:

    partition.compute_coscheduled_alignment = actual_compute_sm.sm_coscheduled_alignment;
    if actual_compute_sm.sm_coscheduled_alignment < required_compute_coscheduled {
        return Err(invalid(format!(
            "compute green context partition returned co-scheduled alignment {}, below required {}",
            actual_compute_sm.sm_coscheduled_alignment, required_compute_coscheduled
        )));
    }
    

    baseline_coscheduled <= required_compute_coscheduled holds by construction at :108-114, so one comparison covers both.

Should Fix

  1. heliopause reports min_compute_sms >= 1 and max_cluster_size >= 1 for every exported graph, voiding the documented 0 = unspecified sentinel. heliopause/src/export/capture.rs:465-472 returns Ok(1) when attribute 4 is absent, and :491-499 sets min_compute_sms = declared.min(max_cluster_size). A plain decode graph with no clustered kernels and no b12x floor therefore serialises (1, 1), so a reader can never distinguish "no floor declared" from a real 1-SM floor, nor a genuine 1-SM floor from a 16-CTA cluster's implicit 16-SM floor — contradicting the proto comment the description cites for backward compatibility (helios/proto/core.proto:251-254). The .max() fold additionally double-counts cluster size into the SM floor, and persistent_worker.rs:108-114 consumes max_cluster_size independently anyway, so the fold buys nothing. The new unit test locks the wrong behaviour in (capture.rs:5671: assert_eq!(graph_sm_requirements(&nodes[..1], 0)?, (1, 1));). Fix: return 0 when the attribute is absent, drop the fold (let min_compute_sms = declared_min_compute_sms;), and update the test to (0, 0) / (128, 0).
  2. The load-time SM-floor gate silently becomes a no-op if the pinned b12x lacks the new API. ignition/preparation/capture.py:78-83 returns nullcontext({"min_compute_sms": 0}) on ImportError, and this PR changes no pin (pyproject.toml:47 still pins flashinfer-python to rev 1441ce862ffbc9d8550fdda7ad90e97ca04f4b8e; pyproject.toml is not in pr_files). On a rev without track_capture_min_compute_sms, every graph exports floor 0 and the advertised rejection at mod.rs:964-980 / persistent_worker.rs:137-170 never fires — a silent substitution of execution behaviour, which AGENTS.md:182-193 prohibits. The companion test also imports record_min_compute_sms at module top (tests/preparation/test_capture_graph_metadata.py:599), so it errors rather than skips on an older pin. Fix: bump/verify the pin to a rev containing the API, and make the missing tracker a hard failure (or an explicit, named skip) instead of 0.
  3. register_cooperative_plan aggregates the reservation floor with min(), so a re-registration can silently weaken it. ignition/preparation/scratch.py:163-164: self._cooperative_plans[key] = reserve_sms if prev is None else min(prev, reserve_sms). The guard at :158 computes required = max(self._min_reserve_sms, self._parallel_reserve_sms.get(key, 0)) and never includes prev, so a lowering re-registration always passes. Concretely: register_cooperative_plan(p, reserve_sms=8) records 8; register_cooperative_plan(p, reserve_sms=4) passes the guard (required == 0) and replaces 8 with min(8, 4) = 4; a correctly annotated register_parallel(p, q, reserve_sms=6) then raises. A floor must be monotone; every other aggregate in the class uses max (:135, :186-187). Not exercised by tests/preparation/test_scratch.py:548-584. Fix: self._cooperative_plans[key] = max(prev or 0, reserve_sms).
  4. docs/runtime-core-design.md:654-696 now contradicts the shipped behaviour. The section — which #709 itself rewrote — is scoped to "When a single-rank core declares an entry in Execution.persistent_workers" and lists only "two groups … or three groups … when prefix-cache offload is enabled with --lossless-kv-compression gpu". The PR makes a 2-way (codec, compute) split with no worker entry the shipped default for every non-worker core (model.rs:718-733, mod.rs:386-396), a topology that document says does not exist. docs/prefix-cache-offload.md:59-66 and helios/manifest.md:111-135 were updated; this file was not, and AGENTS.md:228 names it as the required doc for Protobuf/core-loading changes. Also stale: the Graph row at docs/core-format-design.md:222, which enumerates the record's fields and now omits the two fields Helios reads at load. Fix: update both.
  5. The public single-rank loader hardcodes reserve_codec_partition = false, so codec isolation and both new bounds are skipped on that path. mod.rs:335 (prepare_kernels(..., None, false) — the explicit false is added by this PR) and mod.rs:342-344 (initialize → initialize_with_options(.., false)), reached from NativeResources::load (:208), load_any (:232), load_selected (:269) and PayloadAuthorizedCore::load (protection.rs:2836). For a codec-enabled non-worker core loaded there, primary_context is false (:386), green_partition stays None (:793), every graph instantiates on self.context (:962), offload_context() falls back to the base context (:1511-1516), and neither min_compute_sms (:964-980) nor the cluster check (:1067-1096) is applied — silently. The main serving path is correct (model.rs:729-733, :859-867), and no production caller of the load_prepared path was found (only event_tests.rs:19, helios/tests/tools/test_{fixed_,}runtime_core.rs, and in-module tests), which is why this is not a blocker. Fix: thread the flag (or a LoadOptions/KvCompression argument) through load_prepared/initialize/PayloadAuthorizedCore::load, or fail closed when a core needs codec SMs and the flag is absent.

Subtract / Simplify

  1. resolve_reserve_sms(..., plan=...) is provably a no-op — delete the kwarg and _parallel_reserve_sms. ignition/preparation/scratch.py:137-146: floor = self.reserve_sms_floor is max(self._min_reserve_sms, self._max_parallel_reserve_sms), and every _parallel_reserve_sms[key] is assigned max(..., reserve_sms) in lockstep with _max_parallel_reserve_sms = max(..., reserve_sms) (:186-187), so per_plan <= _max_parallel_reserve_sms <= floor always and max(floor, per_plan) == floor. The body reduces to return max(requested, self.reserve_sms_floor). The test that appears to cover it (tests/preparation/test_scratch.py:559) cannot distinguish the branch because register_parallel(plan_a, plan_b, reserve_sms=4) at :556 already raised the arena-wide max to 4.
  2. Split out or drop the whole ScratchArena surface until it has a consumer. register_cooperative_plan, require_reserve_sms, resolve_reserve_sms, reserve_sms_floor, and min_reserve_sms appear only in ignition/preparation/scratch.py:59-188 and tests/preparation/test_scratch.py:548-607; no recipe, component, or preparation path calls them, and docs/core-design.md:821 / docs/preparation-development.md:256 still describe register_parallel as byte sizing only. AGENTS.md:167-169 ("Hypothetical future consumers … do not establish a need") and :188-193 ("Do not present scaffolding or partially wired features as supported") apply directly, and 139 lines of it ride with a CUDA fix.
  3. The cluster-dimension decode is written twice, with a magic 4 on only one side. Export uses a named constant and helper (capture.rs:462-489); load re-implements the identical parse with a bare literal at helios/src/runtime_core/mod.rs:1067-1078 — same attribute id, same three-u32 layout, same max(1) product, same overflow message. Move one decode next to the wire::Attribute type and call it from both.
  4. Duplicated Green Context API guard. mod.rs:387-396 rejects the missing-driver case before persistent_worker::create can run, so the ok_or_else at persistent_worker.rs:255-261 with the same message is unreachable from the load path. Keep one.
  5. Two identical passes over core.graphs. mod.rs:795-808 walks the graph list twice, once per field; one fold((0, 0), ..) or a Core::graph_sm_requirements() returning (u32, u32) (mirroring the identically shaped export-side helper) collapses them.
  6. (Option<u32>, bool) encodes an unrepresentable-but-checked state. persistent_worker.rs:85-91 and :247-254 both take five positionals, forcing the reject check at :96-100, the Some(0) check at :101-105, and the unreachable!() arm at :157. A PartitionRequest enum (Worker(u32) | Codec | WorkerAndCodec(u32)) makes all three illegal states unrepresentable and collapses two arguments into one along the initialize_with_options → prepare_kernels → create path.

Nits

Dropped on verification

Full report · Notes

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

Final review

Recommendation: Changes Requested

The 2-way (codec, compute) Green Context generalization is a well-scoped, model-agnostic continuation of #709 / #701, and its plan_sm_split arithmetic, cluster-dimension 3D product checks, proto field numbering, and ScratchArena weakest-link (min) reservation tracking are sound. However, two verified blockers must be resolved before merge: (1) the PR depends on unpinned b12x APIs from companion local-inference-lab/flashinfer#217, which will break the new test_capture_graph_metadata.py test on the pinned revision and silently turn min_compute_sms capture into a no-op via except ImportError; and (2) GreenContextPartition::create launders actual_compute_sm.sm_coscheduled_alignment with .max(group_params[compute_index].coscheduled_sm_count), rendering the post-creation alignment guard unconditionally dead and masking driver downgrades in load-time cluster validation. One normative-doc contradiction (docs/runtime-core-design.md) should also be updated alongside the code.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Unpinned flashinfer#217 dependency breaks the new Python test on pinned checkouts and silently disables min_compute_sms capture (pyproject.toml:47, ignition/preparation/capture.py:78-83, tests/preparation/test_capture_graph_metadata.py:599)

    • pyproject.toml:47 is unchanged and still pins flashinfer-python to rev = "1441ce862ffbc9d8550fdda7ad90e97ca04f4b8e" (landed in #707 for FlashInfer #213), which predates companion local-inference-lab/flashinfer#217.
    • tests/preparation/test_capture_graph_metadata.py:599 unconditionally runs from b12x._lib.utils.device import record_min_compute_sms, which will fail with ImportError on the pinned revision.
    • ignition/preparation/capture.py:78-83 wraps from b12x._lib.utils.device import track_capture_min_compute_sms in except ImportError: return nullcontext({"min_compute_sms": 0}), silently degrading exported min_compute_sms floors to 0 on the pinned revision instead of failing closed (AGENTS.md:184-186).
    • Fix: Merge local-inference-lab/flashinfer#217, bump pyproject.toml:47 to pin the merged commit, and remove the silent except ImportError fallback in ignition/preparation/capture.py:78-83 (or raise an explicit RuntimeError/ImportError identifying the required flashinfer-python revision).
  2. compute_coscheduled_alignment is overwritten with .max(group_params[compute_index].coscheduled_sm_count), making the post-creation alignment guard dead and defeating load-time cluster validation on driver downgrade (helios/src/runtime_core/persistent_worker.rs:359-369, :455-457, :490-496; helios/src/runtime_core/mod.rs:958, :1087-1094)

    • At persistent_worker.rs:359-362, group_params[compute_index].coscheduled_sm_count < required_compute_coscheduled already returns Err, and group_params is never modified afterward (while compute_split.sm_coscheduled_alignment is only checked against baseline_coscheduled, not required_compute_coscheduled).
    • At :455-457, partition.compute_coscheduled_alignment is assigned actual_compute_sm.sm_coscheduled_alignment.max(group_params[compute_index].coscheduled_sm_count). Because group_params[compute_index].coscheduled_sm_count >= required_compute_coscheduled is already guaranteed after :360, the check partition.compute_coscheduled_alignment < required_compute_coscheduled at :491 is unconditionally dead code.
    • Downstream, prepare_graphs (mod.rs:958, :1087-1094) validates kernel cluster_size <= partition.compute_coscheduled_alignment. In #532 on SM103, cuGreenCtxGetDevResource reported actual_compute_sm.sm_coscheduled_alignment == 16 directly without .max(...). Taking .max(group_params[compute_index].coscheduled_sm_count) masks any case where the driver returns a lower actual alignment (e.g., 8 when 16 was required for max_cluster_size = 16), silently passing oversized 16-CTA cluster nodes through load-time validation and printing the requested rather than actual alignment in test output (:3782).
    • Fix: Assign partition.compute_coscheduled_alignment = actual_compute_sm.sm_coscheduled_alignment directly, and check compute_split.sm_coscheduled_alignment < required_compute_coscheduled (:359) and actual_compute_sm.sm_coscheduled_alignment < required_compute_coscheduled (:490). (If SM120's driver genuinely reports 8 in actual_compute_sm.sm_coscheduled_alignment even when a 16-SM co-scheduled group was granted, verify whether SM120 actually honors 16-CTA clusters in that partition and remove the dead :491 check rather than laundering the reported alignment through .max().)

Should Fix

  1. Update contradicted normative design docs (docs/runtime-core-design.md:654-696, docs/core-format-design.md:222)
    • docs/runtime-core-design.md:654-696 still scopes Green Context partitioning solely to single-rank cores declaring Execution.persistent_workers and enumerates only 2-way (worker, compute) and 3-way (worker, codec, compute) topologies, contradicting this PR's fleet-wide 2-way (codec, compute) split for standard and multi-rank cores and omitting the new min_compute_sms/max_cluster_size load-time validation.
    • docs/core-format-design.md:222 lists the Graph record fields without the new optional min_compute_sms and max_cluster_size bounds.
    • Fix: Update docs/runtime-core-design.md:654-696 to cover all three partition topologies (including non-worker and multi-rank cores under --lossless-kv-compression gpu) and the SM-floor/cluster checks, and add min_compute_sms/max_cluster_size to the Graph row in docs/core-format-design.md:222.

Subtract / Simplify

  1. Drop the no-op plan= branch in ScratchArena.resolve_reserve_sms and deduplicate the 5× validation check (ignition/preparation/scratch.py:62-63, :122-123, :137-146, :150-151, :174-175): Every write to self._parallel_reserve_sms[key] also updates self._max_parallel_reserve_sms via max (:186-187), and self.reserve_sms_floor returns max(self._min_reserve_sms, self._max_parallel_reserve_sms) (:118). Thus _parallel_reserve_sms.get(id(plan), 0) <= self.reserve_sms_floor always holds, making lines :144-145 a provable no-op (keep _parallel_reserve_sms itself, as register_cooperative_plan uses it at :158 for per-plan checks). Also extract a single _validate_reserve_sms(value, name="reserve_sms") helper for the five identical type(...) is not int or < 0 checks.
  2. Replace (Option<u32>, bool) with an enum in plan_sm_split / GreenContextPartition::create (helios/src/runtime_core/persistent_worker.rs:85-105, :157, :247-254): A PartitionRequest enum (Worker(NonZeroU32), Codec, WorkerAndCodec(NonZeroU32)) makes (None, false) and (Some(0), _) unrepresentable, removes two error checks (:96-105) and unreachable!() (:157), and collapses two separate arguments threaded through mod.rs.
  3. Deduplicate cluster-dimension attribute parsing (heliopause/src/export/capture.rs:463-489 and helios/src/runtime_core/mod.rs:1067-1078): Both sites parse CU_LAUNCH_ATTRIBUTE_CLUSTER_DIMENSION (4) with identical 12-byte (cx, cy, cz) unpacking, .max(1) product, and overflow error, with mod.rs:1067 using bare literal 4. Share one named constant/helper.
  4. Collapse duplicate core.graphs folds and repeated CPU-fallback hint (helios/src/runtime_core/mod.rs:795-808, :394, :972; persistent_worker.rs:259, :348, :480): Compute (min_compute_sms, max_cluster_size) in a single fold over core.graphs, and share a const CPU_CODEC_HINT: &str = "; use --lossless-kv-compression cpu";.
  5. Drop unused RecordedExportGraph(..., min_compute_sms=...) dual channel (ignition/preparation/runtime_core.py:184-188, :299-301): capture.py:244-245 always attaches _flare_min_compute_sms directly on the returned graph, so the constructor kwarg is only used by tests/preparation/test_capture_graph_metadata.py:637-644.

Nits

Dropped on verification

Full report Decision to Test: no (100%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.

Classify triage

Selected: triage:review

Threshold: 65%

Triage

Apply labels

No label changes