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
- Blast radius: Only affects local multi-rank (
RankPeers::Threads) cores that declareExecution.persistent_workerson rank 0; single-rank cores, plain local multi-rank cores, and multi-host cluster cores are unchanged, and no serving hot path (DispatchRing,poll, wire formats) was altered. - Unexercised runtime surface: Admitting rank-0 workers on local multi-rank cores makes two untested multi-GPU/lifecycle interactions reachable: (1) asymmetric Green Context SM partitioning (
partition_sms = Some(...)on rank 0 vs.Noneon peers) with cooperative kernels, and (2)ThreadedExecutorstartup failure /GraphExecutor::abandonwhile rank 0's persistent worker is live. - Policy reversal without maintainer sign-off: PR #430's approval required keeping
cores.len() > 1rejected until multi-rank startup, teardown, and failure-abandonment (GraphExecutor::abandon, partialfinish_startupfailures) were implemented and tested.
Walkthrough
helios/src/runtime_core/model.rs:114-134, 1718-1772: Relaxedvalidate_persistent_worker_topologyto allow rank 0 (cores.first()) to carry a persistent worker whencluster.is_none(), while rejecting peer ranks (cores.iter().skip(1)) and clustered cores with"persistent workers are only supported on rank 0 of a local core"; updated unit tests accordingly.helios/src/runtime_core/selection.rs:224-225, 282-289, 650-721: Removedlet multi_rank = cores.len() > 1;and changedLoadOptions::select's guard frommulti_ranktorank > 0("persistent workers are only supported on rank 0"); updated selection unit tests to retain rank 0's worker graph alongside a plain peer.helios/src/execution/threaded.rs:632-636, 1292-1294, 1631-1651: Removed!manifest.persistent_workers.is_empty()fromThreadedExecutor::newso only peer manifests with workers are rejected, replacedsame_layout's worker-field comparison withif !b.persistent_workers.is_empty() { return false; }, and addedrank_layout_permits_persistent_worker_only_on_rank_zero.docs/runtime-core-design.md:642-644: Updated theExecution.persistent_workerstopology paragraph to state that local cores may declare a worker on rank 0 while peer ranks and multi-host cluster cores are rejected.
Pre-merge Checks
- [PASS] Security / malicious screen: Diff is +68 / −34 across 4 files, limited to topology/layout predicates, unit tests, and one doc paragraph; no new unsafe blocks, I/O, dependencies, or prompt-injection concerns.
- [WARN] Charter & value fit: Model-agnostic runtime change from priority contributor
@original-el8, but reverses PR #430's maintainer-imposed gate without fulfilling its multi-rank lifecycle condition or supplying a live multi-GPU run / concrete reproducer. - [PASS] Related / duplicate / conflict check: Additive follow-up to #430, #431, #507, and #613; no conflicting or superseding PRs touching these functions.
- [WARN] Tests & verification evidence: Claimed "initialize rank-0 persistent workers" behavior is untested in
ThreadedExecutor, only debug--libsubsets onflare-helioswere run (not--releaseacross affected crates perdocs/design-review.md:180-185), and live multi-GPU execution was not run.
Blockers
- 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,
@lukealonsorequired rejectingcores.len() > 1explicitly until multi-rank coordination and failure-abandonment (GraphExecutor::abandon, partialfinish_startupfailures) are implemented and tested, or multi-rank startup and teardown are validated directly. This PR lifts the gate while adding zero tests that constructThreadedExecutor::newwith a rank-0 worker (the new test atthreaded.rs:1631-1651only callssame_layout, andhelios/src/execution/tests.rs:1371-1373only 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:- 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, peerfinish_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) callsstd::process::abort()beforeresult.local.close()at:813runs. - Failure abandonment (
threaded.rs:1009-1012->transport.rs:979-990): When a poisoned multi-rank session or failed peer drain takesself.local.abandon(error),GraphExecutor::abandonforgetsself.resourcesand returnsShutdown { drained: false, .. }without signaling the worker'sstop_flag.DrainGuard(session.rs:125-133) then forgetsNativeModel, soNativeResources::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).
- Startup ordering (
- Concrete fix:
- Receive
Reply::Startedfrom all peers before callingresult.local.finish_startup()?inthreaded.rs:766-775so 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-effortcontrol.stop()or non-blockingstop_flag = 1write before forgettingresources, or document explicitly why it is intentionally left running). - Add a threaded CPU test (or test double via
PersistentWorkerControl) exercisingThreadedExecutor::newwith a rank-0 worker + plain peer(s), verifying start-once after peers are ready, clean stop onclose(), and partialfinish_startup/ abandonment behavior; obtain maintainer sign-off from@lukealonsothat #430's multi-rank condition is satisfied.
- Receive
- Verified behavior/impact: In PR #430,
Should Fix
- 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:
NativeResourcescreates a primary context +GreenContextPartitiononly when a rank declares a persistent worker (now rank 0 only), settingpartition_sms = Some(partition.compute_sm_count)(mod.rs:906), while peer ranks usecuCtxCreate_v2withpartition_sms = None(mod.rs:397-401, 910). Atmod.rs:1002-1006,status == 0 && partition_sms.is_some()triggersclamp_cooperative_launchon rank 0 even when the cooperative attribute restored cleanly, clamping rank 0's grid toblocks_per_sm * compute_sm_countwhile 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 fitcompute_sm_countare 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 underdocs/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_countwithout clamping and document that invariant indocs/same-process-tp.md:30-34anddocs/runtime-core-design.md:906-915), and validate with a live two-GPU run.
- Verified behavior/impact:
- Contradictory specification in
helios/manifest.md(helios/manifest.md:89-95):- Verified behavior/impact:
helios/manifest.md:92-95still 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 anddocs/runtime-core-design.md:642-644. - Concrete fix: Reword
helios/manifest.md:92-95to matchdocs/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).
- Verified behavior/impact:
- Run required
--releaseverification 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
--libruns onflare-helios, omitting--release, integration tests, and downstream crates (flare,flare-cli,heliopause) required bydocs/design-review.md:180-185. - Concrete fix: Run
cargo test --locked --releaseonhelios --features runtime-core,server,flare,flare-cli, andheliopause, and ensure CI workflows pass on the updated head.
- Verified behavior/impact: The PR body reports only CPU debug
Subtract / Simplify
- 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 ofsame_layout(threaded.rs:639) and already rejects any peer rank with non-emptypersistent_workerswith the precise topology error beforesame_layoutis called. Removing:1292-1294eliminates unreachable production code and freesrank_layout_permits_persistent_worker_only_on_rank_zero(threaded.rs:1631-1651) to be replaced with a realThreadedExecutor::newtest. - Delete the unreachable peer-rank worker check in
LoadOptions::select(helios/src/runtime_core/selection.rs:285-289):selectispub(super)(selection.rs:76) with one production caller (helios/src/runtime_core/model.rs:441), which always runs aftervalidate_persistent_worker_topology(model.rs:386). Deleting:285-289removes both an unreachable production branch and the third divergent error string ("persistent workers are only supported on rank 0"). (If standalone defense-in-depth inselectis explicitly desired, also checkself.cluster_rank.is_some()—already present onLoadOptionsatselection.rs:79—and unify the error message withmodel.rs:130.) - 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_workerandhas_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
helios/src/execution/tests.rs:1371: Update the now-stale comment// Multi-rank execution rejects persistent workers explicitly.to clarify that peer-rank persistent workers are rejected.helios/src/execution/parallel.rs:124, 556: Update"persistent workers are only supported on single-rank cores"to"persistent workers are only supported on rank 0 of a local core"(or note socket TP specifically) so error wording stays consistent across execution backends.helios/src/runtime_core/model.rs:1089-1092:NativeModel::dropiteratesself.ranks.iter_mut().rev(), runningrelease_execution_resources()(which unmaps device and mapped-host allocations) on peers before rank 0 stops its persistent worker. While normalServingSession::close()stops the worker first viaGraphExecutor::close(), stopping all persistent workers before unmapping any rank's allocations is clean defense-in-depth ifNativeModelis ever dropped directly with a live worker.
Dropped on verification
- Correctness lens F6 claim that
LoadOptions::selecthas no cluster state/argument: Verified false —LoadOptionsalready holdsself.cluster_rank(helios/src/runtime_core/selection.rs:79). Dropped that premise; kept the simpler deletion/unification item under Subtract / Simplify. - Correctness lens F4 claim that
same_layoutnewly became non-reflexive (!same_layout(&root, &root)): Verified overstated —same_layoutwas already non-reflexive forengram(helios/src/execution/threaded.rs:1276, asserted at:1620) andoffload(:1283). Replaced with the stronger verified finding that:1292-1294is redundant with:632-636. - Overbroad framing of Correctness lens F1 implying all cooperative kernels deadlock under asymmetric SM partitions: Narrowed to the verified hazard — single-GPU cooperative kernels tolerate largest-axis reduction (
docs/runtime-core-design.md:906-915) and collectives already fittingcompute_sm_countare not shrunk (helios/src/runtime_core/mod.rs:144); the defect specifically affects full-device cooperative collectives assuming symmetric CTA counts across ranks (docs/same-process-tp.md:32-33). - Speculation about which CI workflow failed on
b7a6204: CI logs are not accessible from this environment and the dossier noted approval gating on same-day PRs; dropped causal speculation while retaining the verified gap between reported CPU debug--libruns and the required--releasesuite.