Recommendation: Changes Requested
All Round 1 findings are cleanly resolved at c9df77b — complete_io now preserves io_uring SQ FIFO order via remove(pos) with a regression test, RankWedgeWatchdog::CloseStalled now tracks activity across close() stages, best_effort_drain_peers sweeps peers round-robin against a shared deadline, and all 3 simplifications and 4 nits were addressed. However, verification at c9df77b identified two concrete edge-case code defects — one in the rewritten best_effort_drain_peers loop (where Ok(Err(_)) triggers an unbounded thread.join() while a peer is still inside drain_outstanding_frames) and one in AsyncTransfer's cuEventQuery-fault path (which drops host_mirror_on_drain instead of propagating HostOnly completions on clean stream drain) — plus the mandatory live multi-GPU re-run for modified threaded.rs drain paths (docs/design-review.md:252-259). Fixing both small defects and re-running the existing SM120 PCIe TP4 flare run + SIGTERM check on the final commit will make this ready to merge.
Merge Risk
Level: Medium
- The Round 1 High-risk
swap_removeCQE-drop bug and fixed-wall-clockCloseStalledabort are fixed and covered by unit/conformance/mutation tests. - On a multi-peer validation failure with an in-flight frame,
best_effort_drain_peerscan still block unboundedly inthread.join()after readingOk(Err(_))from a peer still insidedrain_outstanding_frames, starving healthy peers and riskingCloseStalledprocess abort. - On a
cuEventQueryerror followed by cleancopy_streamdrain for a hardware-signaled DMA withdevice_completions_base != 0,host_comp[slot]is never updated becausehost_mirror_on_drainis hardcoded toNone.
Walkthrough
- Round 1 Blocker fixed (
helios/src/async_transfer/scheduler.rs:583-585,1128-1175): Replacedswap_remove(pos)with orderedremove(pos)incomplete_iosoinflight_iostays synchronized with kernelio_uringSQ FIFO order across partial submits; addedpartial_flush_preserves_sq_fifo_order_across_completions. - Round 1 Should-Fix items addressed (
helios/src/execution/threaded.rs:679-693,1216-1358,4152-4272):CloseStallednow resetsclose_sincewheneveractivityadvances acrossclose()/close_peers/best_effort_drain_peersprogress marks;best_effort_drain_peersnow polls all live peers round-robin via non-blockingtry_recv()against a single shared deadline (with one remainingOk(Err(_))join bug noted below). - Round 1 Simplifications & Nits applied (
helios/src/runtime_core/{mod,model}.rs,helios/src/async_transfer/{io_backend,worker}.rs,docs/api.md): DeletedRankWedgeWatchdog::stop_and_joinand the unreachable duplicateprepare_async_transferspeer-copy check; consolidated interval building (storage_intervals) and single-passpeer_refscaching; checked both(i, j)and(j, i)inall_nvlink_p2p; boundedflush_queued_sqesEINTRretries toMAX_EINTR_RETRIES = 16; removed unusedAsyncTransferRuntime::rank(); documented globalrankID labels indocs/api.md:403-405and explicitstd::process::abort()behavior in the PR description.
Pre-merge Checks
- [PASS] Security / malicious screen: Clean; no suspicious network/exfiltration/unsafe-boundary issues, and payload scanning reads already-authenticated bytes.
- [PASS] Charter & value fit: Directly resolves reproducible P1 bug #722 on SM120 PCIe with topology-derived gating, no per-model branches, and no wire/core-format or captured-graph op-contract changes.
- [WARN] Related / duplicate / conflict check: Same-day follow-up to #721; sibling open PRs #726/#723 touch
prepare_async_transfers/release_execution_resourcesand should be serialized if merged alongside #727. - [WARN] Tests & verification evidence: TLA+ conformance/mutations (
check.py (not opened) --mutations), targeted Rust suites (50/50,0warnings), and single-GPUlive_cuda_async_transfer_end_to_endwere re-run onc9df77bd, but the live SM120 PCIe TP4flare runcheck is dated224fb403(prior to thebest_effort_drain_peers/close_peerschanges inc9df77bd, whereasdocs/design-review.md:252-259requires live multi-GPU execution for modifiedthreaded.rsdrain paths).
Blockers
None.
Should Fix
-
best_effort_drain_peerstreatsOk(Err(_))as thread exit and calls unboundedthread.join()while a peer may still be insidedrain_outstanding_frames(helios/src/execution/threaded.rs:1319-1340,1540-1555,913-919)- Verified behavior: When a peer fails
validate_submission(threaded.rs:1540-1555), it sendsreplies.send(Err(error.clone()))at1543before callingdrain_outstanding_frames(..., TIMEOUT)at1545-1554(which can block up to120 sor wedge insideexecutor.poll()). Inbest_effort_drain_peers(1319-1336),Ok(Err(_))setsexited = trueand immediately callsthread.join()without a deadline — starving subsequent healthy peers from being polled/joined within the shared deadline and allowingCloseStalledto abort the process. By contrast, every real error-exit path (901,916) returns immediately and dropsreplies, producingErr(mpsc::TryRecvError::Disconnected), and clean drain sendsReply::Drainedonly afterexecutor.close()returns (1375-1382). - Fix: Only treat
Ok(Ok(Reply::Drained)) | Err(mpsc::TryRecvError::Disconnected)asexited = true. MoveOk(Err(_))into theOk(Ok(_)) | Ok(Err(_)) => { made_progress = true; continue; }arm so a peer that already exited after sendingErrimmediately hitsDisconnectedon the nexttry_recv()iteration and joins, while a peer still draining indrain_outstanding_framesdoes not block the round-robin sweep. Add a regression test where peer 0 sendsErr(...)while remaining blocked and peer 1 sendsReply::Drained.
- Verified behavior: When a peer fails
-
cuEventQuery-fault path hardcodeshost_mirror_on_drain: None, leavinghost_compstale after clean stream drain (helios/src/async_transfer/worker.rs:1031-1066,1143-1149,1164-1192)- Verified behavior: When
args.use_write_value64 && args.config.device_completions_base != 0, a hardware-signaled DMA storescompletion_action: EventCompletionAction::HostOnly(slot, dma.signal_value)inPendingEventDma(1143-1149,1164-1174). OncuEventRecordfailure (1180-1192),worker_mainextractshost_mirror_on_drainfromcompletion_actionsoupdate_host_comp(slot, val)advances the mapped-host mirror whencuStreamQuery(copy_stream) == 0(1057-1059). However, oncuEventQueryfailure (1039-1044),UntrackedFaultedDmais constructed withhost_mirror_on_drain: None, droppingdone.completion_actionso host-side readers pollinghost_comp[slot]never observe completion even aftercopy_streamdrains cleanly. - Fix: Compute
host_mirror_on_drainfromdone.completion_actionatworker.rs:1039-1044using the sameEventCompletionAction::HostOnly(slot, val) if done.hardware_signaled => Some((slot, val))match (or a small helper shared with1180-1185).
- Verified behavior: When
-
Re-run live SM120 PCIe TP4 serving +
SIGTERMverification on the final commit (docs/design-review.md:252-259)- Verified behavior:
docs/design-review.md:252-259requires live multi-GPU execution of real collective graphs (e.g., serving a multi-GPU exported core viaflare run) when replacing or reordering drain paths inhelios/src/execution/threaded.rs. The PR's live TP4 run is from224fb403, prior toc9df77bd's changes tobest_effort_drain_peersandclose_peers. - Fix: After applying fixes (1) and (2) above, re-run the existing SM120 PCIe TP4
flare run+SIGTERMcheck on the final head and record the commit hash and result in the PR description.
- Verified behavior:
Subtract / Simplify
- Reuse
merge_sorted_intervals(helios/src/runtime_core/mod.rs:151-163vshelios/src/runtime_core/host.rs:62-70): Both implement the identical sort-and-merge loop overVec<(u64, u64)>; makingmerge_sorted_intervalspub(super)letshost.rsdelegate to it. - Replace
format_json_vec(helios/src/async_transfer/lifecycle_tests.rs:51-57) withformat!("{v:?}"):[i64; 16]'sDebugrepresentation produces identical JSON array output without maintaining a 16-placeholder format string across future projection changes.
Nits
None.
Dropped on verification
- Upstream Code Correctness Finding 2 (
queued_sqes/cancel_and_drainSQE desync,io_backend.rs:224-264,worker.rs:1224-1292): False positive.cancel_and_drainruns only once at shutdown (worker.rs:1284-1286) after the main loop exits and no further read SQEs can be pushed. BecauseAsyncCancelSQEs are appended strictly behind any remaining read SQEs in the FIFOio_uringSQ ring ([Read_1..Read_k, Cancel_1..Cancel_m]), submittingsSQEs always consumesmin(k, s)read SQEs first, soqueued_sqes.saturating_sub(submitted)remains exact. - Upstream Subtraction B3 (replace all 4
ring.submit()calls incancel_and_drainwithself.flush()): Dangerous false positive.io_backend.rs:252is a timed CQE wait (submit_with_args), and lines227, 234, 262must submitAsyncCancelSQEs even whenqueued_sqes == 0; callingself.flush()(which loopswhile *queued_sqes > 0) would silently skip submitting cancellations. - Upstream Code Correctness Finding 5 (
cleanup_failed_startupunboundedjoin()without watchdog,threaded.rs:1416-1447): False positive.cleanup_failed_startupwaits forReply::DrainedviaPeer::receive(), which enforcesTIMEOUT(120 s,threaded.rs:788-791), anddrain_rankonly sendsReply::Drainedafterexecutor.close()returns (1375-1382); a wedged close times out inpeer.receive()beforethread.join()is called. - Upstream Code Correctness Finding 6 (
best_effort_drain_peersmade_progress = true; continue;busy-spin;unflushed_io_count()O(N) scan): False positive / non-defect. Each peer has at most 2 in-flight frames, so draining bufferedReply::Completemessages finishes immediately and falls through toEmptyand the 1 ms sleep;unflushed_io_count()scans at mostDEFAULT_MAX_TOTAL_IO = 32entries (worker.rs:46). - Upstream Code Correctness Finding 4 (
all_nvlink_p2preturningfalsewhen NVML is unavailable): Intentional fail-safe behavior — failing open on unknown P2P topology would risk reintroducing #722 in containers lackinglibnvidia-ml.so. - Upstream Dossier §B4 (
self.local.close()synchronizing without progress marks): Intended behavior — detecting a CUDA driver hang insideself.local.close()is the purpose ofWedgeReason::CloseStalled. - Upstream Dossier §C4 (
load_preparednot callingvalidate_async_transfer_peer_copy_compatibility): Non-issue —load_prepared(mod.rs:510-532) never callsprepare_async_transfers, whose sole caller isNativeModel::load(model.rs:1046), which enforces the check atmodel.rs:935. - Upstream Subtraction A2 (
peer_refs: Option<...>), B2 (stop_rank_workers), B4 (WatchdogCallGuard::enterkeep_busy), B5 (contains_interval_address): Dropped —peer_refsdirectly implements Round 1's caching suggestion;stop_rank_workersandWatchdogCallGuard::enter'skeep_busy(required for early returns insubmit()atthreaded.rs:1071-1088) were already verified and dropped in Round 1; replacingchunks_exact(8)with a strided loop degrades payload-scan optimization.