PR #640: helios: allow persistent workers on rank 0 of local multi-rank cores

Raw Markdown for agents: https://autobot.eidonix.com/api/v1/cases/377ae3bf-4820-4ada-984a-2134b7323be3

Opened by a workflow run, Nov 30, 2026 7:26 AM EST. decide malicious: all_clear (100%): No malicious content found

explore

Author: original-el8 (COLLABORATOR; git author "Jason Cook"; Discord el8) — owner of the persistent-worker stack (#430, #431, #432, #465, #472) Motivation: Helios refused Execution.persistent_workers for any core with more than one rank. The author wants a local multi-GPU core to run one persistent worker (e.g. a GPU-side mover) on rank 0 while peer ranks stay plain under ThreadedExecutor. Peer-rank and multi-host (cluster) workers must stay rejected. Scale: +68 / −34 in 4 files Proposal:

Full report · Notes

Value Proposition

Value Proposition — PR #640 "helios: allow persistent workers on rank 0 of local multi-rank cores"

Charter alignment — mostly in the right place. The change is a topology predicate inside Helios, holding no per-model branches or new flags, which matches the charter's "keep the runtime small and model-agnostic (#267, #334)" and lands in the runtime layer rather than in recipes. But it collides with two other charter rules: the supported-matrix review standard ("check interactions across every … parallel layout") because the touched interaction is precisely a live same-host multi-rank layout that was never exercised, and "bring real evidence," since the motivation is one sentence ("GPU-side mover") with no issue, benchmark, or failing reproduction attached.

Novelty & status — genuinely additive, not superseded or obsolete. No competing or reverting PR/issue exists; #613 (teardown) and #622 (L2 limits) touch adjacent ground without overlap, and nothing on main has changed these four files since branching. So the question is not redundancy.

The real question is #430's unresolved condition. The gate being removed was imposed deliberately by the maintainer (lukealonso) in review of the parent PR #430, with an explicit either/or: keep rejecting cores.len() > 1 / cluster.is_some() until multi-rank coordination and failure-abandonment (GraphExecutor::abandon, partial finish_startup failures) are implemented and tested, or validate multi-rank startup and teardown directly. #640 removes the first option and adds none of the second: ThreadedExecutor::new's drain/abort paths and finish_startup are unchanged and untested with a worker present. That is a policy reversal, not a bug fix.

Value vs cost. The beneficiary is narrow but real: same-host RankPeers::Threads cores with a worker on rank 0, which currently fail at load. The evidence is unit-level for load/select/layout only; the PR itself concedes live multi-GPU loading/execution was not run, and the layout-comparison test asserts a worker-bearing manifest never matches even itself under same_layout. Add the stale helios/manifest.md:87-95 (still says multi-rank worker cores fail validation), inconsistent error wording across sites, and a failed CI run on b7a6204, and the maintenance cost is currently under-supported relative to a seven-day-old deliberate restriction.

Verdict: Worth it with changes. original-el8 is a priority contributor and this continues his own persistent-worker stack, so this is not a low-value close. To merge: (1) get maintainer sign-off that #430's multi-rank condition is satisfied — the contract area required approval before; (2) supply at least one live/threaded multi-rank execution test covering startup and teardown with a rank-0 worker; (3) update helios/manifest.md and unify error text; (4) explain the CI failure. Without (1) and (2), it is a predicate relaxation that trades away a documented safety guarantee for an unexercised configuration.

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

Classify intake

Selected: triage:review, enhancement

Threshold: 65%

Triage

Priority

Type

Area

Model

Apply Labels (Intake)

Applied: +triage:review, +enhancement

Subtraction and simplicity

  1. helios/src/execution/threaded.rs:1292-1294 — delete. The new if !b.persistent_workers.is_empty() { return false; } in same_layout is a second validator for a rule ThreadedExecutor::new already enforces at :632-636, before same_layout is ever consulted, with a precise error instead of "rank graph I/O schemas differ".
  2. helios/src/runtime_core/selection.rs:285-289 — delete. LoadOptions::select is pub(super) with one production caller (model.rs:441), which runs validate_persistent_worker_topology at model.rs:386; that function rejects exactly any peer-rank worker, so the rank > 0 branch is unreachable outside the synthetic test.
  3. helios/src/runtime_core/model.rs:118-127 — collapse. The same five-line closure body is written twice (has_rank0_worker, has_peer_worker).
  4. helios/manifest.md:92-95 — stale spec the PR forgot. It still says "multi-rank cores … fail validation before execution". Only docs/runtime-core-design.md:642-644 was reworded.
  5. Otherwise the diff is lean: no new flags, config keys, LoadOptions fields, wrappers or fallback branches; the test changes are proportionate; nothing speculative was added.

(No summary was written: this is the report's Key findings section.)

Full report · Notes

Correctness and contracts

Reviewed PR #640 (correctness / contracts / system-level lens) at head b7a6204 by opening every changed file, its callers and tests. No Blocker: the predicate change is correct and narrow — model.rs:118-132, selection.rs:285-289 and threaded.rs:632-636 admit exactly a local core whose rank 0 carries one worker, and peer/cluster cases still fail. No wire/proto change, no new locks or allocations, and the metrics reader (server/runtime.rs:631-634) still sees exactly the one worker, so no metric span shrink.

Major findings:

Open: which CI workflow failed on b7a6204; whether Ignition can export a rank-0-only worker for a multi-rank core; whether rank-0 worker start/dispatch/drain works inside a ThreadedExecutor; and whether #430's multi-rank startup/teardown condition is now considered satisfied (no maintainer statement exists).

Full report · Notes

Final review

Recommendation: Changes Requested

The predicate relaxations in model.rs, selection.rs, and threaded.rs are narrow, model-agnostic, and cleanly scoped to rank 0 of local multi-rank cores, while preserving peer-rank and multi-host cluster rejections. However, the PR lifts a maintainer-imposed safety gate from PR #430 without exercising or hardening the multi-rank initialization, partial-startup-failure, and failure-abandonment paths that #430 explicitly required before enabling multi-rank persistent workers, leaves helios/manifest.md contradicting the code, and exposes unvalidated cooperative-collective SM-partition asymmetry across ranks. Add real threaded lifecycle coverage (and address startup/abandonment handling), update helios/manifest.md, address/verify the cooperative SM-partition asymmetry, and run the full --release crate test gates before merging.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

  1. Unmet PR #430 multi-rank lifecycle condition and untested initialization/teardown paths (helios/src/execution/threaded.rs:632-636, 766-822, 1004-1012, 1631-1651; helios/src/execution/transport.rs:793-808, 979-990; helios/src/server/session.rs:96-101, 125-133):
    • Verified behavior/impact: In PR #430, @lukealonso required rejecting cores.len() > 1 explicitly until multi-rank coordination and failure-abandonment (GraphExecutor::abandon, partial finish_startup failures) are implemented and tested, or multi-rank startup and teardown are validated directly. This PR lifts the gate while adding zero tests that construct ThreadedExecutor::new with a rank-0 worker (the new test at threaded.rs:1631-1651 only calls same_layout, and helios/src/execution/tests.rs:1371-1373 only asserts peer rejection), leaving the PR's claim that local multi-rank cores can initialize rank-0 persistent workers unverified (docs/design-review.md:187-189). Furthermore, two concrete lifecycle hazards remain on the newly reachable multi-rank paths:
      1. Startup ordering (threaded.rs:766-775): result.local.finish_startup()? launches rank 0's persistent worker before confirming peers' Reply::Started. Because peer ranks cannot have persistent workers, peer finish_startup() does no CUDA work; if a peer fails startup, rank 0 has already launched the worker and peer-join cleanup (threaded.rs:802-810) calls std::process::abort() before result.local.close() at :813 runs.
      2. Failure abandonment (threaded.rs:1009-1012 -> transport.rs:979-990): When a poisoned multi-rank session or failed peer drain takes self.local.abandon(error), GraphExecutor::abandon forgets self.resources and returns Shutdown { drained: false, .. } without signaling the worker's stop_flag. DrainGuard (session.rs:125-133) then forgets NativeModel, so NativeResources::release_execution_resources() never runs either, leaving rank 0's persistent worker spinning on its SM partition until process exit (including in in-process Rust SDK consumers).
    • Concrete fix:
      • Receive Reply::Started from all peers before calling result.local.finish_startup()? in threaded.rs:766-775 so rank 0's worker never starts on a failed peer startup.
      • Decide and implement explicit abandonment semantics for a running rank-0 worker in GraphExecutor::abandon (e.g., best-effort control.stop() or non-blocking stop_flag = 1 write before forgetting resources, or document explicitly why it is intentionally left running).
      • Add a threaded CPU test (or test double via PersistentWorkerControl) exercising ThreadedExecutor::new with a rank-0 worker + plain peer(s), verifying start-once after peers are ready, clean stop on close(), and partial finish_startup / abandonment behavior; obtain maintainer sign-off from @lukealonso that #430's multi-rank condition is satisfied.

Should Fix

  1. Unvalidated SM-partition asymmetry for cooperative TP collectives (helios/src/runtime_core/mod.rs:369-402, 763-781, 893-911, 1002-1017, 1335-1374; docs/same-process-tp.md:30-34):
    • Verified behavior/impact: NativeResources creates a primary context + GreenContextPartition only when a rank declares a persistent worker (now rank 0 only), setting partition_sms = Some(partition.compute_sm_count) (mod.rs:906), while peer ranks use cuCtxCreate_v2 with partition_sms = None (mod.rs:397-401, 910). At mod.rs:1002-1006, status == 0 && partition_sms.is_some() triggers clamp_cooperative_launch on rank 0 even when the cooperative attribute restored cleanly, clamping rank 0's grid to blocks_per_sm * compute_sm_count while peers keep their captured full-device grid. While single-GPU cooperative kernels tolerate largest-axis reduction (docs/runtime-core-design.md:906-915) and collectives whose grids already fit compute_sm_count are unaffected (mod.rs:144), any full-device cooperative collective expecting symmetric CTA counts across ranks will silently receive fewer CTAs on rank 0 than on peers — risking a barrier hang under docs/same-process-tp.md:32-33. Because no live multi-GPU test ran, neither cooperative grid symmetry nor VMM peer access (peer_access.rs:38-57) alongside a rank-0 Green Context has been verified.
    • Concrete fix: Either reject multi-rank loads when rank 0's cooperative clamp actually shrinks a grid relative to its peers (or require preparation validation that multi-rank cooperative collectives fit compute_sm_count without clamping and document that invariant in docs/same-process-tp.md:30-34 and docs/runtime-core-design.md:906-915), and validate with a live two-GPU run.
  2. Contradictory specification in helios/manifest.md (helios/manifest.md:89-95):
    • Verified behavior/impact: helios/manifest.md:92-95 still states: "Helios currently supports at most one persistent worker entry on single-rank cores; cores declaring more than one entry, multi-rank cores, and multi-host cluster cores declaring a persistent worker fail validation before execution." This directly contradicts both the code and docs/runtime-core-design.md:642-644.
    • Concrete fix: Reword helios/manifest.md:92-95 to match docs/runtime-core-design.md:642-644 (at most one entry on rank 0 of a local core; peer ranks and multi-host cluster cores fail validation).
  3. Run required --release verification gates and confirm green CI (docs/design-review.md:180-185; .github/workflows/native-serving.yml:56-77 (not opened)):
    • Verified behavior/impact: The PR body reports only CPU debug --lib runs on flare-helios, omitting --release, integration tests, and downstream crates (flare, flare-cli, heliopause) required by docs/design-review.md:180-185.
    • Concrete fix: Run cargo test --locked --release on helios --features runtime-core,server, flare, flare-cli, and heliopause, and ensure CI workflows pass on the updated head.

Subtract / Simplify

  1. Delete the redundant worker check in same_layout (helios/src/execution/threaded.rs:1292-1294): ThreadedExecutor::new (threaded.rs:632-636) is the only non-test caller of same_layout (threaded.rs:639) and already rejects any peer rank with non-empty persistent_workers with the precise topology error before same_layout is called. Removing :1292-1294 eliminates unreachable production code and frees rank_layout_permits_persistent_worker_only_on_rank_zero (threaded.rs:1631-1651) to be replaced with a real ThreadedExecutor::new test.
  2. Delete the unreachable peer-rank worker check in LoadOptions::select (helios/src/runtime_core/selection.rs:285-289): select is pub(super) (selection.rs:76) with one production caller (helios/src/runtime_core/model.rs:441), which always runs after validate_persistent_worker_topology (model.rs:386). Deleting :285-289 removes both an unreachable production branch and the third divergent error string ("persistent workers are only supported on rank 0"). (If standalone defense-in-depth in select is explicitly desired, also check self.cluster_rank.is_some()—already present on LoadOptions at selection.rs:79—and unify the error message with model.rs:130.)
  3. Collapse the duplicated closure in validate_persistent_worker_topology (helios/src/runtime_core/model.rs:118-128): Replace the two identical 5-line closures (has_rank0_worker and has_peer_worker) with a single pass:
    let unsupported = cores.iter().enumerate().any(|(rank, core)| {
        core.execution
            .as_ref()
            .is_some_and(|execution| !execution.persistent_workers.is_empty())
            && (rank > 0 || cluster.is_some())
    });
    if unsupported { ... }
    

Nits

Dropped on verification

Full report

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.