Recommendation: Changes Requested
The core mechanism—recording VMM-aliased KV pages on the 1 -> 0 page_snapshot_refs transition in release_snapshot and zeroing coalesced contiguous runs via cuMemsetD8Async across all KV planes before kernel submission or store.fetch—is technically sound, correctly fence-ordered across all verified release_snapshot call sites, and covers both local and pooled host-cache restores. However, the PR cannot merge as-is because it omits mandatory verification gates (verification/helios-lifecycle/check.py, a GPU test exercising enqueue_zero_cache_pages, --release crate tests, and multi-GPU TP verification for the new cross-rank coordination and drain paths), extends the rank-control wire protocol without bumping its handshake version, and omits poisoning GraphExecutor on zeroing failures.
Merge Risk
Level: Medium
- Adds synchronous cross-rank
ZERO_KV_PAGES/ZEROED_KV_PAGESRPCs (parallel.rs) and cross-context peer zero streams with new teardown/drain logic (threaded.rs) that have zero automated test or multi-GPU execution coverage. - Extends the multi-host rank-control wire tag set without bumping
wire::layout()'s version (6), allowing mismatched serving builds to passHELLOhandshake and fail mid-serving on the first snapshot eviction. - Touches
helios/src/server/runtime.rs's main worker loop with six extra flush calls in a heavily contended area (e.g. open PR #705), though no core format, API, or dependency boundaries are altered.
Walkthrough
- Scheduler reclaimed-page tracking (
helios/src/scheduler.rs:669,772,helios/src/scheduler/cache_memory.rs:822-846): Addsreclaimed_snapshot_pages: Vec<u32>populated insiderelease_snapshotstrictly whenpage_snapshot_refs[page]drops1 -> 0(leaving shared pages with refcount>= 1untouched), plustake_reclaimed_snapshot_pages()drain accessor and a CPU unit test (cache_memory.rs:2856-2883). - CUDA context helper & coalesced memset (
helios/src/cuda.rs:1128-1131,helios/src/execution/transport.rs:573,626,1357-1433,1442-1508): AddsStream::with_context, a dedicatedCU_STREAM_NON_BLOCKINGzero: StreamonGraphExecutor::Resources(synchronized inclose()),coalesce_page_runs(sort/dedup/merge/bounds-check), andenqueue_zero_cache_pagesissuingcuMemsetD8AsyncacrossCacheGeometry::planes, with a CPU unit test forcoalesce_page_runs(transport.rs:2163-2180). - Multi-rank executors (
helios/src/execution/ranks.rs:90-97,200-203,helios/src/execution/threaded.rs:833,873-885,1217-1258,1273-1308,helios/src/execution/parallel.rs:99-147,288-328,418-429,747-751,helios/src/execution/parallel/wire.rs:27-28,501-524): Dispatcheszero_kv_pagesacrossLocal,Threaded(overlapping local and per-peerzerostreams underWatchdogCallGuard, draining on clean close andmem::forgeting on poisoned teardown), andParallel(sendingZERO_KV_PAGES = 14, awaitingZEROED_KV_PAGES = 15while processing in-flightREADY/COMPLETEvia extractedapply_peer_message, and handlingZERO_KV_PAGESinserve_rank), plus a wire round-trip/truncation test (parallel/tests.rs:837-854). - Worker flush barriers & admission ordering (
helios/src/server/runtime.rs:1610-1627,1788-1804,1857-1859,1939-1987,2164-2166,3220,3859,3998-4001,helios/src/server/runtime/phase_tests.rs:12250-12396): AddsWorker::zero_reclaimed_kv_pages, flushes reclaimed pages across the worker loop and immediately beforeexecutor.submit(:3220) andstore.fetch(:3998-4001), propagates zeroing failures out ofadmit_with_executoras fatal worker errors, and adds a CPU ordering test asserting["zero", "fetch"]and fetch suppression on error.
Pre-merge Checks
- [PASS] Security / malicious screen: No prompt-injection, credential, or untrusted-input vulnerabilities;
encode_page_ids/decode_page_idsenforceMAX_PACKETand 4-byte alignment, andenqueue_zero_cache_pagesuses checked arithmetic and capacity bounds. - [WARN] Charter & value fit: Targets a real SM103 defect within the supported Goals matrix with zero per-model branches, flags, or core-format changes, and preserves already-exported cores. However, the PR never links open P1 issue #116 (which tracks this exact root cause) and does not explain why SM103 TRT-LLM FP8 FMHA needs runtime-side clearing rather than (or ahead of) a kernel-side V-tail masking fix like SM120 received in #202.
- [WARN] Related / duplicate / conflict check: Not obsolete or superseded (predecessor #181 was closed unmerged for staleness, and no recent commit zeroes released snapshot pages);
helios/src/server/runtime.rsloop edits overlap with open PR #705. - [WARN] Tests & verification evidence: All 4 claimed CPU unit tests exist and verify their narrow CPU invariants, and the 6 full-suite failures (
FLARE_TEST_TEMPLATE_DIR) are confirmed pre-existing and unrelated. However, mandatory TLA+ conformance (check.py),--releasetests, a GPU/CUDA test forenqueue_zero_cache_pages, and multi-GPU TP verification are missing, and the single-GPU GB300 soak was not re-run for this submission.
Blockers
-
Mandatory TLA+ lifecycle conformance (
verification/helios-lifecycle/check.py) was not run (docs/design-review.md:211-215, 234-251).- This PR modifies snapshot alias ownership (
helios/src/scheduler.rs:669,772,helios/src/scheduler/cache_memory.rs:828-846), admission (helios/src/server/runtime.rs:1788-2166, 3856-4001), and rank coordination (helios/src/execution/parallel.rs:99-147, 288-328, 418-429, 747-751;helios/src/execution/threaded.rs:873-885, 1217-1258, 1273-1308). docs/design-review.md:211-215and:234-251makepython3 verification/helios-lifecycle/check.pya non-waivable CPU gate whenever modifying snapshot aliases, admission, or rank coordination ("blocking design failure, regardless of whether CPU unit tests pass"; disclosure does not waive runnable CPU checks).- Fix: Run
python3 verification/helios-lifecycle/check.py(with--tlc-jar) against this branch and report the full pass results in the PR description.
- This PR modifies snapshot alias ownership (
-
Zero automated or current-submission verification of the new CUDA memset path and multi-GPU TP coordination/drain paths (
docs/design-review.md:106-115, 180-187, 252-259;AGENTS.md:194-199).- All four added tests run under
CUDA_VISIBLE_DEVICES=""and exercise only CPU helpers/wire codec/closure ordering. Nothing in the test suite executesenqueue_zero_cache_pages(helios/src/execution/transport.rs:1469-1508),Stream::with_context(helios/src/cuda.rs:1128-1131),ThreadedExecutor::zero_kv_pages(helios/src/execution/threaded.rs:1217-1258), orTensorParallelExecutor::zero_kv_pages/serve_rankhandling ofZERO_KV_PAGESinterleaved with in-flightREADY/COMPLETEmessages (helios/src/execution/parallel.rs:288-328, 747-751). - In addition, the reported GB300 soak runs were single-GPU and, per
Validation limits, not re-run for this submission; the reportedcargo testrun was debug-profile and filtered rather than--release(docs/design-review.md:180-187); anddocs/design-review.md:252-259requires an explicit before/after happens-before analysis plus live multi-GPU collective execution for changes altering cross-rank coordination and drain paths inparallel.rs/threaded.rs(new blockingZERO_KV_PAGESRPC withapply_peer_messageconsumption, cross-context peer zero streams, andThreadedExecutor::close()drain/poison teardown). - Fix:
- Add an
#[ignore]CUDA test (matching the existing GPU test pattern inhelios/src/cuda.rs/helios/src/runtime_core/cache_memory.rsand predecessor #181) that writes non-zero (0x7F/0xFF) bytes through a VMM-aliased snapshot row, runsenqueue_zero_cache_pages/zero_kv_pages, and verifies reclaimed pages are zeroed across all planes while live aliased pages remain byte-identical. - Add a CPU test exercising
TensorParallelExecutor::zero_kv_pages+serve_rank(orapply_peer_message+ZEROED_KV_PAGESloop) with interleavedREADY/COMPLETEmessages beforeZEROED_KV_PAGES. - Run
cargo test --locked --releaseonhelios(--features runtime-core,server), provide the cross-rank happens-before analysis forZERO_KV_PAGESandThreadedExecutor::close(), and run live multi-GPU TP verification (or, if TP scope is unnecessary/untestable on available hardware, explicitly coordinate scope with maintainers rather than shipping unverified TP code).
- Add an
- All four added tests run under
Should Fix
-
Bump the rank-control handshake protocol version for the new wire tags (
helios/src/execution/parallel/wire.rs:27-28, 185-196,helios/src/execution/parallel.rs:179-189, 747-752,docs/multi-host.md:24-26).- Adding
ZERO_KV_PAGES = 14andZEROED_KV_PAGES = 15without incrementingwire::layout()'s leading protocol version (6atwire.rs:188, asserted athelios/src/execution/parallel/tests.rs:229) allows a patched rank zero and an unpatched peer to passHELLOhandshake (parallel.rs:185) and then fail mid-serving on the first snapshot eviction with"unexpected rank command"(parallel.rs:752), contradictingdocs/multi-host.md:24-26("Serving builds must agree on the rank control protocol version"). - Fix: Bump the leading protocol version in
wire::layout()(wire.rs:188) from6to7(matching predecessor #181), updateparallel/tests.rs:229, and verify incompatible builds are rejected duringHELLO.
- Adding
-
Poison
GraphExecutorwhen KV page zeroing fails (helios/src/execution/transport.rs:1357-1391).TensorParallelExecutor::zero_kv_pages(parallel.rs:324-326) andThreadedExecutor::zero_kv_pages(threaded.rs:1253-1255) both recordself.poison = Some(error.clone())on error, matchingGraphExecutor::submit(transport.rs:1158) andGraphExecutor::poll(transport.rs:1187-1296). In contrast,GraphExecutor::enqueue_zero_kv_pages(transport.rs:1357-1377) andGraphExecutor::zero_kv_pages(transport.rs:1386-1391) checkself.poisonon entry (:1361) but never setself.poisonifcoalesce_page_runs,cuMemsetD8Async, orcuStreamSynchronizefails. On single-GPU (RankExecutorInner::Local), a partial async memset failure or sync error leavesGraphExecutorun-poisoned, allowing subsequent calls to proceed and dropping the root error fromShutdown.errorinclose()(transport.rs:1424).- Fix: Record
self.poison = Some(error.clone())on failure inenqueue_zero_kv_pagesandzero_kv_pages(changingsync_zero_kv_pagesto&mut selfor poisoning around the call inzero_kv_pages).
Subtract / Simplify
- Consolidate the 8
zero_reclaimed_kv_pagesflush sites inhelios/src/server/runtime.rs(:1618, :1622, :1624, :1626, :1858, :2165, :3220, :3998-4001) down to the 2 actual GPU-ordering barriers.- Every GPU read/write of a newly allocated KV page goes through either
store.fetch(runtime.rs:4005) orexecutor.submit(runtime.rs:3271). Removing the 6 intermediate flushes (:1618, :1622, :1624, :1626, :1858, :2165) reduces loop noise and merge conflict surface with #705, eliminates theOption<&mut RankExecutor>plumbing inadmit_with_executor(:1796-1804, :1857, :2164) by passing only the zeroing closure, and avoids issuing up to 6 separate synchronous cross-rankZERO_KV_PAGESnetwork round-trips +cuStreamSynchronizecalls within a single worker tick when multiple events release snapshots before one submission.
- Every GPU read/write of a newly allocated KV page goes through either
- Gate the dedicated
zeroCUDA stream on cache/alias presence (helios/src/execution/transport.rs:573,626,1403,helios/src/execution/threaded.rs:875-880).- Currently
Stream::opencreates an extraCU_STREAM_NON_BLOCKINGstream on everyGraphExecutorand every cache-owning peer even whenmanifest.cacheisNoneorcache.snapshot_pages.is_empty()(wherereclaimed_snapshot_pagesis never populated). StoringOption<Stream>gated oncache.is_some_and(|c| !c.planes.is_empty() && !c.snapshot_pages.is_empty())avoids allocating and draining unused streams on non-aliasing cores.
- Currently
- Deduplicate
coalesce_page_runsand unify the enqueue/sync predicate inThreadedExecutor::zero_kv_pages(helios/src/execution/threaded.rs:1229-1245,helios/src/execution/transport.rs:1357-1391,1469-1476).ThreadedExecutor::zero_kv_pagescurrently sorts and allocatespages.to_vec()once per peer plus once for local (ranks + 1times) and uses two different emptiness guards (local_enqueuedvs!cache.planes.is_empty()). Coalesce once, validate the max page against each rank'spage_capacity, and returnResult<bool>fromenqueue_zero_cache_pagesso local and peer sync paths share one uniform predicate.
Nits
- Link
Fixes #116(orRefs #116) in the PR description and add a brief note on why SM103 TRT-LLM FP8 FMHA requires Helios-side zeroing alongside SM120's kernel-side masking decision in#202. - Label
~27 µsin the PR description as an analytical HBM3e bandwidth estimate (~212 MiB / 8 TB/s) rather than a measured figure. - Releasing never-populated snapshot reservations (e.g., unused
anchor_guardor refundedcheckpoint_capture) also queues their aliased pages (scheduler/cache_memory.rs:828-832); this is safe and conservative, and only worth gating on acapturedflag if cancel/refund overhead ever shows up in profiling. - Consider whether
Stream::open_lowest_priority(helios/src/cuda.rs:809) is preferable to default priority for thezerostream so memsets yield to concurrently executing model streams.
Dropped on verification
- Dead deadline guard in
TensorParallelExecutor::zero_kv_pages(helios/src/execution/parallel.rs:306-321): False. Verified directly inparallel.rs:307thatlet deadline = std::time::Instant::now() + TIMEOUT;is initialized once per peer outsideloop {, not re-armed on each iteration; a peer floodingREADY/COMPLETEmessages pastTIMEOUTproperly trips:317-319. - Uncovered pool-tier host-restore DMA path (
helios/src/server/runtime.rs:3687-3770): False. Verified inruntime.rs:3692,selene/src/pool/client.rs:250-273, andselene/src/pool/store.rs:544-576thatbegin_pool_lookup/issue_pool_lookuponly issues a metadata lookup (store.begin_lookup) with zero KV page allocation and zero GPU DMA; both local and pooled restores initiate GPU DMA exclusively viastore.fetch(hit, ticket)atruntime.rs:4005, strictly after thezero_kv_pages(&reclaimed)?barrier atruntime.rs:3998-4001. - Open risk that
RequestScheduler::cancel(helios/src/scheduler.rs:3412) zeroesanchor_guardpages still in use by an in-flight GPU step: Verified safe.anchor_guardis strictly an unused pre-reserved snapshot row (helios/src/scheduler/checkpoints.rs:142-167, 1045-1085); once armed for a GPU capture (:1046), it is.take()n out ofanchor_guardintocheckpoint_capture, which is fence-deferred inRetiredRequest.snapshots(scheduler.rs:3447) and only released inadvance_retirement(scheduler.rs:3234-3241). - Missing blocking cross-rank
coordinate_stepbarrier CPU test (docs/design-review.md:189-194): Dropped.coordinate_step_commits_peers_before_blocking_local_collective_launchalready exists athelios/src/execution/threaded.rs:2733and this PR does not altercoordinate_steporcommit_and_launch. - Downgrade out-of-range reclaimed page IDs from fatal to skipped (
helios/src/execution/transport.rs:1452-1456): Dropped. An out-of-range page ID indicates scheduler/cache-geometry corruption; failing loudly rather than silently skipping aligns withAGENTS.md:184. - Fold
Stream::with_contextinsideStream::memset_d8_async(helios/src/cuda.rs:1128-1131): Dropped.Driver::with_context(cuda.rs:358-376) executescuCtxGetCurrentand potentially twocuCtxSetCurrentcalls; wrapping once per rank around theplanes × runsloop inenqueue_zero_cache_pages(transport.rs:1477-1507) avoids per-memset context-switch overhead. - Rewrite
wire::encode_page_ids/decode_page_idswithnumber/Reader(wire.rs:501-524), deduplicaterelease_snapshotwith the test-only quote oracle (cache_memory.rs:1466-1476), or reuseOrderStoreinphase_tests.rs:12254-12293: Dropped as low-value churn (wire.rsraw packedu32framing is already minimal and length-checked by the packet header;cache_memory.rs:1466-1476is a pure test oracle with no reclaimed-page queue;OrderStorewrapsMemoryStore, notFakeStore). - Claim that
runtime.rs:2165duplicates:1626insideself.plan(): Dropped as inaccurate (:2165sits at the end ofadmit_with_executor, notplan()); the broader consolidation to the 2 actual GPU barriers is retained in## Subtract / Simplify. - 6 full-suite test failures (
FLARE_TEST_TEMPLATE_DIR) and unobservable CI checks: Dropped as pre-existing fixture omission outside touched files.