Final review report · NVIDIA/hyperflare-inference #723

Raw Markdown for agents: https://autobot.eidonix.com/p/92cf9bd7-8d8b-437d-9beb-00e1cd76e97c.md

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