Opened by a workflow run, Dec 3, 2026 2:40 PM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: lukealonso (COLLABORATOR; charter-named priority contributor and the project owner named in docs/design-review.md as the approver of new captured-graph op contracts; 42 merged PRs in 180 days; Discord: lukealonso) Motivation: Captured CUDA graphs cannot do host direct-I/O reads, pin host memory, size device byte pools at load, or run non-blocking Copy-Engine transfers with stream-ordered completion, so models whose weights exceed one GPU's VRAM cannot stage weight bytes inside a captured graph. This adds that transport primitive to Helios (plus two operator pool-size limits and some Ignition capture-seeding fixes) so external model recipes can do tiered weight caching without model-specific code in the runtime. Scale: +6,387 / −72 lines in 57 files Proposal:
- New
helios/src/async_transfer/subsystem (~3,780 lines): per-channel host worker, mapped-host SPSC command ring (ABI v1), io_uringO_DIRECTreads, Copy-Engine host→device copies,cuStreamWriteValue64completions, DEMAND/PREFETCH/WARM scheduling with epoch cancel, bounded 5 s drain. - Additive Protobuf:
Capacity::DEVICE_POOL = 2(runtime_core.proto:781),Execution.async_transfers = 9(runtime_core.proto:837-862),RankBody.external_extents = 18(core.proto:176-186); Python in-process execution refuses non-empty channels. - Load-time VRAM accounting: 256 MiB margin + 2 MiB/GiB of registered pinned host RAM reserved before DEVICE_POOL/KV sizing; pool size is rank-min;
Execution.buffersviews rewritten tofloor(bytes/row_bytes)rows. - New
--pool-vram-memory/--pool-ram-memory+[memory] pool_vram/pool_ram(flare-cli/src/cli.rs:945-963), forwarded in rank_options; newflare_async_transfer_*Prometheus family. - Ignition capture seeding (
_seed_auxiliary_workspaces,_seed_library_device_caches,retain_transient_backingspan) plus AsyncTransfer.tla/.cfg, conformance harness and four Kani proofs. Touches: helios/src/async_transfer/+helios/src/runtime_core/{memory,mod,protobuf}.rs(new captured-graph contract and load-time memory accounting)helios/proto/{core,runtime_core}.proto+heliopause/src/export/*(signed core-format surface, exporter hard failures)ignition/preparation/capture.py(transient/persistent workspace seeding, overlaps open #606) Related items:- #430 Add Execution.persistent_workers green-context lifecycle (merged): structural precedent; the same contract got an explicit "Approved, including Principle 1 approval" note — #711 has no equivalent.
- #606 fix(ignition): seed warmup workspaces inside export storage pool (open): fixes the same transient-workspace seeding bug in the same
capture_forwardsregion. - #664 single-plane BF16 / identity-indexed offloaded embedding table (open): same need class (weights exceeding VRAM), model-specific approach.
- #554 DRAFT engram RDMA READ row cache (open): the "big table doesn't fit" case (#193), different layer.
- #709 / #659 / #694 / #597 / #658 (open): concurrent churn in
runtime_core/memory.rsandtests/preparation/test_transient_retention.py(not opened). Link: https://github.com/NVIDIA/hyperflare-inference/pull/711 Autobot comments: Introduces a new captured-graph operation family and a new signed core payload class — exactly the case docs/design-review.md:22-26 reserves to owner approval, and the case yatesdr challenged on #430; here approval is implicit (author is the named owner) and there is no reviewer at all. No linked issue, bug, field report, roadmap item, recipe, consumer or benchmark; all measured numbers and test tallies are self-reported, CI is pending, and TP>1/cross-node/SM103/SM121/Windows are untested. Undeclared: rank-min pool sizing with silent buffer-shape rewrite, exporter hard-fails, no docs for the new metrics, and a drive-by flare.1 man-page test. Overlaps open #606 on capture.py. Diff tooling against the stale base over-attributes newer-main work (e.g. thecache_memory.rsrewrite); the PR adds exactly one line there.
Value Proposition
Value Proposition — PR #711 (AsyncTransfer, runtime-sized device pools, capture cache seeding)
1. Charter alignment
The shape of the change is charter-correct: one domain-agnostic transport primitive in Helios instead of per-model offloading layouts or flags — exactly the "keep the runtime small and model-agnostic" rule (#267, #334) — and it follows the house pattern for new concurrency (bounded TLA+ spec + Rust conformance harness + Kani proofs, as in #430/#613/#595). Two gates are unmet:
- Captured-graph op contract approval.
Execution.async_transfers(field 9) with four new host-driven opcodes is precisely whatdocs/design-review.md:22-26reserves to explicit owner approval; none is recorded, and there is no reviewer at all. #430 shows the required form: yatesdr asked, lukealonso answered "Approved, including Principle 1 approval…". A design acknowledgment would not suffice; there isn't even one here. - "What gets merged" / "Bring real evidence." No issue, bug, roadmap item or user report is linked; five searches return only #711. There are no Helios service measurements — whole-model recipes and served throughput are explicitly deferred, leaving self-reported TLC/Kani/test tallies and one hand-measured 2.00 MiB/GiB figure, with CI pending. The need class is real (#664, #554) but those are different solutions at different layers, and nothing in-tree produces
external_extents: the new core-format surface ships with no consumer.
2. Novelty & status
Genuinely additive: nothing competes (items_touching("helios/src/async_transfer") → only #711), nothing is obsoleted, and the proto additions are backward-compatible by construction. Caveat: Execution/RankBody field numbers and memory.rs are among the busiest surfaces in the repo (open #483/#664/#229/#314/#334; #709/#694/#659/#314), so landing is a coordination problem. The capture-seeding third is not additive: #606 (open, avifenesh) fixes the same transient-workspace defect in the same capture_forwards region, on top of merged #331 — textual conflict likely, semantic duplication plausible.
3. Value vs maintenance cost
Beneficiaries are recipe authors who must exceed single-GPU VRAM, and none exists yet. Cost is ~3,780 new lines of concurrency, a pinned-host VRAM reserve subtracted before pool/KV sizing, a silent rank-min clamp that rewrites Execution.buffers to floor(bytes/row_bytes) rows, an undocumented flare_async_transfer_* metric family, and untested TP>1 — the most material gap given the "larger than one GPU" motivation.
Verdict
Worth it with changes. Split out the capture-seeding fix (reconcile with #606 or drop it here); for the transport half, record Principle 1 approval, land one in-tree consumer that emits an extent directory, and attach a flare run served measurement covering SM120/SM121 and TP>1 before merge.
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:design-review, enhancement, area:memory, area:preparation
Threshold: 65%
Triage
- [✓]
triage:design-review: 75.4% -
triage:review: 24.5% -
triage:validation: 0.1% -
triage:investigate: 0.0% -
none: 0.0% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:superseded: 0.0% -
triage:verify-for-closure: 0.0%
Priority
-
none: 100.0% -
priority:P1: 0.0% -
priority:P2: 0.0%
Type
- [✓]
enhancement: 98.8% -
performance: 62.2% -
community: 46.9% -
duplicate: 37.8% -
bug: 11.9% -
documentation: 0.1%
Area
- [✓]
area:preparation: 86.7% - [✓]
area:memory: 73.1% -
area:api: 37.8% -
area:caching: 22.3% -
area:packaging: 8.5% -
area:selene: 4.7% -
area:kernels: 1.6% -
area:engram: 0.9% -
area:scheduling: 0.7% -
area:rocenante: 0.5% -
area:orbit: 0.1%
Model
-
model:deepseek-v4: 1.6% -
model:qwen3.8-flash-next: 1.0% -
model:deepseek-v4.1: 0.2% -
model:glm-5.3: 0.2% -
model:kimi-k3.1: 0.2% -
model:gemma4: 0.2% -
model:nemotron-3.5-bolt: 0.1% -
model:qwen3.8-27b: 0.1% -
model:inkling-small: 0.1% -
model:muse-glimmer: 0.1% -
model:mimo-v2.6: 0.0%
Apply Labels (Intake)
Applied: +triage:design-review, +enhancement, +area:memory, +area:preparation
Subtraction and simplicity
Subtraction & Simplicity audit — PR #711 (head 6916f22, 57 files, +6,387/−72)
Not lean. The new AsyncTransfer runtime is densely commented and mostly well-factored at the module level, but it ships one whole duplicated config type, one dead public helper, one parameter set that recomputes its own input, a duplicated verbatim sizing expression, a duplicated /proc/meminfo parser, and three out-of-scope drive-bys. Each item below is a concrete deletion, with the number of lines it recovers.
High value
1. PoolMemoryLimit is a near-verbatim clone of MemoryLimit — delete it (−~75 lines)
helios/src/runtime_core/limits.rs:42-48 and :132-137 are the same three-variant enum:
pub enum MemoryLimit { Bytes(u64), Reserve(u64), Fraction(f64) } // :44
pub enum PoolMemoryLimit { Bytes(u64), Reserve(u64), Fraction(f64) } // :133
The FromStr bodies are the same parser twice (:70-105 vs :159-193, identical invalid closure, strip_prefix('-'), alphabetic-suffix branch, fraction branch), differing only in that the pool version skips the "must be positive" rejection of 0 (:167-169). validate is the same shape with one different message (:51-59 vs :140-147). And Display already delegates to the other type:
Self::Bytes(bytes) => write!(f, "{}", MemoryLimit::Bytes(*bytes)), // :199
Self::Reserve(bytes) => write!(f, "{}", MemoryLimit::Reserve(*bytes)), // :200
One enum plus validate(allow_zero: bool) / parse(allow_zero: bool) covers both, and the duplicated test pairs (:210-267) collapse into one table. Related: MemoryLimit::occupied_bytes (:61-67) and PoolMemoryLimit::cap_bytes (:150-156) are the same function with the Reserve arm split out — occupied_bytes returning Option and its callers re-matching Reserve by hand (memory.rs:287, :356) is the reason both exist.
2. prepare_async_transfers takes 3 parameters that recompute its 1 useful parameter — delete the parameters (−~10 lines, one less place to diverge)
helios/src/runtime_core/memory.rs:78-83 computes the host cap during planning:
let cap = match pool_ram_limit {
Some(limit) => limit
.cap_bytes(host_ram_available, host_ram_total)
.min(host_ram_available),
None => host_ram_available,
};
and that exact expression is recomputed verbatim in the allocator, helios/src/runtime_core/mod.rs:1477-1481:
let mut remaining_host = match pool_ram_limit {
Some(limit) => limit.cap_bytes(host_ram_available, host_ram_total).min(host_ram_available),
None => host_ram_available,
}
.min(planned_host_cap);
Since planned_host_cap is cap (memory.rs:99-102 returns it, model.rs:963/:971 threads it through), the .min(planned_host_cap) makes the recomputation a no-op. Replace the body with let mut remaining_host = planned_host_cap; and NativeResources::prepare_async_transfers (mod.rs:1462-1470) drops host_ram_available, host_ram_total, pool_ram_limit; model.rs:961 (async_transfer_host_ram) then serves planning only, and model.rs:963-971 loses a parameter pass-through. Same for memory.rs:1170-1171, which re-maps pool_vram_limit per rank even though cap_bytes has no per-rank variance (it is a pure function of available/total and the limit).
3. io_backend::open_direct_backend is dead and duplicates the caller's platform dispatch (−18 lines)
helios/src/async_transfer/io_backend.rs:284-301 defines the canonical constructor:
pub fn open_direct_backend(files: &[File]) -> io::Result<Box<dyn IoBackend>> {
…and nothing calls it. A repo-wide search finds the identifier only at its own definition. The production path instead re-implements the identical #[cfg(target_os = "linux")] / #[cfg(not(…))] split inline at helios/src/runtime_core/mod.rs:1572-1588:
#[cfg(target_os = "linux")] { Box::new(... IoUringBackend::new(opened_files) ... ) }
#[cfg(not(target_os = "linux"))] { Box::new(... PreadBackend::new(opened_files)) }
Delete one of the two. Deleting the helper is cheapest; deleting the inline block and calling the helper is better (it also moves the O_DIRECT reopen crate::os::direct_reopen — which the inline path never applies — into one place, i.e. the extracted opened_files at mod.rs:1503-1517 are currently not O_DIRECT-reopened, unlike what the helper does; a behavioural divergence hiding behind the duplication).
4. The meminfo MemTotal: parser is copied — selene::offload already owns it (−15 lines, one cfg)
helios/src/runtime_core/memory.rs:41-53:
#[cfg(unix)]
let host_total = std::fs::read_to_string("/proc/meminfo")
.ok()
.and_then(|info| { info.lines().find_map(|line| { let rest = line.strip_prefix("MemTotal:")?; ... }) })
.unwrap_or(host_available);
selene/src/offload.rs:983-993 already parses the same field, with the same parse::<u64>()/checked_mul(1024) logic, inside host_pool_budget_with_reserve, next to available_memory (:959-971) which parses MemAvailable. memory.rs already imports from that module four lines later (use flare_selene::offload::host_reserve_bytes; at :107). A public host_memory() -> Result<(available, total)> in selene::offload removes the second parser and the unix/not(unix) fork at :52-53.
5. max_bg_io / max_bg_dma are configuration fields whose only production value is 0 (−~10 lines)
helios/src/runtime_core/mod.rs:1602-1603 is the only construction of a production ChannelConfig, and it hardcodes:
max_bg_io: 0,
max_bg_dma: 0,
which ChannelConfig::default_bg_caps (worker.rs:70-79) immediately replaces with the constants. The fields exist solely so unit tests can lower the caps (worker.rs:1180-1181, :1351-1352, lifecycle_tests.rs:67-76 (not opened)). TransferScheduler::new (scheduler.rs:151-179) already takes them explicitly — so the test seam belongs there, not on the exported ChannelConfig (worker.rs:54-68) which is part of async_transfer's public re-exports (mod.rs:30). Either drop the two fields and have worker_main use DEFAULT_MAX_BG_IO/DMA (worker.rs:622-628), or gate them #[cfg(test)].
Medium value
6. Opcode::CancelEpoch => unreachable!() is created by validate-then-match (−2 lines, one panic path)
helios/src/async_transfer/ring.rs:369-375 early-returns ValidatedCommand::CancelEpoch before the priority/alignment work, so the later dispatch match must carry dead arm :463:
Opcode::CancelEpoch => unreachable!(),
One match over all four opcodes, where the cancel arm does its own bounds work, removes both the duplicate decoding and the panic. validate_command is the module's central safety gate (:348-350 "No disk I/O or CUDA DMA may be issued unless this function returns Ok(_)"), so it is the last function that should contain an unreachable branch.
7. validate_extent_entry's segment_index/segment_count bounds check is unkillable in its only caller (−4 lines)
helios/src/async_transfer/ring.rs:302:
if segment_index >= segment_count || nbytes == 0 {
The sole caller (:500-503) does segments.get(seg_idx as usize).ok_or_else(...) immediately before, so seg_idx < segments.len() == seg_count is already proven; the check and two of its six parameters (:291-298) can only ever be true for Kani. Keep the overflow/alignment checks, drop the index/count pair (or keep the helper const-only for the proof, not on the loader path).
8. Triple parse of pool_vram/pool_ram across three config surfaces (−~20 lines)
The same nonempty(...).map(parse::<PoolMemoryLimit>).transpose()? block is written three times:
flare-cli/src/config.rs:81-98(memory.pool_vram,memory.pool_ram)flare/src/configuration.rs:92-101(not opened) (identical, different error prefix)flare/src/runtime_settings.rs:114-119(if !…trim().is_empty() { base.pool_vram_limit = Some(…parse::<PoolMemoryLimit>()?); })
plus the identity plumbing duplicated field-for-field in flare/src/runtime_settings.rs:18-19, 41-42, 91-92, 181-182, 198-199. One fn parse_pool_limit(name: &str, value: Option<&str>) in limits.rs (it already owns FromStr and the error text) collapses all three call sites and their three message formats.
9. The "channels require native core serving" refusal is a verbatim string in three places
ignition/preparation/execution.py:461-465 (not opened) and :484-488, and ignition/preparation/model.py:99-101 (not opened), all raise:
"async transfer channels require native core serving (export a core and serve with flare run)"
plus the mirrored Rust check at heliopause/src/python.rs:311-322 (not opened). Two guards inside one class (PreparedExecution.start_executor and .serve) that already share self.async_transfers should collapse into one _reject_async_transfers() (or one module constant), so the message can only ever be changed in one place.
10. Two flat_map passes materialise every snapshot twice for one summary line
helios/src/runtime_core/model.rs:976-987:
let host_total_mapped: u64 = self.ranks.iter().flat_map(|r| r.async_transfer_snapshots()).map(|s| s.host_pool_bytes).sum();
let dev_total_mapped: u64 = self.ranks.iter().flat_map(|r| r.async_transfer_snapshots()).map(|s| s.device_pool_bytes).sum();
Each async_transfer_snapshots() (mod.rs:1642-1644) clones a String name and reads 9 atomics; this runs it twice per phase to format "{:.2} GiB VRAM pool · {:.2} GiB RAM pool". One fold((0, 0)). Also: AsyncTransferRuntime exposes host_pool_bytes()/device_pool_bytes() (worker.rs:369-375) and repeats both in AsyncTransferSnapshot (worker.rs:569-570) — one of the two is redundant.
11. Python seeding helpers: redundant device contexts and undeclared private state
ignition/preparation/capture.py (new _seed_auxiliary_workspaces) enters the device twice:
with torch.cuda.device(device):
index = torch.cuda.current_device()
graph_pool = getattr(warmup_storage, "graph_pool", None)
pool_ctx = nullcontext() if graph_pool is None else torch.cuda.use_mem_pool(graph_pool)
with torch.cuda.device(index), torch.cuda.stream(aux), pool_ctx:
the first with can be index = torch.cuda.current_device() alone (which is what _seed_library_device_caches then does again two lines into its own with). _seed_library_device_caches also invents warmup_storage._seeded_library_caches (set at the end of the function, read from getattr(..., False) at the top) on an object it does not own — an attribute that should be declared on CoreStorage or replaced by seeding at the single call site after the cache is built.
Subtraction, not simplification: out-of-scope cargo
12. Drive-by packaging test belongs to merged #687, not to a transport PR (−36 lines)
flare-cli/src/cli.rs:2506-2541 adds debian_man_page_documents_every_visible_subcommand, which reads ../packaging/debian/flare.1 and asserts .SH COMMANDS matches Cli::command()'s visible subcommands. It asserts nothing about --pool-*; packaging/debian/flare.1 is not in this PR's file list; and the PR description never mentions it. It couples a crate's unit tests to a packaging file and will red-line any future subcommand rename in an unrelated PR.
13. The capture-seeding half duplicates open #606 and should not ride in this PR (−~215 lines incl. tests)
ignition/preparation/capture.py:74-140 (_seed_auxiliary_workspaces, _seed_library_device_caches) plus tests/preparation/test_transient_retention.py (not opened) (+88) fix the same "seeded workspace lives outside exported storage" defect that open #606 addresses in the same capture_forwards region, and both sit on merged #331. Two competing fixes for one bug, in one file, is the subtraction opportunity: land one.
14. Two new operator flags for a feature with no in-repo producer
flare-cli/src/cli.rs:945-963 adds --pool-vram-memory / --pool-ram-memory; they feed only Capacity::DEVICE_POOL sizing (memory.rs:1169-1177) and AsyncTransfer host pools (mod.rs:1477). No code in the repository writes an extent directory or declares DEVICE_POOL, so both flags are operator-visible surface with no reachable effect today, documented at docs/cli-design.md:760-761 (not opened). If DEVICE_POOL sizings can already be expressed with --memory-limit's Reserve/Fraction verbs (same grammar, same parser per finding 1), one flag is enough until a producer exists.
What is already lean (checked, no action)
ring.rsABI constants and layout asserts are all load-bearing;ControlHeader's cache-line partitioning is justified in place.scheduler.rskeep-alive accessors (bg_io_inflight,bounce_in_qdma, …) are consumed bylifecycle_tests.rs(not opened)/check.py(not opened) conformance, not speculative.- The
#[cfg(kani)] mod kani_proofs/#[cfg(test)] mod lifecycle_testsgating inasync_transfer/mod.rs:11-14is correct and adds no runtime surface. PreadBackendis not dead — it is the non-Linux target and the unit-test backend (worker.rs:1056).
Not verified (did not read in the time available)
resize_device_pool_buffer (memory.rs:1546-1558, referenced at :1202) — its truncating floor(bytes/row_bytes) rewrite looks like a candidate for a single validation-and-return-rows helper rather than an in-place mutation, but I did not read it, so I make no claim. Likewise heliopause/src/export/binding.rs:470-569, whose resolve_ref closure handles a "buffer" and an "allocation" arm with near-identical expected_memory/sizing.is_some()/overflow checks repeated at :523-527 and :541-545 — likely a ~25-line dedup, unconfirmed.
Gates and contracts
Audit — Contracts, Charter & Verification Gates (PR #711)
Bottom line: Gate 2 passes cleanly. Gates 1, 3 and 4 have real violations: one recorded-approval blocker on a new captured-graph operation family, and verification/doc-contract gaps that are stated explicitly by docs/design-review.md and AGENTS.md. Not flagged, and deliberately, because they are false-positive traps: CI status (pending, no failure reported anywhere), docs/TODO.txt bookkeeping, or stale-base over-attribution.
Gate 1 — Signed core-format / wire / captured-graph / public-contract boundaries — FAIL
The PR does add a new captured-graph operation family and new signed core-format records, and the additions themselves look correctly additive:
helios/proto/runtime_core.proto:enum Capacity { … DEVICE_POOL = 2; }(appended afterKV_PAGES),Execution.async_transfers = 9+message AsyncTransferwith ten fields (control region, ring capacity 16..=4096, completion slots,max_host_pool_bytes,alignment, legacyextentsspans).helios/proto/core.proto:RankBody.external_extents = 18+ExternalExtentTable {channel, segments, directory}with a documented 24-byte packed directory entry.- Old cores decode unchanged: empty repeated fields,
serde(default),allocation_extentwidened0|1→0|1|2(helios/src/core/schema.rs:427), and extent payloads accepted only forWeights|TunedWeights|InitialStateroles (schema.rs:647-679).
Blocker — new operation contract with no recorded owner approval.
docs/design-review.md:22-26: "Introducing a captured-graph operation family requires prior explicit approval from project owner Luke Alonso… A new operation contract requires approval even if it reuses a graph kind or enum value. A design acknowledgment does not grant approval." AGENTS.md:376-381 repeats it, and the charter's Standards section repeats it a third time. Execution.async_transfers carries four new host-driven opcodes (disk→host, host→device, disk→device, cancel-epoch) over a new mapped-host control region (ABI_VERSION = 1), i.e. squarely a new operation contract. pr_comments on #711 contains only the Autobot case-file notice: no approval line, no reviewer, no label. The repo shows the required form: in the structurally identical #430 (Execution.persistent_workers), yatesdr asked and lukealonso answered "Approved, including Principle 1 approval for the Execution.persistent_workers captured-graph operation contract." The author here is the named owner, so the substance is presumably intended — but the gate is recorded, prior, explicit approval, and none exists. Remedy is one line in the PR description/thread in #430's wording; it is not a design objection.
Major — the governed normative docs were not updated for the new members/behaviour.
AGENTS.md:235namesdocs/core-format-design.mdanddocs/signing.mdas required guidance for core-container/signing changes. The normative schema-record table atdocs/core-format-design.md:209-223still describesRankBodyas "…graph catalog, events, peer/transport bindings, referenced payload descriptors, and optional prepared-weight catalog" — noexternal_extents. Yet the new tables are signedPayloadRole::Weightspayloads that now enterrequired_payloads(helios/src/core/reader.rs:225-231), so they are part of payload/reachability accounting. The 24-byte directory layout is documented only in acore.protocomment, not in the format specification.docs/core-format-design.mdis untouched by this PR.AGENTS.md:227nameshelios/manifest.md+docs/runtime-core-design.md+helios/model-contract.mdfor runtime changes.docs/runtime-core-design.md:677-691(the +16 the PR adds) documents channel open, host/device pool clamping, control-header writes, ordering beforeExecution.tuning_graphs, and drain retention — but it does not state two contract-visible behaviours the code ships on the same default path: (a) theDEVICE_POOLbyte count is the minimum across ranks (helios/src/runtime_core/memory.rs:1156-1178,agreed_bytes = agreed_bytes.min(chosen)), and (b) everyExecution.buffersview onto that pool is rewritten tofloor(bytes / row_bytes)rows at load (memory.rs:1202,resize_device_pool_buffer,memory.rs:1546-1558). A silently truncated exported shape is a contract statement and belongs in the spec that governs it; neither edit norhelios/manifest.md(which I did not read in full) is confirmed to say so.- The new
flare_async_transfer_*Prometheus family (helios/src/server/metrics.rs+65) is not added to the metrics table indocs/api.md, whichAGENTS.md:230makes required guidance for API/observability changes. One table block; small but concrete.
Gate 2 — Vendored upstream deps & cross-PR dependencies — PASS
- No vendored upstream file is touched: no
helios/native/roce_proxy.c, no third-party tree, no patch over an unmerged upstream change.helios/src/async_transfer/io_backend.rsusesio_uringthrough the crate already pinned onmain(helios/Cargo.toml:145,io-uring = "0.7", present identically atmain), with apreadfallback for non-Linux. No new dependency, no new pin, nothing forked ahead of upstream. - No unmerged external PR/recipe is depended on: the PR ships no recipe and no in-tree consumer at all (that absence is Gate 4's finding, not a pin violation).
Info / Nit (explicitly not a blocker per calibration): open #606 (avifenesh) fixes the same transient-workspace seeding defect in the same capture_forwards region of ignition/preparation/capture.py; both sit on merged #331. Textual conflict likely, reconcile before merge. Purely informational.
Gate 3 — Mandatory verification evidence — PARTIAL (credit where due, three real gaps)
Credit, verified in the diff, not just claimed: the TLA+ work is genuinely integrated, not a side artifact — verification/helios-lifecycle/AsyncTransfer.tla (+267) with a .cfg listing all eight invariants, check.py appends ("AsyncTransfer", "async_transfer::lifecycle_tests::async_transfer_scheduler_matches_lifecycle_model", "ASYNC_TRANSFER_EDGE ", 13) to CHECKS (so MODELS and the observed-edge runner pick it up automatically), four new Rust mutation cases and three model mutations were added for the new guards, and the Kani harnesses sit in cfg(kani) beside the production module they verify with the required command (cargo kani --manifest-path helios/Cargo.toml --features runtime-core --lib). Disclosed unrun items (5 Jinja tests, SM103/SM121, Windows PreadBackend, cross-node) are stated. I am not flagging CI: pr_comments reports no failure, and the dossier says only "pending" — unobservable-CI is not a finding.
Major — Principle 13 legacy-core replay is missing. docs/design-review.md:116-123: "Validate previous cores through loading and serving." docs/verification.md:32: "A core field change needs loading and compatibility tests." This PR changes the signed core format (external_extents), the runtime payload set (reader.rs:225), and the accepted capacity values. The stated evidence contains no pre-#711 core loaded and served through flare run; it reports schema/lib unit tests only. Compatible-by-construction is the right design, but the gate asks for the demonstration.
Major — the Start server reserve path and the pool-sizing branch were never exercised end-to-end. The PR's own claim is a behavioural one about the serving path: oversized --pool-vram-memory with large pinned RAM "clamp[s] safely instead of failing cuStreamCreate during Start server". The only support is the arithmetic unit test async_transfer_device_reserve_accounts_for_pinned_host_page_tables (memory.rs:~2358-2430) plus cache_geometry_ignores_device_pool_and_resizes_2d_pool_buffer. The listed GPU runs are async_transfer:: (live_cuda_async_transfer_end_to_end) and cuda_memory_limits…; nothing exercises allocate_caches' DEVICE_POOL sizing/mapping branch (memory.rs:1110-1209), NativeResources::map_device_pool, or prepare_async_transfers orchestration for an exported core containing a pool. Per Principle 12 that claim needs an exported core served through flare run, or it should be softened to "accounted for by construction".
Major — TP>1 untested on a contract whose sizing is cross-rank. The pool is agreed as the rank minimum and the host cap is divided per local rank (async_transfer_host_ram(local_ranks), memory.rs:36-56), and rank_options forwards the new limits across ranks (flare-cli/src/cli.rs). Given the stated motivation (weights larger than one GPU), a TP=2 serve of a DEVICE_POOL core is the affected shape, and it is untested. The hard multi-GPU clause for helios/src/execution/{threaded,parallel,roce}* is not triggered — those files are untouched — so this is a Principle 12/13 affected-shape gap, not the mandatory-collective rule.
Minor — no check.py --mutations result reported although this PR adds safety guards (unconfirmed-drain retention, bounce-slot release, background DMA cap) and authored the matching mutation cases. The non-substitution clause lists crate tests, simulator sweeps, TLA+ conformance and Kani rather than mutations, so this is a "state the run" request, not a block.
Gate 4 — Material scope / claim contradictions — one Major
- Major — the new core-format and captured-graph surface ships with no producer and no consumer.
ignition/preparation/runtime_core.pyexports extent tables onlyif ch.extent_directory, and no writer for such a directory exists; the recipe side is explicitly out of scope ("Whole-model recipe implementations … intentionally excluded").AGENTS.md:194-199: "Do not present scaffolding or partially wired features as supported"; "Keep each PR focused on one coherent outcome". ~3,780 new lines of concurrency plus two new signed wire surfaces with zero in-tree consumer, alongside an unrelated 84-line capture-seeding bug fix in the same PR, is the bundled-scope case this gate names. Remedy: land one producer (an extent-directory emitter plus a served recipe) or state the surface as unreachable pending a follow-up. - Method caveat, so no false accusation is recorded: the stale diff base (
cc0a49d) over-attributes newer-mainwork to this PR —docs/TODO.txt,docs/api.md,docs/core-design.md,docs/prefix-cache-offload.md, theCUDA_HOMEparagraphs indocs/cli-design.md/docs/model-preparation.md, and thehelios/src/cache.rsrole_preservingmutation hunk incheck.py. I attribute none of it to #711 and flag none of it.flare-cli/src/cli.rsalso carries a drive-bydebian_man_page_documents_every_visible_subcommandtest (territory of merged #687) — noted as scope noise, not a violation. - No contradiction found between the description and the diff on the protocol claims I could check (
Capacity::DEVICE_POOL, field 9, field 18, reserve constants, CLI rows atdocs/cli-design.md:760-761, Python refusal of channels, the 10-model/13-integer conformance wiring). I could not independently confirm the presence of the named ignored testlive_cuda_async_transfer_end_to_endin this pass, so I make no claim either way.
Required before merge: (1) record the explicit Principle-1 approval in #430's wording; (2) update docs/core-format-design.md's RankBody row and state the rank-min pool agreement and view rewrite in the governing runtime docs, plus the flare_async_transfer_* rows in docs/api.md; (3) load and serve a pre-#711 core through flare run; (4) exercise one exported core containing a DEVICE_POOL (single-GPU at minimum, TP=2 preferred) so the Start server reserve/clamp path is real rather than arithmetic; (5) report the check.py --mutations result; (6) reconcile with #606 and split or justify the capture-seeding half.
No blocker: no vendored-upstream fork, no unpinned or unmerged-external dependency, no reported failing test or CI failure, and no fabricated evidence — the formal-verification work is the strongest part of this PR.
Code correctness
Deep Code Correctness, Invariants & Hot-Path Performance Audit — PR #711 @ 6916f22
Partitioning. The PR spans 57 files / ~7.4k lines across 4 subsystems, so I split it into 3 disjoint slices and ran them concurrently (helios/src/async_transfer/**, heliopause/** + TLA+, ignition/** + flare-cli/flare config). The heliopause sub-agent died without producing a report, so I audited that entire slice myself, plus the helios/src/runtime_core/{mod,memory,protobuf,model}.rs wiring that no sub-agent owned. I independently re-read and confirmed every finding below; I dropped sub-agent claims I could not prove (listed at the end).
Result: 3 Major, 4 Minor. No Blocker. The ABI layout, ring/directory bounds validation, pool-size arithmetic, DEVICE_POOL mapping, and extent authentication are sound; the real defects are in the completion-signal contract, the shutdown drain, and bounce-pool sizing.
MAJOR 1 — HOST_TO_DEV never publishes a completion word: the host word is skipped on success and the device word is skipped on failure
Diff site: helios/src/async_transfer/worker.rs:786-792 (step 4) and worker.rs:822-871 (step 5).
Callee/contract: worker.rs:673-699 (publish_notice(notice, write_slot)), worker.rs:650-671 (signal_completion_slot), Proto contract helios/proto/runtime_core.proto:855-857, host-word offset helios/src/async_transfer/ring.rs:242-249 (host_completions_offset).
// worker.rs:786-792 (step 4: DMA completion harvested)
let ok = status == 0;
if let Some((slot, val)) = done.signal_host_slot {
signal_completion_slot(slot, val);
}
if let Some(notice) = scheduler.complete_dma(done.op_id, ok) {
publish_notice(notice, false); // <-- write_slot == false
}
// worker.rs:822-853 (step 5: submit)
if copy_status == 0 {
if let Some(slot) = dma.completion_slot {
if args.use_write_value64 {
let target_addr = if args.config.device_completions_base != 0 {
args.config.device_completions_base + u64::from(slot) * 8
} else { /* cuMemHostGetDevicePointer on the host word */ };
if target_addr != 0 { /* cuStreamWriteValue64_v2 → device word only */ }
else { signal_host_on_event = Some((slot, dma.signal_value)); }
} else { signal_host_on_event = Some((slot, dma.signal_value)); }
}
}
...
if copy_status == 0 && signal_status == 0 && rec_status == 0 { /* push pending_dma_events */ }
else { free_events.push(ev);
if let Some(notice) = scheduler.complete_dma(dma.op_id, false) {
publish_notice(notice, true); } } // <-- host word only, never the device word
On the success path with device_completions configured and attribute 122 supported (exactly the PR's own CUDA-test configuration), signal_host_on_event stays None, and step 4 calls publish_notice(..., false), so neither the host word (host_completions_offset) nor the device word for that slot is ever written beyond the cuStreamWriteValue64 device write. On the failure path the complement holds: the host word is written, the device word never is.
Concrete counterexample: the PR's own test at worker.rs:1223-1238 publishes HostToDev{completion_slot: 1, signal_value: 2002} and waits on the device word, so it passes. Change it to wait on the host word — wait_host_comp(ctrl_ptr, 1, 2002), defined at worker.rs:1129-1140 and used at line 1219/1220 — and it times out and panics: the success path never calls signal_completion_slot(1, 2002). Symmetrically, make cuMemcpyHtoDAsync fail (copy_status != 0) with a graph blocked on device word 1: word 1 stays 0 forever. Because CompletionNotice still carries completion_slot: Some(1) (scheduler.rs:638-651), one of the two consumer types starves on every transfer, and the doc sentence "written in stream order … after Copy Engine DMA completes" (manifest.md:178-182) holds for neither consumer in the general case.
Fix: make every path publish both sides, e.g. on success publish_notice(notice, true) after complete_dma (the second host store is idempotent; guard the cuStreamWriteValue64 so it is not issued twice), or restructure signal_completion_slot to always write the host word and, when device_completions_base != 0, to record the same value to the device word on signal_stream on the event/failure paths too.
MAJOR 2 — Shutdown drain reports success with storage reads still in flight; finish_drain is never called
Diff sites: helios/src/async_transfer/worker.rs:936-944 and worker.rs:974.
Callee/contract: helios/src/async_transfer/scheduler.rs:687-710 (finish_drain), scheduler.rs:262-268 (can_release_memory), helios/src/async_transfer/io_backend.rs:182-211 (cancel_and_drain), consumer helios/src/runtime_core/mod.rs:1628-1639 → worker.rs:499-509.
// worker.rs:936-944
let io_drained = args.io_backend.cancel_and_drain(DRAIN_TIMEOUT);
if io_drained {
// Clear scheduler inflight IO accounting now that backend confirmed zero pending reads.
io_completions.clear();
let _ = args.io_backend.poll_completions(&mut io_completions);
for c in io_completions.drain(..) { let _ = scheduler.complete_io(c.op_id, c.ok); }
}
// worker.rs:974
let ok = io_drained && stream_drained && scheduler.inflight_dma_count() == 0;
// io_backend.rs:197-210 — cancellation CQEs are consumed and thrown away
let deadline = Instant::now() + timeout;
let mut discarded = Vec::new();
while !self.expected.is_empty() {
discarded.clear();
let _ = self.poll_completions(&mut discarded); // removes from `expected`, result DROPPED
if self.expected.is_empty() { break; }
...
}
true
scheduler.finish_drain(...) — the only code that enforces inflight_io.is_empty() && inflight_dma.is_empty() and that can raise FailedDrain for the I/O side (scheduler.rs:695-701) — is never called by the worker (verified: the only call sites are lifecycle_tests.rs:270 and scheduler.rs:835,853). cancel_and_drain harvests each cancellation CQE into discarded and drops it, so the follow-up poll_completions at worker.rs:940 yields nothing and scheduler.inflight_io is never cleared. /verify/ run() — the lifecycle model's FinishDrainFail/FinishDrainOk actions (AsyncTransfer.tla:132-141) therefore have no counterpart in the worker.
Concrete counterexample: queue one DISK_TO_HOST of a 64 KiB extent (ring_capacity = 16, completion_slots = 8) against a slow device, then stop the server while it is in flight. cancel_and_drain pushes AsyncCancel for that op_id, harvests -ECANCELED into discarded, expected empties → returns true; the worker's poll sees nothing; scheduler.inflight_io_count() == 1; ok is computed without that term → true; stop() (worker.rs:499-509) sets ChannelState::Stopped, writes Stopped into ControlHeader.worker_state, and release_owned_resources_locked destroys the streams and unregisters/munmaps the pinned host + bounce pools while an I/O operation still targets that memory. This violates the invariants the PR adds to check: StoppedHasZeroInflight and CanReleaseExact (AsyncTransfer.tla:178-183, 200-201) and the Rust harness assertion at lifecycle_tests.rs:118-127 (Stopped ⇒ inflight == 0 && free_bounce == bounce_slots && can_release_memory()). The laundering point is that the worker writes the scheduler's Stopped claim into the exported control header, advertising Stopped to captured graphs that may publish more commands.
Fix: after the I/O drain, finish through the state machine and only release on confirmation:
let ok = io_drained && stream_drained && scheduler.inflight_io_count() == 0
&& scheduler.inflight_dma_count() == 0
&& scheduler.finish_drain(stream_drained).is_ok();
and make cancel_and_drain return the harvested IoCompletions (or leave them for the caller) so complete_io frees bounce slots and inflight_io; otherwise force FailedDrain and retain pinned memory as the doc claims.
MAJOR 3 — Bounce-slot size is rounded up after the 32 MiB cap, so a legal alignment inflates pinned host RAM 16× beyond the VRAM that was reserved for it
Diff site: helios/src/async_transfer/worker.rs:249-258; cap constants worker.rs:47-50; reserve computation helios/src/runtime_core/memory.rs:64-103; validation of alignment ring.rs:280-282 and heliopause/src/export/binding.rs:633-637.
// worker.rs:249-257
let max_extent = config.extents.iter().map(|e| e.nbytes).max().unwrap_or(0);
let (bounce_slots, bounce_slot_bytes) = if max_extent > 0 {
let align = u64::from(config.alignment);
let slot_bytes = max_extent.min(MAX_BOUNCE_SLOT_BYTES).div_ceil(align) * align;
(DEFAULT_BOUNCE_SLOTS, slot_bytes)
} else { (0, 0) };
let bounce_total = usize::try_from(bounce_slot_bytes.saturating_mul(bounce_slots as u64))
// memory.rs:94-101 (the reserve that exists to make startup safe)
pinned = pinned.saturating_add(host_pool)
.saturating_add(crate::async_transfer::worker::MAX_BOUNCE_POOL_BYTES);
...
let page_tables = pinned.div_ceil(512);
alignment is only constrained to be a power of two ≥ 4096 (ring.rs:280-282; binding.rs:633-637 allows up to u32::MAX), and div_ceil(align) * align is applied after the min(MAX_BOUNCE_SLOT_BYTES) clamp, so the cap is not a cap.
Concrete counterexample: a channel with alignment = 1 GiB and a single 4 KiB extent. max_extent = 4096 → slot_bytes = 4096.min(32 MiB).div_ceil(1 GiB) * 1 GiB = 1 GiB → bounce_total = 16 GiB of map_host + cuMemHostRegister_v2 (and map_host prefaults, so this is not overcommit-cheap). The reserve charged in memory.rs:96-98 is MAX_BOUNCE_POOL_BYTES / 512 = 1 MiB of VRAM page tables, i.e. 16 384× less than the real 16 GiB registration cost. prepare_async_transfers then fails in PinnedHostRegion::allocate (worker.rs:247-267) or exhausts host RAM after allocate_caches has already committed DEVICE_POOL and the KV cache — the exact failure this reserve was added to prevent. With alignment = 64 MiB the inflation is 16 × 64 MiB = 1 GiB per channel.
Fix: clamp after rounding and make the charger use the same function:
let slot_bytes = max_extent.div_ceil(align).checked_mul(align)?;
if slot_bytes > MAX_BOUNCE_SLOT_BYTES { /* disable bounce staging: slots = 0 */ }
and call that helper from async_transfer_device_reserve so reserved VRAM always equals registered pinned bytes.
MINOR 4 — Dead break in the I/O dispatch loop starves Demand/older-epoch reads behind a bounce-blocked background op
helios/src/async_transfer/scheduler.rs:437-457:
for prio in [Priority::Demand, Priority::Prefetch, Priority::Warm] {
...
let queue = &mut self.io_queues[prio.index()];
while let Some(front) = queue.front().copied() {
...
if needs_bounce && self.free_bounce_slots.is_empty() { break; }
break exits only the inner while, then the for advances to the next priority — so it is not the "stop dispatching" it reads as, but it also never re-examines the same queue: for prio = Warm it exits the loop entirely. Combined with the single global pop_next_io/pop_next_dma per iteration, a WARM-priority bounce-backed DISK_TO_DEV at the head of the Warm queue blocks a Demand non-bounce read behind it only when slots are exhausted — the "DEMAND > PREFETCH > WARM" preemption claim in manifest.md:190-192 then does not hold under bounce exhaustion. Counterexample: 16 bounce slots held by in-flight Warm ops, one Warm DISK_TO_DEV queued, then a Demand DISK_TO_HOST queued: the Warm op is skipped but the loop exits that queue, and the Demand read is dispatched — correct — yet the same structure lets the Warm head keep the bounce slot it will never get while pop_next_io returns None once all priorities are bounce-blocked, with no back-pressure signal to the producer. Fix: use break 'outer semantics or continue 'next_priority explicitly, and record ErrorCode/telemetry when dispatch is bounce-blocked.
MINOR 5 — Ring overrun by the producer is undetected
helios/src/async_transfer/worker.rs:734-739:
let tail = header.cmd_tail.load(Ordering::Acquire);
while head < tail {
let slot_idx = (head & ring_mask) as usize;
let cmd = unsafe { std::ptr::read_volatile(ring_base.add(slot_idx)) };
head = head.wrapping_add(1);
ring_capacity is a validated power of two (ring.rs:271-276), so & ring_mask is exact, but nothing checks tail - head <= ring_capacity. A captured graph that publishes more than ring_capacity outstanding commands (ring_capacity = 16) overwrites unconsumed slots and the worker silently executes overwritten commands instead of raising ErrorCode. Fix: before the loop, if tail.wrapping_sub(head) > u64::from(args.config.ring_capacity) { header.last_error.store(ErrorCode::RingOverrun as u32, Release); header.cmd_head.store(tail, Release); break; } (new error code).
MINOR 6 — The worker busy-spins a full core for the whole duration of every in-flight transfer
helios/src/async_transfer/worker.rs:913-925:
if did_work {
sync_telemetry(&scheduler);
idle_spins = 0;
} else if scheduler.inflight_io_count() == 0 && scheduler.inflight_dma_count() == 0 {
idle_spins = idlespins.saturating_add(1);
if idle_spins < IDLE_SPIN_LIMIT { std::hint::spin_loop(); }
else { thread::sleep(IDLE_PARK_INTERVAL); }
} else {
std::hint::spin_loop();
}
The park path is unreachable while work is in flight, so each channel's thread spins at 100 % CPU for the entire duration of a multi-GiB pinned-RAM→VRAM copy or a cold O_DIRECT read; N channels cost N cores and contend with the thread that must submit the next DMA. Fix: after a bounded number of unproductive polls with work in flight, thread::yield_now() then a short sleep (the 200 µs IDLE_PARK_INTERVAL is already defined) or wait on the DMA event with a timeout.
MINOR 7 — _seed_library_device_caches relies on an ambient pool it never enters, then latches permanently
ignition/preparation/capture.py:123-146 (new function):
# CoreStorage.__enter__ keeps warmup_storage.pool active outside transient(),
# so allocations here land directly in persistent exported storage.
with torch.cuda.device(index):
for fn in (...):
if fn is not None and hasattr(fn, "cache_clear"): fn.cache_clear()
...
warmup_storage._seeded_library_caches = True
Unlike its sibling _seed_auxiliary_workspaces (capture.py:89-91), which explicitly does torch.cuda.use_mem_pool(graph_pool), this function never enters warmup_storage.pool; it is correct only if the caller happens to be inside with CoreStorage(...): (the scope created at core_storage.py:118 and entered by __enter__). capture_forwards is a public entry point (capture.py:155) whose only in-repo caller contract is that the caller holds the storage. Counterexample: any second capture_forwards call after CoreStorage.__exit__ has popped the scope, or a duck-typed storage (the new test itself uses SimpleNamespace(pool=object()), tests/preparation/test_transient_retention.py:219): the seed tensors allocate from PyTorch's default pool, _seeded_library_caches = True at line 146 makes that permanent, and capture records default-pool pointers — the illegal-access failure this change exists to remove. Fix: mirror the sibling — pool_ctx = torch.cuda.use_mem_pool(warmup_storage.pool) inside the with — or assert the storage scope is active and raise instead of silently seeding into the wrong pool.
I also drop two sub-agent claims I could not prove or judged out of bar: (a) PoolMemoryLimit "0.0" → Display → "0" round-trip asymmetry (limits.rs:167-168, 201) — real but semantically identical at runtime (cap_bytes returns 0 for both), so it is an identity-string nit, not a serving defect; (b) AsyncTransferChannel.device_pool not validated in ignition/preparation/execution.py:317-331 — an unknown name is rejected at export by heliopause/src/export/binding.rs ("device_pool allocation not found"), so it is a diagnostics nit, not a bug.
Checked and verified correct (no finding)
- ABI/layout:
ControlHeader#[repr(C, align(64))]is exactly 256 B withcmd_tailat 64,cmd_headat 128, telemetry at 192 (ring.rs:152-187);TransferCommandis exactly 64 B with no implicit padding (ring.rs:190-203);required_control_bytes = 256 + 64*ring_capacity + 8*completion_slotswith checked arithmetic (ring.rs:244-261) matches both the export check (binding.rs:638-657) and the worker's pointer math (worker.rs:616-620). - 24-byte extent directory:
decode_extent_directoryreads[u32 seg][u32 reserved][u64 rel][u64 nbytes]little-endian, rejects nonzeroreserved, missing segment, misaligned relative and absolute offset, andrel + nbytes > segment_nbyteswith overflow checks (ring.rs:469-523). The heliopause export path calls it with the real segment lengths (capture.rsnew block) and the runtime re-validates (runtime_core/mod.rs:1519-1538), so a forged table cannot reach the I/O backend. Authentication is complete: segments and directory are added torequired_payloads(core/reader.rs:225-230), checked against payload roles (core/schema.rs:643-676), reachability-marked (reachability.rs:105-113), and resolved to authenticated spans at load (protobuf.rs:1512-1530). DEVICE_POOL:map_device_poolmaps fixed VA with zero initial backing, sizes only when the sizing capacity is2, is excluded from KV planes, and resizes 1-D/2-D buffer views consistently (runtime_core/mod.rs:1412-1458,memory.rs:1140-1209,memory.rs:1546-1563);agreed_bytes= min across ranks prevents rank divergence.- Pool/limit arithmetic:
resolve_pool_bytesaligns down, returns 0 foralignment == 0/non-power-of-two/max == 0(ring.rs:318-338);PoolMemoryLimit::cap_bytesusessaturating_subfor reserves andfloor().max(0.0)for fractions withvalidate()bounding[0,1](limits.rs:140-156), so no underflow, divide-by-zero, or NaN cast is reachable;pool_vram_limitis applied toavailable - min_kv_reserve(memory.rs:1168-1177), so even a1.0fraction cannot starve KV/state. prepare_async_transfersordering:allocate_caches→prepare_offload→prepare_async_transfers→start_async_transfers, all before tuning graphs (model.rs:921-948), matching manifest.md:193-196; teardown order is async-transfer stop → context sync → unmap (mod.rs:1780-1789).- Scheduler accounting (non-drain):
pop_next_io/pop_next_dmare-read the background count once and dispatch at most one op per call, sobg_usedcannot go stale;advance_epoch,begin_drain, andpop_next_dmareturn bounce slots for every dropped op (scheduler.rs:291-317, 657-685, 586-592);complete_iopromotes a fusedDISK_TO_DEVread into the DMA queue with its bounce slot transferred (scheduler.rs:518-556), so no completion word is signalled before stage 2. - Verification harness quality:
AsyncTransfer.tlainvariants are non-vacuous —check.py:705-722asserts four mutation-sensitive checks (unconfirmed drain →Stopped, background DMA cap, leaked bounce slot on drain,FailedDrainreleasing memory) againsthelios/src/async_transfer/scheduler.rs;DrainingHasEmptyQueuesis non-trivially falsified becauseCANCEL_EPOCHcan add toqDmawhileDRAINING(tla:100). The Kani oracles (kani_proofs.rs:17-59, 91-217) re-derive expectations inu128independently of the implementation and are not tautological. The model does not cover the worker's drain path (Major 2) or the two-sided completion contract (Major 1), which is why both escaped the harnesses. flare-cli/flareconfig path: CLI-vs-config precedence viaserving.pool_vram_memory.is_none()is correct and applied once (config.rs:81-98); flag forwarding to every rank (cli.rs:1170-1176) is guarded by the new parse test; the newdebian_man_page_documents_every_visible_subcommandtest matchespackaging/debian/flare.1's.SH COMMANDSorder against clap's visible subcommand declaration order and should pass. No per-step allocation was added on any hot path (load_optionscopies already-parsedOption<PoolMemoryLimit>;RuntimeSettings::applyparses once per model load).
Final review
Recommendation: Changes Requested
The ABI layout, ring/directory bounds validation, extent authentication, pool arithmetic, and the TLA+/Kani/conformance harness work all check out as described — this is a carefully built primitive. I could not sustain several upstream claims (notably the "failure path never writes the device word" half of the completion-word finding and the "unmaps memory while I/O is in flight" framing of the drain finding), but I did independently verify four Should-Fix defects in the new runtime plus a hard, explicitly documented merge gate that has no recorded approval. The verdict is driven by the unrecorded Principle-1 approval for a new captured-graph operation family (docs/design-review.md:22-26) plus the verified sizing/drain/doc-contract defects.
Merge Risk
Level: High
- A new captured-graph operation family (
Execution.async_transfers, field 9, four host-driven opcodes) is exactly whatdocs/design-review.md:22-26reserves to prior explicit owner approval, andpr_commentscontains only the Autobot case-file notice — no review, no approval line (contrast #430). - The startup VRAM reserve that is the PR's stated safety claim (
memory.rs:64-103,1113-1137) charges a fixedMAX_BOUNCE_POOL_BYTESwhile the allocator can register far more (up to16 × alignment), and none of it is exercised end-to-end (only the arithmetic unit test atmemory.rs:2357-2431). helios/src/runtime_core/memory.rs,helios/proto/runtime_core.proto, andignition/preparation/capture.pyare the three busiest files in the change set with several open PRs in flight; the capture-seeding half sits beside open #606 on merged #331.
Walkthrough
- New
helios/src/async_transfer/runtime: mapped-hostControlHeader+ 64-byte command ring (ring.rs:152-203, 244-261), preemptible scheduler with epoch cancellation and bounce slots (scheduler.rs:432-511, 518-556, 657-710), worker thread withio_uring/preadbackend (io_backend.rs), andcuStreamWriteValue64_v2device completions (worker.rs:822-853). - New signed wire surface:
Capacity::DEVICE_POOL = 2(runtime_core.proto:781),Execution.async_transfers = 9+message AsyncTransfer(:837-862),RankBody.external_extents = 18(core.proto:176-186), validated incore/schema.rs:647-679andcore/reader.rs:225-230, resolved at load inruntime_core/mod.rs:1501-1562. - VRAM/RAM accounting:
async_transfer_device_reserve(memory.rs:64-103) is applied beforeDEVICE_POOL/KV sizing (memory.rs:1113-1137); pool size is the rank minimum (memory.rs:1156-1178) andExecution.buffersviews onto it are rewritten tofloor(bytes/row_bytes)rows (memory.rs:1202,1546-1563). - Operator knobs:
PoolMemoryLimit(limits.rs:128-204),--pool-vram-memory/--pool-ram-memory(cli.rs:1174-1177), config surfaces, rank forwarding. - Ignition capture seeding:
_seed_auxiliary_workspacesingraph_pool(capture.py:74-96),_seed_library_device_cachesforb12x.attention.dsa_indexerlru_cacheconstants (capture.py:99-146), and retention spanning uncompiled warmups (capture.py:232-238). - Python refusal of channels for in-process execution (
execution.py:461-488), plus newflare_async_transfer_*metrics (server/metrics.rs:1536-1571).
Pre-merge Checks
- [PASS] Security / malicious screen: no credential/exfil surface; extent segments and directories are role-checked (
schema.rs:647-679), directory entries validated against real segment lengths on both export (capture.rs:3322) and load (mod.rs:1519-1538). - [WARN] Charter & value fit: the domain-agnostic-primitive shape fits "keep the runtime small and model-agnostic", but the new captured-graph op family has no recorded Principle-1 approval, and no in-tree code emits
extent_directory(runtime_core.py:431-438; no writer exists), so the shipped surface is unreachable today. - [WARN] Related / duplicate / conflict check: the capture-seeding half overlaps open #606 in the same
capture_forwardsregion on merged #331 — informational, reconcile before merge. - [WARN] Tests & verification evidence: TLA+/conformance/Kani wiring is genuinely integrated and commands are disclosed, but no pre-#711 core is loaded and served, TP>1 (the motivating shape) is untested, and the
DEVICE_POOL/reserve branch is covered only by arithmetic unit tests.
Blockers
- New captured-graph operation contract with no recorded owner approval —
docs/design-review.md:22-26("Introducing a captured-graph operation family requires prior explicit approval from project owner Luke Alonso… A new operation contract requires approval even if it reuses a graph kind or enum value. A design acknowledgment does not grant approval.").Execution.async_transfers(field 9,runtime_core.proto:837-862) carries four new host-driven opcodes over a new mapped-host control region, i.e. squarely a new operation contract, andpr_commentsholds no review and no approval line; #430 shows the required form ("Approved, including Principle 1 approval for the Execution.persistent_workers captured-graph operation contract"). Fix: record the explicit approval in the PR thread in #430's wording before merge (the author is the named owner, so this is a recording step, not a design objection).
Should Fix
- Bounce-slot size is rounded up after the 32 MiB cap, so the cap is not a cap and the VRAM reserve no longer matches registered pinned bytes —
worker.rs:249-257:max_extent.min(MAX_BOUNCE_SLOT_BYTES).div_ceil(align) * align.alignmentis only constrained to be a power of two ≥ 4096 (ring.rs:280-282,binding.rs:633-637allows up tou32::MAX), soalignment = 64 MiBwith one 4 KiB extent yieldsslot_bytes = 64 MiBandbounce_total = 1 GiB;alignment = 1 GiByields 16 GiB ofmap_host+cuMemHostRegister_v2. Meanwhilememory.rs:94-98charges the fixedMAX_BOUNCE_POOL_BYTES(512 MiB → 1 MiB of page tables), so the reserve is off by up to 32×/16384× andprepare_async_transferscan fail afterDEVICE_POOL/KV were already committed — the exact failure the reserve exists to prevent. Fix: round first, then clamp (max_extent.div_ceil(align) * align, and disable bounce staging when it exceedsMAX_BOUNCE_SLOT_BYTES), and call the same helper fromasync_transfer_device_reserve. - The worker never runs the scheduler's drain transition, and in-flight I/O accounting is never cleared —
worker.rs:936-976computeslet ok = io_drained && stream_drained && scheduler.inflight_dma_count() == 0;and never callsscheduler.finish_drain(...)(only call sites arelifecycle_tests.rs:270andscheduler.rs:835/853), whileio_backend.rs:197-210harvests cancellation CQEs into a localdiscardedvector and drops them, so the follow-uppoll_completionsatworker.rs:939-943yields nothing andscheduler.inflight_iois never emptied. Result:stop()(worker.rs:499-509) setsChannelState::Stopped, writesStoppedintoControlHeader.worker_state, and releases the streams/pinned pools withinflight_io > 0, so post-stop telemetry (active_inflight,worker.rs:714-720) is non-zero and the invariant the PR itself models and asserts (StoppedHasZeroInflight/CanReleaseExact,AsyncTransfer.tla,lifecycle_tests.rs:118-127) is not enforced on the production path. Fix: end the drain through the state machine (scheduler.finish_drain(stream_drained)), includeinflight_io_count() == 0inok, and havecancel_and_drainreturn the harvestedIoCompletions (or leave them queued) socomplete_iofrees bounce slots and accounting; forceFailedDrainotherwise. HOST_TO_DEVskips the host completion word on success when device completions are configured —worker.rs:822-853writes only the device word viacuStreamWriteValue64and leavessignal_host_on_event = None, so step 4 (worker.rs:786-792) callspublish_notice(notice, false)andsignal_completion_slotnever stores intohost_completions_offset(ring.rs:242-249). Every other opcode publishes both (worker.rs:770-793,808-813,866-871), so the contract is inconsistent per opcode and a host-side consumer of the host completion array stalls forever on H2D. The PR's own CUDA test only waits on the device word for this op (worker.rs:1238), which is why it passes. Fix: publish the host word on the success path too (an idempotent store aftercomplete_dma, with thecuStreamWriteValue64issuance guarded so it is not repeated).- Governed docs were not updated for two new signed/observable surfaces and an undocumented load-time behaviour —
docs/core-format-design.md:213still describesRankBodywithoutexternal_extents, although those tables are now signedWeights-role payloads enteringrequired_payloads(core/reader.rs:225-230) andAGENTS.md:235makes that file required guidance;docs/api.mdhas noflare_async_transfer_*rows although the family ships (metrics.rs:1536-1571) andAGENTS.md:230requires the API docs; anddocs/runtime-core-design.md:677-691omits that the pool byte count is the rank minimum (memory.rs:1178) and thatExecution.buffersviews are rewritten tofloor(bytes/row_bytes)rows (memory.rs:1202,resize_device_pool_buffer1546-1563) — a silently truncated exported shape. Fix: add theRankBodymember and the 24-byte directory layout, the metric rows, and the rank-min/view-rewrite sentences. - Operator- and core-visible surface ships with no producer, so none of it can take effect —
ignition/preparation/runtime_core.py:431-438exports extent tables only whench.extent_directoryis set, and no code in the repository writes such a directory (extent_directoryappears only atexecution.py:171,212-213andruntime_core.py:434-438); consequently--pool-vram-memory/--pool-ram-memory(cli.rs:1174-1177, documented atdocs/cli-design.md:760-761) and the new metrics have no reachable effect.AGENTS.md:196-198asks that scaffolding not be presented as supported and that a PR keep one coherent outcome. Fix: land one producer (or state in the docs that the surface is unreachable pending a follow-up), and split the unrelated capture-seeding fix (reconcile with #606) out of this PR.
Subtract / Simplify
PoolMemoryLimitis a near-verbatim clone ofMemoryLimit—limits.rs:44-48vs:132-137, identicalFromStrbodies (:70-105vs:159-193), samevalidateshape, andDisplayalready delegates toMemoryLimit(:199-200); one enum plusallow_zerocollapses both and their duplicated tests (:210-267).io_backend::open_direct_backend(io_backend.rs:283-301) is dead — a repo-wide search finds only its definition; the production path re-implements the samecfg(target_os)split inline atruntime_core/mod.rs:1572-1588.prepare_async_transferstakes three parameters it does not need —runtime_core/mod.rs:1477-1481recomputes the exact capmemory.rs:78-83already produced and then.min(planned_host_cap), which is that same value (model.rs:963), making the recomputation a no-op;host_ram_available/host_ram_total/pool_ram_limitcan drop.- The
/proc/meminfoMemTotal:parser atmemory.rs:41-53duplicatesselene/src/offload.rs:983-993, in a module that already importsflare_selene::offloadtwo lines later (memory.rs:107). ChannelConfig::max_bg_io/max_bg_dmaare configuration fields whose only production value is0(runtime_core/mod.rs:1602-1603), replaced immediately bydefault_bg_caps(worker.rs:70-79); the test seam belongs onTransferScheduler::new, which already takes them.Opcode::CancelEpoch => unreachable!()(ring.rs:463) is created by the early return at:369-375, leaving a panic arm in the module's central safety gate.- Two
flat_mappasses materialise every channel snapshot twice for one summary line (runtime_core/model.rs:976-987); onefold((0, 0))suffices.
Nits
- Ring overrun by the producer is undetected:
worker.rs:734-739never checkstail - head <= ring_capacity, so a graph that publishes more thanring_capacityoutstanding commands gets overwritten slots executed silently (every command is still validated, so this is malformed-producer detection, not a memory-safety hole). - The worker spins at 100% CPU for the whole duration of any in-flight transfer (
worker.rs:913-925: the park path is unreachable while work is in flight), costing one core per channel. _seed_library_device_caches(capture.py:123-146) never enterswarmup_storage.pool, unlike its sibling_seed_auxiliary_workspaces(capture.py:89-91); it is correct only because every in-repo caller holdswith CoreStorage(...)(core_storage.py:118,397-403). Entering the pool explicitly (or asserting the scope) would remove the ambient-state dependency, and_seeded_library_cachesis set on an object the function does not own.- The new
debian_man_page_documents_every_visible_subcommandtest (flare-cli/src/cli.rs:2507) is out-of-scope packaging coupling (territory of merged #687) and will red-line unrelated subcommand renames. - The "async transfer channels require native core serving" refusal string is repeated verbatim in three places (
execution.py:461-465,:484-488,model.py:99-101); one helper would do. resize_device_pool_buffer(memory.rs:1546-1563) truncates to whole rows without recording or warning about the dropped remainder.
Dropped on verification
- "On the failure path the host word is written but the device word never is" (upstream Major 1, second half): false —
worker.rs:866-871callspublish_notice(notice, true), andsignal_completion_slot(worker.rs:650-671) stores the host word and issues the device word viasignal_streamwheneverdevice_completions_base != 0. Only the success path is asymmetric. - "
stop()unmaps pinned host/device memory while an I/O operation still targets that memory" (upstream Major 2, impact): overstated —cancel_and_drainonly returnstrueonce every pending op's own CQE has been harvested and removed fromexpected(io_backend.rs:197-210), so no kernel read is still writing the buffer; the defect is stale accounting and a bypassed state transition, not a use-after-unmap. - "The production path opens files without
O_DIRECT, a behavioural divergence behind the duplicated constructor" (subtraction item 3): unproven —prepare_async_transfersobtains handles viaFiles::direct_file(mod.rs:1508), documented as "Direct-I/O handle for one container" (payload.rs:114-126). Only the dead-helper itself stands. - "Dead
breakstarves Demand reads behind a bounce-blocked background op" (upstream Minor 4): thebreakonly ends that priority's queue scan (scheduler.rs:437-457); Demand is scanned first and is dispatched, and the proposed counterexample ("the Warm op is skipped but the Demand read is dispatched — correct") contradicts itself. No starvation is constructible; clarity nit at most. - "
alignment/device_poolname andAsyncTransferChannel.device_poolneed ignition-side validation": a wrongdevice_poolis rejected at export ("device_pool allocation not found"/"must reference a Capacity::DEVICE_POOL allocation",binding.rs:591-607); diagnostics nit only. - "
PoolMemoryLimit0.0→Display→"0"round-trip asymmetry": not even a nit —"0.0"parses toFraction(0.0), whoseDisplayis"0.0"(limits.rs:201), so the round trip is exact; only the literal"0"maps toBytes(0), and it round-trips too. - "
validate_extent_entry's segment index/count check is unkillable in its only caller": dropped unverified — I did not open the caller block atring.rs:495-510, so I make no claim either way. check.py --mutationsnot reported, CI status pending,docs/TODO.txtbookkeeping, and the #606 overlap as a merge objection: dropped as low-signal process items; the #606 overlap is recorded as informational only.
Full report 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.
Classify triage
Selected: triage:review
Threshold: 65%
Triage
- [✓]
triage:review: 98.2% -
triage:design-review: 1.6% -
none: 0.0% -
triage:validation: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0%
Apply labels
Applied: +triage:review, -triage:design-review