#1 [high] Findings index for PR #640 correctness/contracts lens
All verified against head b7a6204 by reading files (no guessing).
F1 (Major) SM-partition asymmetry: cooperative grids clamped on rank 0 only. F2 (Major) "initialize" claim unverified / no executor-level success test. F3 (Major) stale contract doc helios/manifest.md:89-95. F4 (Minor) same_layout degraded to a directional predicate; loses worker field comparison. F5 (Minor) rank-0 worker never signalled when peer drain fails (newly reachable abandon path). F6 (Minor) error-message/contract wording drift across four sites. Sound areas: selection rank indexing vs cluster selection; metrics reader span; parallel.rs/heliopause unchanged; no new deps/flags/wire changes; no locks or hot-path allocations added.
#2 [high] F1 SM partition asymmetry on rank 0 clamps cooperative grids
helios/src/runtime_core/mod.rs:374-402 — primary context + green partition path is taken only when wants_worker.is_some() (i.e. only rank 0 after this PR); peers use cuCtxCreate_v2.
mod.rs:763-780 — GreenContextPartition::create(... worker.worker_sm_count) per rank, gated on self.primary_context and execution.persistent_workers.first().
mod.rs:888-911 — partition_sms = Some(compute_sm_count) only when self.green_partition is Some; peers get partition_sms = None, upload_stream = null.
mod.rs:1002-1016 quote:
if attribute.id == 2
&& value[0] as u32 != 0
&& (status == 720 || (status == 0 && partition_sms.is_some()))
{
self.clamp_cooperative_launch(&mut params, partition_sms)?;
=> on rank 0 a cooperative kernel whose attribute restores cleanly (status == 0) is still clamped because partition_sms.is_some(); on peers status == 0 and partition_sms is None so nothing is clamped.
mod.rs:135-146 clamp_cooperative_grid reduces the largest grid axis to fit blocks_per_sm * sms.
docs/runtime-core-design.md:906-915 requires cooperative grids to tolerate the reduction, but says nothing about cross-rank symmetry.
docs/same-process-tp.md:30-34 "Preparation must validate that each collective's worker grid can remain resident on every participating GPU"; same-process-tp.md:177-180 "Not qualified: four ranks, graphs that contain b12x spin-barrier collectives".
selection.rs:416-424 requires identical selected graph catalogs across ranks, so captured grid dims are identical everywhere; same_layout (threaded.rs:1273-1332) compares no node grid dimensions and no SM capacity, so it cannot detect the mismatch.
Impact: rank 0 participates in a TP collective / barrier with fewer resident CTAs than its peers, and rank 0's compute partition is 8 SMs smaller than peers (imbalanced decode step time bounded by rank 0). The PR body lists live multi-GPU execution with a worker as not executed.
Fix: either reject rank-0 workers when the created compute partition is smaller than the device SM count used by peers (or when any serving graph uses cooperative launch / cluster launch), or validate the barrier protocol against asymmetric resident-CTA counts and record it in docs/runtime-core-design.md; add a two-GPU test that runs a cooperative/barrier graph with a rank-0 worker.
#3 [high] F2 initialize claim has no test in threaded path
helios/src/execution/threaded.rs:632-636 only rejects peer manifests; rank 0's worker is accepted at construction. But nothing exercises a successful construction with a worker.
- helios/src/execution/tests.rs:1371-1373 still asserts only rejections:
// Multi-rank execution rejects persistent workers explicitly.
assert!(unsafe { threaded::ThreadedExecutor::new(value.clone(), vec![value.clone()]) }.is_err());
assert!(unsafe { threaded::ThreadedExecutor::new(manifest(), vec![value.clone()]) }.is_err());
(these two remain correct under the new rule, so the comment is stale but the assertions hold)
- the only new test (threaded.rs:1631-1651) calls
same_layoutdirectly, neverThreadedExecutor::new. finish_startuprequiresworker.control(helios/src/execution/transport.rs:797-805):
if let Some(worker) = self.manifest.persistent_workers.first() {
let control = worker.control.as_ref().ok_or_else(|| Error::execution(
ExecutionError::Manifest,
"persistent worker requires green-context runtime control (export a core and serve with flare run)",
))?;
control.start()?;
}
control is only produced by the native path (runtime_core/serving.rs:181 control: self.persistent_worker_control()), so a CPU/manifest-only test cannot reach it. The GPU test that does (helios/src/runtime_core/persistent_worker.rs:1095 cuda_... test and :2029) is single-rank and #[ignore]d.
- PR body says "Local multi-rank cores can load, select, and initialize rank-0 persistent workers"; "initialize" is exactly
finish_startup->control.start()in rank 0's thread, for which there is no test and no live run (PR body limitations confirm). Impact: the claim most likely to fail in practice (rank-0 worker start inside a ThreadedExecutor, then drain on close with peers) has zero coverage; a regression here is silent until a multi-GPU machine is available. Fix: add a threaded test with a self-containedPersistentWorkerControltest double (control is an opaque handle with its own start/stop) drivingThreadedExecutor::new(...).close()and asserting the worker starts once, after peers reportStarted, and stops before peers join; or downgrade the PR body claim to "select and lay out".
#4 [high] F3 stale manifest contract doc
helios/manifest.md:87-95 still describes the old rule and is the execution-manifest contract AGENTS.md:227 points Helios changes at:
An execution catalog may optionally declare `Execution.persistent_workers`
(repeated Protobuf message `PersistentWorker`, field 8) to run a dedicated
graph concurrently with serving graphs on a spatially partitioned CUDA Green
Context. 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.
After this PR a local multi-rank core with a rank-0 worker loads and serves, so "multi-rank cores ... fail validation" is false. Only docs/runtime-core-design.md:642-644 was updated; the PR description's changed-file list does not mention helios/manifest.md. Impact: an exporter/recipe author reading the manifest contract will believe the topology is rejected and keep the worker off local TP cores, i.e. the capability this PR adds stays undiscoverable; also a reviewer/doc test mismatch. Fix: update manifest.md:92-95 to "at most one entry on rank 0 of a local core; peer ranks and multi-host cluster cores declaring a persistent worker fail validation", matching runtime-core-design.md:642-644.
#8 [high] F7 areas verified sound
Verified as sound in this PR (state plainly in report, do not invent issues):
- selection.rs rank indexing:
for (rank, core) in cores.iter_mut().enumerate()(selection.rs:227) runs after cluster selection narrowscoresto the one served rank at model.rs:345-350, sorank > 0means "peer rank within the local core" exactly as intended; for a clustered corecores.len() == 1and model.rs:128 already rejected the worker. No off-by-one. - Metrics scope: helios/src/server/runtime.rs:631-634 reads
manifest.persistent_workers.first()from rank 0's coordinator manifest, which is the only manifest that now can carry a worker (threaded.rs:632 rejects peers), soflare_persistent_worker_*//v1/worker/ dashboard telemetry keeps describing exactly the one running worker. No metric span shrinkage. - No new locks, channels, allocations, buffering or I/O on any hot path: the diff touches only two validation predicates, one layout predicate, tests and one doc paragraph (+68/−34, pr_files).
DispatchRing,pending, and the peer reply path are untouched. - No wire/proto/ABI/captured-graph contract change:
PersistentWorkerschema,wire.rs:241-242serialization andparallel/wire.rsare unchanged; out-of-tree/socket TP and the Python loader (ignition/preparation/execution.py:333-336,:352-355;heliopause/src/python.rs) still reject workers, matching the PR's stated scope, and single-rank worker cores behave identically. - Threaded worker/peer failure containment: peers still never carry workers, so
ThreadedExecutor::new's drain/abort paths keep the same peer behaviour; the only new state is rank 0's worker (see F5). - Charter: model-agnostic topology predicate, no per-model branch, no new flag/default.
- Before/after claims in the PR description match the diff, except (a) "initialize" (F2) and (b) the description omits helios/manifest.md (F3); the description's file list, line-level before/after, and test names are accurate.
#9 [high] Research summary
Reviewed PR #640 (correctness / contracts / system-level lens) by reading every changed file, its callers, contracts and tests at head b7a6204. Findings are in the scratchpad (entries 1–8); summary below.
Blockers: none. The relaxation itself is correct and narrow: validate_persistent_worker_topology (model.rs:114-134), LoadOptions::select (selection.rs:285-289) and ThreadedExecutor::new (threaded.rs:632-636) now admit exactly a local core whose rank 0 carries one worker, and peer/cluster cases still fail. Rank indexing is right (rank > 0 runs after cluster selection narrows cores to the served rank at model.rs:345-350), no wire/proto/ABI change, no new locks, allocations or I/O on hot paths, and the metrics//v1/worker/dashboard reader still sees the single worker because rank 0's manifest is the only one that can carry it.
Major — SM-partition asymmetry is now reachable (F1, helios/src/runtime_core/mod.rs:374-402, :888-911, :1002-1016). Only the worker-bearing rank takes the primary-context/green-context path; peers use cuCtxCreate_v2 with partition_sms = None. So on rank 0 a cooperative kernel whose launch attribute restores with status 0 is still clamped (partition_sms.is_some()), and rank 0's compute partition is worker_sm_count smaller, while selection.rs:416-424 forces identical selected graph catalogs on every rank and same_layout compares neither node grids nor SM capacity. A same-host TP core with a rank-0 worker therefore runs TP collectives/barriers with fewer resident CTAs on rank 0 and an imbalanced decode step — exactly the "not qualified" case in docs/same-process-tp.md:30-34 and :177-180. The PR body itself lists live multi-GPU execution with a worker as not executed.
Major — the "initialize" claim has no test (F2). Only same_layout is exercised by the new test (threaded.rs:1631-1651); execution/tests.rs:1371-1373 still asserts only rejections, and there is no successful ThreadedExecutor::new + close with a worker. Initialization goes through transport.rs:797-805, which needs worker.control, produced only by the native path (runtime_core/serving.rs:181) and covered only by #[ignore]d single-rank GPU tests. Nothing verifies the worker starts once after peers report Started, or that close drains peers and the worker together.
**Major — stale contract doc (F3, helios/manifest.md:92-95).** Still says "multi-rank cores … fail validation before execution", which this PR makes false; only docs/runtime-core-design.md:642-644was updated, and the PR description omitshelios/manifest.md`. AGENTS.md:227 points Helios changes at that file, so the new capability stays undiscoverable to core authors.
Minor: same_layout became a directional, self-false predicate with the worker field comparison deleted and the asymmetry enshrined in the test (threaded.rs:1292-1294, :1648-1650) — F4; the newly reachable abandon path forgets rank 0's resources without ever writing the stop flag (threaded.rs:1004-1013 → transport.rs:980-990) — F5; three different error strings for one rule plus an implicit ordering dependency where select alone cannot reject a clustered rank-0 worker (F6).
Sound and stated plainly: nothing added to shared hot paths, socket TP and the Python loader still reject workers in line with the stated scope, and the PR's before/after text matches the diff apart from the word "initialize" and the omitted manifest doc.
#10 [high] F1 supporting quotes and severity summary
Additional verbatim quotes for F1 (the green-context gate that makes the partition rank-0-only), to be quoted directly in the report:
helios/src/runtime_core/mod.rs:369-380
let wants_worker = core
.execution
.as_ref()
.and_then(|execution| execution.persistent_workers.first());
let mut context = null_mut();
let primary_context = if wants_worker.is_some() {
if driver.green_ctx.is_none() {
return Err(invalid(
"persistent worker requires CUDA driver Green Context APIs",
));
}
and the else branch at :396-401 (cuCtxCreate_v2, primary_context = false).
helios/src/runtime_core/mod.rs:763-774
if self.primary_context {
apply_context_settings(&driver, self.context, &core.context)?;
if let Some(worker) = core
.execution
.as_ref()
.and_then(|execution| execution.persistent_workers.first())
{
let partition = persistent_worker::GreenContextPartition::create(
&driver,
self.device,
worker.worker_sm_count,
)?;
So green_partition (and therefore partition_sms = Some(compute_sm_count) at :895-908) exists only on the rank that declares the worker. Peers fall to (self.context, null_mut(), None) at :909-911.
Severity summary for the report:
- F1 SM-partition asymmetry / cooperative-grid clamp only on rank 0 — Major
- F2 "initialize" claim untested (no ThreadedExecutor::new success + close test) — Major
- F3 helios/manifest.md:92-95 stale contract — Major
- F4 same_layout directional + field comparison deleted — Minor
- F5 abandon forgets rank-0 worker without stop flag — Minor
- F6 message drift + implicit select-after-model validation ordering — Minor
- F7 areas verified sound — informational No Blocker found; the topology predicate change itself is correct.
#5 [medium] F4 same_layout asymmetry
helios/src/execution/threaded.rs:1292-1294 replaced a field-wise comparison with a one-way predicate:
if !b.persistent_workers.is_empty() {
return false;
}
Before: compared len + worker_sm_count/graph/metrics_count for every entry. Now:
same_layout(a, b) != same_layout(b, a)(asymmetric) — new test at threaded.rs:1648-1650 asserts exactly that (assert!(same_layout(&root,&peer)); assert!(!same_layout(&peer,&root)); assert!(!same_layout(&root,&root));).- It is no longer a layout equality predicate: a worker-bearing manifest returns false against itself (threaded.rs:1650), and any mismatch in worker geometry (worker_sm_count, graph name, metrics_count) between rank 0 and a peer that carried a worker is now reported as the generic "rank graph I/O schemas differ" (threaded.rs:639-641) rather than being caught as a worker topology error. Today
ThreadedExecutor::newrejects peer workers at :632 first, so the error is still correct, but the invariant is enforced twice with the weaker copy being dead and directional. Impact: a future relaxation of the :632 gate (e.g. allowing a worker on another rank, or comparing two worker-bearing rank groups) silently makessame_layoutreject legitimate layouts, and any other caller ofsame_layoutinherits a non-symmetric predicate. Small but it is a contract weakening in shared shared-layout code, and the test now enshrines the asymmetry as intended behaviour. Fix: keep the field-wise comparison and express the rank rule directly, e.g.if a.persistent_workers.len() != b.persistent_workers.len()plus the existing per-field zip, and gate the rank-specific rule where it belongs (ThreadedExecutor::new); or rename topeer_layout_matches_rootand document that it is directional and thatbmust carry no worker.
#6 [medium] F5 abandon skips worker stop for rank 0
Newly reachable path: with a rank-0 worker, ThreadedExecutor::close can fail while peer drain or the local drain fails, taking self.local.abandon(error) (helios/src/execution/threaded.rs:1004-1013):
if result.is_err() {
best_effort_drain_peers(&self.ring, &mut self.peers, self.started, TIMEOUT);
}
let shutdown = match result {
Ok(()) => self.local.close(),
Err(error) => self.local.abandon(error),
};
GraphExecutor::abandon (helios/src/execution/transport.rs:980-990) takes resources and std::mem::forgets them without signalling the worker stop flag:
if let Some(resources) = self.resources.take() {
std::mem::forget(resources);
}
Whereas GraphExecutor::close (transport.rs:1371-1378) stops the worker and counts it into drained. Peer threads do the same on their error path (threaded.rs:685-691 -> executor.abandon(error)), but peers never have a worker.
Impact: when a peer's close/drain fails, rank 0's persistent worker keeps running on its green context and the process retains driver/GPU resources until exit — the documented "retain on failed drain" invariant covers it, so this is acceptable but it means the worker is never asked to stop on that path (no 1u32 release to stop_flag), i.e. a leaked worker spin that also keeps the SM partition busy. Bounded blast radius (process is expected to exit), so Minor; worth a one-line note in the teardown comment or a worker.control.as_ref().map(|c| c.stop()) attempt before forgetting.
File:line: helios/src/execution/threaded.rs:1004-1013, helios/src/execution/transport.rs:980-990.
#7 [low] F6 message drift and implicit validation ordering
Error wording/contracts now differ across sites after this PR; each string is user-visible and tests assert on substrings:
- helios/src/runtime_core/model.rs:128-132 "persistent workers are only supported on rank 0 of a local core"
- helios/src/execution/threaded.rs:632-636 "persistent workers are only supported on rank 0 of a local core"
- helios/src/runtime_core/selection.rs:285-289 "persistent workers are only supported on rank 0" (no "local core", and it also fires for cluster cores because selection has no cluster argument)
- unchanged: helios/src/execution/parallel.rs:122-126 and :552-559 "persistent workers are only supported on single-rank cores"
Docs: docs/runtime-core-design.md:642-644 matches model/threaded; helios/manifest.md:92-95 matches the old text (see F3).
Also note selection.rs's guard cannot distinguish a clustered rank-0 core:
LoadOptions::selecthas no cluster parameter (helios/src/runtime_core/selection.rs:227 iteratescores.iter_mut().enumerate()and only checksrank > 0), so the clustered case is caught later by model.rs:128 only becausevalidate_persistent_worker_topologyruns at model.rs:386 beforeoptions.selectat model.rs:441. Ordering is correct today but implicit — a caller that runsselectfirst (as the unit tests do) would get a green light for a clustered rank-0 worker. Impact: inconsistent operator-facing messages and an ordering dependency between two validation layers that is not documented anywhere; all messages are also asserted verbatim-ish in tests (model.rs:1758-1771, selection.rs:709-720), so unifying them later breaks those assertions. Fix: one shared message constant (or a shared helper) and a note at selection.rs:285 that cluster rejection is model.rs's job and must run first.