Final review report · NVIDIA/hyperflare-inference #709

Raw Markdown for agents: https://autobot.eidonix.com/p/02b0edba-30a5-4c18-a126-de64704626b3.md

Recommendation: Changes Requested

The three fixes are real root-cause fixes and the riskiest inverse-guard hypotheses are all disproved by the callee definitions (packed::permits(None) == false, MpSide::world() == 1 for single-host TP≥2, descriptor still used after the new guard). One verified code defect remains — the new codec Green Context never receives the core's recorded CUDA context limits/cache configuration while the two sibling green contexts do — plus two normative documents that the PR leaves contradicting or incomplete about behavior it changes. No blocker, no hot-path regression, no wire/format change.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. The new codec context never receives the core's recorded CUDA context limits and cache configuration. helios/src/runtime_core/mod.rs:767-786 applies apply_context_settings to the primary context (:768) and to partition.worker_context (:783) and partition.compute_context (:784) only; codec_context is created at persistent_worker.rs:388-396 and from this PR onward runs every GPU codec kernel and every offload DMA stream (mod.rs:1410-1421 → model.rs:969). The repo's own model is that these settings are not inherited by green contexts — hence the two explicit calls — and the pre-existing test asserts exactly that for the worker/compute pair (persistent_worker.rs:2218-2243, comment "verify recorded CUDA context limits propagate into both Green Contexts", asserting CU_LIMIT_STACK_SIZE on both). Result: the same kv_codec_gpu kernels run with the core's declared limits/cache config on a non-persistent-worker core and with driver defaults on a persistent-worker core under gpu compression — a core-shape-dependent divergence in kernel-visible context state. Fix: inside the if let Some(worker) arm, before self.green_partition = Some(partition), add if !partition.codec_context.is_null() { apply_context_settings(&driver, partition.codec_context, &core.context)?; }, and extend the assertion in the existing green-context test to the codec context (the new #[ignore]d test can assert it too).
  2. docs/runtime-core-design.md:642-672 now contradicts the shipped load/teardown path and was not updated. The normative core-loading spec still says SMs are partitioned "into two explicit structured SM resource groups" (:648-651), that the recorded limits/cache are applied "to the primary context and both green contexts" (:651-652), and that teardown destroys "worker and compute streams, executables, modules, mappings, green contexts" (:668-672). The implementation is now 2-or-3 groups with a codec_context, and the third context is the one whose teardown is newly special-cased (mod.rs:1641) — exactly the invariant a future teardown edit would need to know. Only docs/prefix-cache-offload.md was changed. Fix: update that section for the 2-way vs 3-way split, codec_context existence/teardown, and which contexts host offload and codec work.
  3. selene-manager/PROTOCOL.md does not state the new multi-process raw-only rule. §13.x at PROTOCOL.md:1050-1060 still only says every process of an instance offers identical capabilities and that "Instance holdings may be raw or packed", with no statement that a session with ranks negotiates raw-only (core.rs:641-651), that packed PutBegin is refused for it (store_bridge.rs:412), or that packed holdings/offers are excluded for a multi-process requester or source (claims.rs:637-642, :922-929, lookup.rs:217-228) while raw v3 stays claimable. AGENTS.md:233 makes this file the governing doc for Selene-manager changes. Fix: add the negotiation and exclusion rule beside the revision-4 envelope section, and state that single-host TP≥2 (single-process, world == 1) remains packed-capable.

Subtract / Simplify

  1. helios/src/runtime_core/persistent_worker.rs:2615 adds another full copy of the struct TestFiles / impl Files fixture already present earlier in the same file (e.g. :1285); hoist one #[cfg(test)] fixture instead of adding a fifth.
  2. helios/src/runtime_core/model.rs:820-821: reserve_codec_partition = options.prefix_cache.enabled() && !model.gpu_codec_cubins.is_empty() reduces to options.prefix_cache.compression == KvCompression::Gpu (verified: gpu_codec_cubins is non-empty only under KvCompression::Gpu, model.rs:629-658, and enabled() is implied). Writing it directly removes the positional false at mod.rs:334 and removes the ambiguity the review raised about cpu-mode cores.
  3. selene-manager: the requester-side conjuncts at claims.rs:640 (!requester_mp) and lookup.rs:226 (session.ranks.is_none()) re-verify the invariant core.rs:646 already establishes (codec = None when ranks.is_some()); only the source side needs a gate. Collapsing all three sites (claims.rs:637-642, claims.rs:922-929, lookup.rs:217-228) into one fn packed_caps(&self, sid: u64, source_mp: bool) also removes the third, divergent formulation in get_answer.
  4. persistent_worker.rs:94-113: the aligned_codec = 0 sentinel makes aligned_worker.checked_add(0) dead when reserve_codec_partition is false and duplicates the six-line error message; Option<u32> plus one interpolated message halves that block.

Nits

Dropped on verification