Skip to content

ignition: set USE_NODE_PRIORITY flag on exported CUDA graphs - #32

Closed
FujitsuPolycom wants to merge 27 commits into
mainfrom
perf/ignition-export-use-node-priority
Closed

FujitsuPolycom wants to merge 27 commits into
mainfrom
perf/ignition-export-use-node-priority

Conversation

@FujitsuPolycom

@FujitsuPolycom FujitsuPolycom commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Why

An exported serving graph needs CUDA's USE_NODE_PRIORITY instantiation flag (8) so Helios honors captured node priorities on instantiation without clobbering permitted flags already present on the captured executable.

What changed

Before: record_export_graph serialized executable-derived instantiation flags without USE_NODE_PRIORITY (or replaced the whole flag word instead of preserving prior permitted bits).

After: record_export_graph queries cuGraphExecGetFlags, validates both executable-derived and requested flags against PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS (9, bits 1 AUTO_FREE_ON_LAUNCH and 8 USE_NODE_PRIORITY, matching helios/src/runtime_core/format.rs), and records prior_flags | instantiation_flags with 8 enabled by default for serving graphs (1 | 8 = 9 when bit 1 was set). Passing instantiation_flags=None keeps executable-derived flags for startup tuning graphs.

Claimed benefit and result

Helios requests node priority from captured graph metadata when instantiating newly exported serving graphs while preserving permitted executable flags and existing signed-core compatibility.

Supporting evidence and limitations

Candidate 61f64f18e06cdcb9de76c33765584a97752f3953 on main (167f22c88076c1da801fe0ceca35f846d7295b24). Verified in WSL2:

  • python -m pytest -q -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py: 22 passed.
  • python -m pytest -q -rs tests/preparation/test_capture_graph_metadata.py tests/preparation/test_recorded_export_graph_cuda.py tests/preparation/test_runtime_core.py tests/preparation/test_preparation_reclamation.py tests/preparation/test_capture_stream_isolation.py: 46 passed, 15 skipped. Covers preserving bit 1 alongside bit 8 (9), executable-derived flags (None), and rejecting unsupported bits on either source before mutating graph state.
  • Live CUDA export, nondefault kernel-priority instantiation across target drivers, and signed-core flare run replay remain open GPU qualification on this revision.

Discord: Dooner

@FujitsuPolycom
FujitsuPolycom force-pushed the perf/ignition-export-use-node-priority branch from 17f4983 to 4cebca7 Compare November 28, 2026 17:56
@FujitsuPolycom
FujitsuPolycom changed the base branch from main-upstream to main November 28, 2026 17:56
@FujitsuPolycom
FujitsuPolycom force-pushed the perf/ignition-export-use-node-priority branch from 4cebca7 to 61f64f1 Compare November 28, 2026 19:59
lukealonso and others added 8 commits November 28, 2026 12:25
…down deadlock, and PatchMerge validation (NVIDIA#579)

Why

Four runtime defects in Helios affect core integrity verification, tensor-parallel startup teardown, multimodal image-preparation liveness, and PatchMerge image processing:

1. Core authorization hashes supporting payloads unconditionally and gates weight payloads on `--verify-weights` (default false). `PayloadSource::supporting_payload_ids()` collected only `rank.modules[..].globals` and `core.assets`, leaving all `rank.initializers` gated on `verify_weights`. On cache-backed exports (where `initial-state.safetensors` has a separate payload identity from `initial-state-globals.safetensors`) or ranks without module globals, `PayloadRole::InitialState` initializers carrying GPU dispatch tables and TMA `CUtensorMap` descriptors loaded into GPU memory without SHA-256 verification.
2. During `ThreadedExecutor::new()`, each peer thread that completes `GraphExecutor::new_unstarted()` enters the startup command loop waiting solely on `mpsc::Receiver<Command>` until `Command::FinishStartup` transitions it to `DispatchRing`. When a later peer fails `new_unstarted()` or thread spawn, dropping the partially constructed `ThreadedExecutor` calls `close()`, which signaled only `ring.request_drain()`. Initialized peers never observed `DispatchRing`, so `close()` timed out sequentially (120 s in the primary loop plus 120 s per peer in best-effort teardown) and abandoned rank-zero CUDA resources.
3. `Worker` tracks one global in-flight or buffered multimodal image preparation slot in `self.preparing_image`. Once the background worker delivers `active.prepared_image = Some(images)`, no further worker reply arrives to clear `self.preparing_image`. Teardown paths in `park()`, `publish()` (abandon, text-stop error, user stop, device error, and normal finish), `plan()` (copy-grammar failure), and `cancel_stopped()` cleared `self.active[slot]` without releasing `self.preparing_image`, permanently blocking all subsequent multimodal image preparation across the server.
4. `PreparedImageInput::valid_processed()` omitted `Profile::PatchMerge(_)`, falling through `_ => 588` instead of `1176` (`3 * 2 * 14 * 14` f32 values per patch) and rejecting every `materialize()` and `materialize_cached()` call for `PatchMerge` (MiniMax-M3-VL). `PatchProcessor::process()` also passed the hardcoded 16x16 constant `FEATURES` (`1536`) to `reserve_outputs`, over-allocating `pixel_values` capacity for 14x14 patches.

What changed

- `helios/src/runtime_core/protection.rs`:
  - Before: `supporting_payload_ids()` inspected only `rank.modules[..].globals` and `core.assets`.
  - After: `supporting_payload_ids()` also inserts every `rank.initializers` slice whose `source.role` is `PayloadRole::InitialState`. Weight (`Weights`, `TunedWeights`) initializers remain gated on `verify_weights`. Extended the TP2 payload fixture with standalone `initial-state/rank-{rank}.safetensors` `InitialState` initializers distinct from `globals/rank-{rank}.safetensors` and updated verification and rank-isolation tests.
- `helios/src/execution/threaded.rs`:
  - Before: `ThreadedExecutor` did not track whether peers had transitioned past `FinishStartup`, and `close()` signaled only `ring.request_drain()`.
  - After: Added `started: bool` (set `true` only after `startup` finishes `Command::FinishStartup` on all ranks), and extracted `close_peers`, `best_effort_drain_peers`, and `run_startup_phase`. When `!started`, both `close_peers` and `best_effort_drain_peers` send `Command::Drain` to startup peers in addition to `ring.request_drain()`, allowing initialized peers to drain, acknowledge `Reply::Drained`, and join immediately so rank zero executes `local.close()`. The serving-phase `DispatchRing` prepare/commit/cancel/drain happens-before order is unchanged. Added 3 multi-thread CPU tests covering pre-start close, pre-start best-effort drain after a peer disconnect, and post-start `DispatchRing` close.
- `helios/src/server/runtime.rs` and `helios/src/server/runtime/phase_tests.rs`:
  - Before: Individual teardown sites cleared `self.active[slot]` and `self.admissions[slot]` directly, only releasing `self.preparing_image` in `admit()` cancellation and `requeue()`.
  - After: Centralized active-slot removal in `clear_active_entry()` and `Worker::clear_active_slot()`, routing all active-slot removals (`complete_image_preparation`, `admit`, `publish`, `park`, `plan`, `requeue`, and `retire`/`cancel_stopped`) through it. Clearing a slot resets `preparing_image` when `removed.prepared_image.is_some()` and preserves it when `prepared_image` is `None` so an in-flight background worker reply still clears `preparing_image` once drained (guarded by `self.preparing_image == Some(handle)`). Added CPU worker tests covering `park()`, `publish()` device-error teardown, `cancel_stopped()`, and in-flight worker retention.
- `helios/src/frontend/images/conditioned.rs`, `helios/src/frontend/images/patches.rs`, and `helios/src/frontend/images/mod.rs`:
  - Before: `valid_processed()` used a wildcard `_ => 588` that misclassified `Profile::PatchMerge(_)`, and `PatchProcessor::process()` reserved `FEATURES` (`1536`) elements per patch regardless of `patch_size`.
  - After: Added `PatchProcessor::pixel_width()` (`3 * 2 * patch_size * patch_size`), used it in `PatchProcessor::process()` for both initial capacity and `reserve_outputs`, scoped `mod.rs::FEATURES` to `#[cfg(test)]`, and replaced the wildcard match in `valid_processed()` with an exhaustive match over `Profile`. Added `PatchMerge` and `Glm` to `conditioned::tests::settings()` and added `patch_merge_materializes_and_caches_with_exact_pixel_width`.

Claimed benefit and result

- Default core loads (`--verify-weights` unset) now SHA-256 verify all `PayloadRole::InitialState` initializers before uploading them to GPU memory; on the live TP2 and TP4 SM120 cores tested below, stored-data verification checked 1.3 GiB in 0.3 s and 306.1 MiB in 0.0 s respectively.
- Partial-initialization teardown in `ThreadedExecutor::close()` wakes and joins pre-start peers immediately via `Command::Drain` instead of timing out sequentially and abandoning rank-zero resources.
- Multimodal image preparation no longer deadlocks server-wide after request preemption (`park()`), device-error teardown (`publish()`), copy-grammar failure, or `cancel_stopped()` while a prepared image is buffered.
- `Profile::PatchMerge` (MiniMax-M3-VL) `materialize()` and `materialize_cached()` succeed with exact `1176` f32/patch length and capacity.

Supporting evidence and limitations

- Targeted P0 CPU release tests (`cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server -- runtime_core::protection:: execution::threaded::tests:: server::runtime::tests:: server::runtime::phase_tests::park_and_device_error_teardown_release_prepared_image_slot_for_next_request server::runtime::phase_tests::clear_active_slot_retains_in_flight_preparing_image_until_stale_reply_arrives server::runtime::phase_tests::prepared_image_window_stays_global_until_pack_or_cancellation frontend::images::conditioned::tests:: frontend::images::patch_merge::tests::`): 78 passed, 0 failed.
- Formal lifecycle conformance and mutation suite (`python3 verification/helios-lifecycle/check.py --tlc-jar /home/luke/.cache/flare-formal/tla2tools-1.7.4.jar --mutations`): passed across all 9 TLA+ models, all 8 observed-edge Rust conformance suites (`DispatchRing`, `ResponseLifecycle`, `Lifecycle`, `RankProtocol`, `OffloadTransfer`, `CacheOwnership`, `Speculation`, `CheckpointReservation`), all 12 TLA+ model mutations, all 19 Rust source mutations, and post-mutation re-verification.
- Full `helios` release unit suite (`cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server`): 1667 passed, 43 ignored, 7 unrelated failures (6 chat-template tests requiring `FLARE_TEST_TEMPLATE_DIR` and 1 pre-existing `model::tests::packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape`).
- `flare-cli` integration suites (`cache_commands`, `cli`, `inspect`, `unverified_payload`) plus `tests::actual_load_core_leases_managed_local_entries_and_releases_on_failure`: 25 passed, 0 failed (`flare-cli` bin suite had 1 unrelated `distribution::tests::source_waits_for_receiver_file_verification` BrokenPipe failure; `flare` lib suite had 225 passed and 2 unrelated local-HTTP `hub::tests` failures).
- Live multi-GPU collective serving on SM120 (RTX PRO 6000 Blackwell Max-Q) with the rebuilt `flare-cli/target/release/flare` binary:
  - TP2 `nvidia/Qwen3.8-Flash-Next-FP4-Local@gb202-tp2-202610270419` on GPUs 8,9: verified 1.3 GiB stored data without `--verify-weights` (0.3 s), served single text, 4-way concurrent chat completions, and 2 sequential PNG VLM requests, and drained cleanly on `SIGTERM` (exit 0 in 5.32 s).
  - TP4 `Inkling-2-Small-NVFP4@gb202-tp4-202611150002` on GPUs 8,9,10,11: verified 306.1 MiB stored data without `--verify-weights` (0.0 s), served single text, 4-way concurrent chat completions with prefix reuse, and 2 sequential PNG VLM requests, and drained cleanly on `SIGTERM` (exit 0 in 3.07 s).
- Unrun checks: no exported MiniMax-M3-VL (`Profile::PatchMerge`) core is present locally for live GPU serving (covered by CPU unit and cache tests); `cargo-kani` is not installed (no Kani-covered validators changed); `FLARE_TEST_TEMPLATE_DIR` chat templates were not fetched; partial-init failure in `ThreadedExecutor::new()` was verified on multi-thread CPU tests rather than injecting a live CUDA init fault.

Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=c3a9
Signed-off-by: Luke Alonso <lalonso@gmail.com>
On integrated GPUs, Helios reserves host-side multimodal buffers
(`input_window + source_window`) from the shared memory budget before
sizing KV and continuation cache pages in `helios/src/runtime_core/memory.rs`.
Previously, `ImageLimits::source_retention_bytes()` returned
`max_input_pixels * 8` (`512 MiB` under the default 64M-pixel ceiling)
regardless of a model's declared patch capacity, and `memory.rs` queried
`ImageLimits::default()` instead of the model's `VisionCapabilities`.
That buffer only caches decoded pixels opportunistically between HTTP
prompt admission and vision preprocessing; images outside the retention
budget are re-decoded on demand from their compressed bytes during
`ImageProcessor::materialize()`. Reserving a flat `512 MiB` withholds
`448-496 MiB` of unified memory from KV pages on memory-constrained
integrated GPUs without changing admission limits or decoding semantics.

Three files changed to derive decoded-source retention from the model's
vision contract in one place:
- `helios/src/frontend/images/mod.rs`: added
  `ImageLimits::for_vision(vision, context_tokens)` and bounded
  `ImageLimits::source_retention_bytes()` to
  `(max_input_pixels * 8).min((max_patches_per_image * 4096).clamp(16 MiB, 64 MiB))`.
  Admission limits (`max_input_pixels`, `max_images`,
  `max_patches_per_image`, and `max_total_patches`) are unchanged.
- `helios/src/server/config.rs`: delegated `image_limits()` to
  `ImageLimits::for_vision()` and verified `source_retention_bytes()` and
  `ImageProcessor::preparation_counts().decoded_source_capacity` in
  `image_limits_follow_graph_and_feature_storage_capacities`.
- `helios/src/runtime_core/memory.rs`: replaced
  `ImageLimits::default().source_retention_bytes()?` with
  `ImageLimits::for_vision(&contract.vision, context_tokens)?.source_retention_bytes()?`
  when `contract.vision.enabled()` is true so unified-memory sizing
  matches the runtime retention cap enforced by `ImageProcessor::load`.

Multimodal models now cap both decoded-source retention and the
integrated-GPU `source_window` reservation at `16 MiB` for `4,096`-patch
models up to `64 MiB` for models with at least `16,384` patches, down
from `512 MiB`. On integrated GPUs, this is expected to reclaim
`448-496 MiB` of unified memory for KV and state pages. Text-only models
and discrete-GPU VRAM sizing (`rank.integrated == false`) are unaffected.
On all platforms, concurrent bursts whose queued uncompressed pixels
exceed `64 MiB` before preprocessing incur an on-demand CPU re-decode
from compressed bytes instead of remaining cached up to `512 MiB`.

Validation:
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target -- images:: server::config:: runtime_core::memory::`
  passed (`61 passed, 0 failed, 1 ignored` GPU-only
  `cuda_memory_limits_account_for_context_and_allocations`) on x86_64 and
  ARM64 (Jetson AGX Orin).
- Full `helios` lib tests (`1,649 passed`), `flare` unit and integration
  tests (`226 + 2 retried single-threaded + 8 integration passed`), and
  `flare-cli` unit tests (`195 passed`) ran on x86_64; unrelated failures
  occurred in `model::tests::packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape`,
  `6` `helios` lib and `3` `message_boundaries` tests requiring
  `FLARE_TEST_TEMPLATE_DIR`, and `2` `flare-cli` distribution/lease tests
  (`source_waits_for_receiver_file_verification` and
  `actual_load_core_leases_managed_local_entries_and_releases_on_failure`).
- Live `flare run` on Jetson AGX Orin (`SM87`) with a `4,096`-patch
  multimodal core exposed `flare_input_decoded_source_capacity = 16777216`
  (`16 MiB`). Discrete-GPU high-concurrency multimodal burst re-decode
  overhead and `FLARE_TEST_TEMPLATE_DIR` template tests were not run.

Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
Signed-off-by: Luke Alonso <lalonso@gmail.com>
…t EOS (NVIDIA#573)

* helios: tolerate omitted closing tags on complete tagged tool calls at EOS

Models using tagged tool-call syntaxes occasionally finish a complete,
self-delimited argument payload and terminate with natural end-of-sequence
(EOS) without emitting the final closing wrapper tag (such as `</tool_call>`
in GLM argument-tag calls, `</function></tool_call>` in Qwen/MiMo function
tags, `<tool_call|>` in Gemma 4 calls, or `</invoke></tool_call>` in MiniMax
XML). Previously `TaggedTools::finish` rejected every unclosed call at
`Termination::Eos` unconditionally, failing the entire request even when all
arguments were closed and unambiguous.

Before this change, `TaggedTools::finish(Termination::Eos)` always returned
an incomplete-call error, `TaggedOutput::finish` did not increment `self.calls`
for tool calls emitted on finish, and `TaggedOutput` always set
`outer_tool_pending = D::FUNCTION.is_some()` after closing a tool even when
`D::CLOSE` had already been consumed.

This change adds a shared `ToolDialect::parse_eos(body, tools)` hook with no
per-model boolean flags and wires EOS recovery across all tagged dialects:

- `helios/src/output/tagged.rs`: Tracks whether `TaggedTools` entered
  `Mode::Tool` from a confirmed opener (`confirmed`) rather than an undecided
  tag promoted during `finish()`, tracks `outer_closed` so `outer_tool_pending`
  is only set when the inner closer ended the call, rejects unconfirmed calls
  and unfinished JSON strings on `Termination::Eos`, delegates confirmed EOS
  bodies to `D::parse_eos`, and advances `TaggedOutput.calls` when `finish()`
  emits `ToolBegin` events.
- `helios/src/output/argument_tags.rs`: Implements `ArgumentTags::parse_eos`
  requiring a valid function name (no `<`, `>`, or whitespace), at least one
  closed `<arg_key>...</arg_key><arg_value>...</arg_value>` pair, no trailing
  non-whitespace, and a non-strict tool.
- `helios/src/output/chatml.rs`: Implements `FunctionTags::parse_eos` and
  allows `parse_candidate` to close non-strict calls missing `</function>` at
  `</tool_call>` or EOS when at least one closed `<parameter=...>...</parameter>`
  is present with no trailing non-whitespace.
- `helios/src/output/gemma_call.rs`: Implements `GemmaCall::parse_eos` for
  non-strict brace-balanced `call:name{...}` payloads (including explicit `{}`)
  with no trailing non-whitespace.
- `helios/src/output/minimax_xml.rs`: Implements `MiniMaxXml::parse_eos` and
  allows `parse_candidate` to close non-strict invocations missing `</invoke>`
  at `</tool_call>` or EOS when at least one closed parameter element is
  present with no trailing unclosed elements or text.
- `helios/src/output/pipeline.rs`: Implements `PlainText::parse_eos` returning
  the existing unconfigured-parser error.
- `docs/api.md`: Documents the natural-completion recovery rules and the
  rejected/omitted cases.

Bare headers without a closing argument delimiter (such as `<tool_call>run` or
`<tool_call><function=lookup>`), undecided openers, partial arguments, trailing
non-whitespace, `strict: true` calls missing their wire closer, and all non-EOS
terminations (`OutputLimit`, `UserStop`, `Cancelled`, `ExecutionError`) remain
rejected or omitted.

Verified with Helios unit tests across all tagged dialects, protocol encoder
tests across Chat/Messages/Responses (buffered and streamed), logprob and
reasoning-token accounting tests, and DeepSeek output tests.

Design-Signed-Off-By: Luke Alonso <lalonso@gmail.com>; design-review=c3a9
Signed-off-by: Luke Alonso <lalonso@gmail.com>

* helios: add Kani proofs and mutation-driven tests for tagged tool parsing

Tagged tool-call framing relies on sequential invariants that example tests
alone do not exhaustively establish: `partial_marker` must return the exact
longest proper prefix on a UTF-8 char boundary, `select_candidate` must pick
the earliest closing tag without overflow and track `outer_closed`, and
`TaggedTools::eos_decision` must omit non-EOS terminations and reject
unconfirmed or mid-JSON-string EOS states. Mutation testing against the EOS
recovery diff also surfaced 16 untested boundary paths across the tagged
dialects.

Before this change, `cargo kani` covered only `execution/transport.rs`,
`model.rs`, and `model/contract.rs` under default features, and `helios/src/output/`
had no Kani proofs or mutation-calibrated boundary tests for `starts_call`
prefix monotonicity, `<`/`>` in GLM `ToolBody` names, `in_json_string` at EOS,
`outer_tool_pending` after `outer_closed`, bare `<function=lookup>` in
`parse_eos`, `TaggedOutput.calls` post-finish, or multi-call `emit_calls`
indexing.

This change adds four Kani proofs in `helios/src/output/tagged/kani_proofs.rs`,
enables them in CI under `cargo kani --manifest-path helios/Cargo.toml --features runtime-core --lib`,
and closes the mutation-testing gaps:

- `helios/src/output/tagged.rs` and `helios/src/output/tagged/kani_proofs.rs`:
  Extracts `TaggedTools::eos_decision` and `select_candidate`, simplifies
  `partial_marker` from a nested iterator chain to an explicit reverse byte
  scan preserving UTF-8 char boundaries, and adds four Kani harnesses
  (`partial_marker_ascii_matches_oracle`, `partial_marker_utf8_preserves_char_boundaries`,
  `tagged_tools_eos_decision_enforces_termination_and_confirmation`, and
  `select_candidate_picks_earliest_closer_and_tracks_outer_closed`) with
  `kani::cover!` reachability checks.
- `helios/src/lib.rs`, `.github/workflows/helios-lifecycle.yml`, and
  `verification/helios-lifecycle/README.md`: Gates `pub mod output` on
  `any(feature = "server", all(kani, feature = "runtime-core"))`, runs CI
  Kani with `--features runtime-core`, and documents the four proofs and their
  domains and limits.
- `helios/src/output/{tagged,argument_tags,chatml,pipeline}.rs`: Adds
  exhaustive prefix-monotonicity tests for `ArgumentTags::starts_call` and
  `FunctionTags::starts_call` (plus `possible_parameter_start` prefix
  completeness) and targeted unit tests killing all 16 real surviving mutants.

Verified with `cargo kani --manifest-path helios/Cargo.toml --features runtime-core --lib`
(11/11 harnesses passing, 0 failures), `cargo-mutants` across all 168 mutants
in the `helios/src/output/` diff (157 caught, 7 unviable, 2 timeouts on
infinite-loop mutations, 2 mathematically equivalent survivors), and release
Helios unit/protocol/logprob/grammar/DeepSeek tests (206 + 14 passing).

Design-Signed-Off-By: Luke Alonso <lalonso@gmail.com>; design-review=c3a9
Signed-off-by: Luke Alonso <lalonso@gmail.com>

---------

Signed-off-by: Luke Alonso <lalonso@gmail.com>
* Add DGX Spark CX7 preflight checks to flare doctor

Multi-host serving on DGX Spark needs an active ConnectX-7 interface with
an IPv4 RoCEv2 GID. The existing PCIe diagnostics leave operators to verify
the Spark fabric separately before launch.

Detect the DGX Spark GB10 PCI device and reuse serving's RoCE discovery
to report CX7 interfaces, IPv4 prefixes, and MTUs. Fail when discovery
finds no active CX7 device with an assigned IPv4 RoCEv2 endpoint. Warn
about overlapping subnets, suspect addresses or prefixes, and MTUs below
9000 bytes. Apply PCIe tuning checks on Sparks when selected GPU pairs
require PCIe P2P.

Operators can run one command on each Spark to find local fabric issues
before launching a multi-host core.

All 10 focused Flare doctor tests passed on Linux x86_64. The ARM64 CLI
reported exactly one passing CX7 check on each of four DGX Sparks with
two active IPv4 RoCEv2 devices at MTU 9000. The live check covered local
configuration. Peer reachability and RDMA throughput require separate tests.

Design-Signed-Off-By: Codex (GPT-6.2-sol); design-review=eb2f
Signed-off-by: Drew Botwinick <dbotwinick@nvidia.com>

* Report CX7 preflight applicability on GB10 and N1X

The Spark diagnostics matched a single PCI ID and failed when no CX7
device or link was available. A GB10 or RTX Spark N1X host may serve
locally without a CX7 fabric. A single-GPU report also omitted the PCIe
checks without saying why.

Use the shared GB10 device table and probe PCI for the ConnectX-7 adapter
before looking for RDMA devices. Report an absent adapter as not applicable
and warn about an installed adapter with no usable endpoint. Report PCIe
applicability explicitly. Reuse the serving predicates for link state, GID
selection, and link-local subnets. Distinguish devices beyond the serving
limit from missing GIDs and allow link-local interfaces to share a subnet.
Describe MTU below 9000 as a throughput advisory.

A standalone host can run doctor successfully, while operators configuring
a multi-host core still get the local interface, subnet, and MTU details
they need to find configuration issues.

Linux release tests for Flare doctor passed, covering absent adapters for
all five PCI IDs, one configured interface, advisory MTU 1500, subnet
overlap, and a fifth active device. Helios RoCE fabric tests passed with
runtime-core and server features, covering GID selection and rail planning.
On four DGX Sparks the ARM64 CLI passed with two active CX7 interfaces at
GID index 3 and MTU 9000. With its GPU hidden, one Spark reported PCIe as
unverified and still passed CX7. The absent-adapter case used synthetic PCI
data. The live check did not exercise peer traffic or measure throughput.

Design-Signed-Off-By: Codex (GPT-6.2-sol); design-review=eb2f
Signed-off-by: Drew Botwinick <dbotwinick@nvidia.com>

* Report observed CX7 MTUs and serving endpoints

MTU 1500 is a valid setting for switched Spark fabrics, but doctor warned
on every value below 9000. Doctor also inferred why serving left devices
out of its selection and could suggest fixing a GID when discovery could
not resolve a local IPv4 prefix.

Report the observed MTU and leave the internal MTU preference unset.
Read the device selection from serving's discovery result. List other
active devices by name and report unresolved IPv4 addresses and prefixes
on selected devices. Document the switched cluster used for the live
check and record the remaining qualification work.

Operators can compare the actual interface settings without a warning
for a valid MTU or a diagnosis based on an inferred selection reason.

The Linux x86_64 release doctor tests passed with default features.
Fixtures verified a single usable interface at MTU 1500, unreadable MTU
warnings, and distinct reports for unselected and unresolved devices.
The ARM64 CLI passed on four DGX Sparks configured as a switched cluster,
with two active interfaces per node on separate IPv4 /24 subnets, RoCEv2
GID index 3, and MTU 9000. N1X hardware, peer reachability, and throughput
at different MTUs remain untested.

Design-Signed-Off-By: Codex (GPT-6.2-sol); design-review=eb2f
Signed-off-by: Drew Botwinick <dbotwinick@nvidia.com>

---------

Signed-off-by: Drew Botwinick <dbotwinick@nvidia.com>
Automatic Hub revision detection and core export naming previously
recognized only `ga102`, `ga10b`, `gb10`, `gb202`, and `gb300` in
`helios/src/core/naming.rs`. Running `flare download`, `flare run`, or
core export naming on NVIDIA Blackwell GB206 GPUs (such as GeForce RTX
5060 Ti, PCI device ID `0x2d04`) therefore failed with an unsupported
PCI ID error unless `--revision` was specified manually. Adding `gb206`
to the shared PCI-to-platform table extends hardware detection, catalog
matching, and export naming without duplicating device tables.

What changed:
- `helios/src/core/naming.rs`: expands `PLATFORMS` from 5 to 6 entries
  (`["ga102", "ga10b", "gb10", "gb202", "gb206", "gb300"]`), defines
  `GB206_DEVICES` with 9 NVIDIA GB206 PCI device IDs (`0x2d04`,
  `0x2d05`, `0x2d18`, `0x2d19`, `0x2d30`, `0x2d39`, `0x2d58`, `0x2d59`,
  `0x2d79`), adds a `GB206_DEVICES` branch in `platform_from_pci`, and
  adds unit tests covering every `GB206_DEVICES` entry and rejecting
  non-NVIDIA vendor IDs (`0x2d04_1af4`).
- `flare/src/catalog.rs`: adds `{"name": "gb206"}` to the all-platforms
  branch fixture in `published_build_match_uses_all_platform_branches`.
- `flare-cli/src/cli.rs`, `docs/cli-design.md`, and
  `docs/core-format-design.md`: lists `gb206` alongside the other
  supported platform revision and cache-entry identifiers.
- Orbit GPU revision detection (`flare-cli/src/orbit/gpu.rs`) remains
  unchanged.

Result:
`flare` device detection, Hub catalog platform matching, and core export
naming recognize supported NVIDIA GB206 PCI device IDs as `gb206` while
preserving all existing platform mappings (`ga102`, `ga10b`, `gb10`,
`gb202`, and `gb300`).

Evidence:
- Local CPU tests (`--locked --release`) on merged head `e4166286` (base
  `2bdc8472`):
  - `helios` (`--features runtime-core,server --lib -- core::`): 483
    passed, 0 failed, 11 ignored (including `core::naming::` tests for
    `gb206`, `ga10b`, and `gb300`).
  - `flare`: 228 unit tests passed (4 ignored), 7
    `packed_canonical_download` tests passed, and 1 `reference_workflows`
    test passed (including
    `catalog::tests::published_build_match_uses_all_platform_branches`).
  - `flare-cli`: 24 integration tests passed (`cache_commands`: 7,
    `cli`: 6, `inspect`: 4, `unverified_payload`: 7); 196 of 197 unit
    tests passed (3 ignored), with 1 unrelated pre-existing `BrokenPipe`
    failure in
    `distribution::tests::source_waits_for_receiver_file_verification`.
- Author-reported hardware verification on PR NVIDIA#502: verified on GeForce
  RTX 5060 Ti 16GB (`0x2d04`).
- Limitations: live GB206 hardware detection and the remaining PCI IDs
  in `GB206_DEVICES` were not exercised locally in this merge
  environment, and Orbit placement remains capability-derived.

Signed-off-by: Wiktor Zdrojewski <wiktorzd@wp.pl>
Co-Authored-By: Luke Alonso <lalonso@gmail.com>
Signed-off-by: Luke Alonso <lalonso@gmail.com>
Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
…ne unified-memory budgeting (NVIDIA#589)

Three concrete defects affect CUDA 12.x GPUs, stock JetPack 6 / Ubuntu 22.04
Linux hosts, and unified-memory prefix-cache offloading:
1. On CUDA < 13.0 drivers where `cuMemcpyBatchAsync_v2` is absent,
   `Stream::copy_batch` in `helios/src/cuda.rs` fell back to
   `cuMemcpyDtoDAsync_v2`. Callers in `helios/src/execution/transport.rs` and
   `helios/src/offload/transfer.rs` pass raw pinned-host pointers from
   `cuMemHostAlloc(..., 0)` alongside device pointers, which breaks discrete
   CUDA 12.x GPUs because `cuMemcpyDtoDAsync_v2` requires device-to-device
   semantics whereas `cuMemcpyAsync` infers transfer direction under UVA.
2. `.github/workflows/release.yml` built Linux release tarballs on Ubuntu 24.04
   runners (`GLIBC_2.39`), and `helios/build.rs` hard-linked `libibverbs` when
   the `roce` feature is enabled (default on Linux aarch64). Stock JetPack 6
   (Ubuntu 22.04, `glibc 2.35`, without `libibverbs1`) therefore could not
   execute `flare-linux-arm64.tgz`, which CI missed because smoke checks ran
   only in `ubuntu:24.04` with `libibverbs1` installed.
3. In `selene/src/offload.rs`, `host_pool_budget` always subtracted an unscaled
   `2 GiB + total / 20` reserve and `prepare_with_inputs` re-evaluated it after
   GPU KV allocation—ignoring small-SoC headroom scaling (`<= 16 GiB` and
   `<= 64 GiB`) and explicit `--memory-limit` settings on integrated GPUs, which
   shrunk intake or failed pool-only capture startup. Separately, memory-only
   `--prefix-cache-memory` unconditionally required `HOST_NUMA` VMM split
   allocation (`SlabPool::sized_by_rank`), failing on GA10B and Windows WDDM.
   Finally, `eos/src/unix.rs` passed `MAP_POPULATE` to `mmap` before calling
   `madvise(MADV_HUGEPAGE)`, faulting 4 KiB base pages before transparent huge
   page advice took effect.

Changes:
- CUDA 12 batched-copy fallback (`helios/src/cuda.rs`,
  `docs/prefix-cache-offload.md`): Added `cuMemcpyAsync` to `Driver` and
  replaced `cuMemcpyDtoDAsync_v2` in `Stream::copy_batch`'s fallback loop with
  `cuMemcpyAsync` while retaining `cuMemcpyDtoDAsync_v2` for `copy_dtod_async`.
- Lazy `libibverbs.so.1` loading and Ubuntu 22.04 release builds
  (`helios/native/roce_proxy_dlopen.c`, `helios/build.rs`,
  `helios/src/execution/roce.rs`, `.github/workflows/release.yml`,
  `flare-cli/Cargo.toml`, `flare/Cargo.toml`, `helios/Cargo.toml`,
  `docs/release.md`, `docs/runtime-core-design.md`, `docs/multi-host.md`):
  Replaced direct `-libverbs` linking in `helios/build.rs` with `-ldl` and
  compiled `helios/native/roce_proxy_dlopen.c`, which lazily loads
  `libibverbs.so.1` via `dlopen` / `dlvsym` (`IBVERBS_1.1`, optional
  `IBVERBS_1.8`) under `pthread_once` and wraps the vendored
  `helios/native/roce_proxy.c` without modifying it. `RoceTransport::open`
  calls `roce_ensure_libibverbs` after preflight checks so missing RDMA
  libraries fail with an install hint only during multi-host RoCE setup.
  Updated `.github/workflows/release.yml` to build and package both Linux
  targets inside `ubuntu:22.04`, assert no `libibverbs.so` `DT_NEEDED` entry
  and no `GLIBC_` symbol version above `2.35`, and smoke-test the extracted
  archive in clean `ubuntu:22.04` and `ubuntu:24.04` containers without
  `libibverbs1`.
- Selene host budgeting, `HOST_NUMA` fallback, and Eos THP ordering
  (`selene/src/offload.rs`, `selene/src/offload/tests.rs`,
  `selene/src/registrar.rs`, `selene/src/slab.rs`, `helios/src/cuda.rs`,
  `helios/src/offload/mod.rs`, `helios/src/offload/registrar.rs`,
  `helios/src/runtime_core/memory.rs`, `helios/src/runtime_core/model.rs`,
  `eos/src/unix.rs`, `docs/prefix-cache-offload.md`):
  Replaced the fixed `2 GiB` host headroom in `selene/src/offload.rs` with
  `host_service_headroom_bytes` (`64 MiB` at `<= 16 GiB`, `min(2 GiB, total / 32)`
  above `16 GiB`) shared by `helios/src/runtime_core/memory.rs`. Added
  `integrated_offload_host_budget` to honor explicit `--memory-limit` on
  integrated GPUs without implicit reserves, and threaded the pre-planned
  offload host budget from `NativeModel::allocate_caches` into
  `NativeModel::prepare_offload` -> `prepare_with_inputs_budget` so
  post-KV-allocation setup matches the budget already reserved. Added
  `try_map_device_host_parts` / `HostRegistrar::try_map_split` /
  `SlabPool::try_sized_by_rank` so `CUDA_ERROR_INVALID_VALUE` (1) or
  `CUDA_ERROR_NOT_SUPPORTED` (801) on `HOST_NUMA` VMM falls back to a
  registered anonymous mapping while real errors such as OOM still propagate.
  Updated `eos/src/unix.rs::map_host` to omit `MAP_POPULATE`, call
  `madvise(MADV_HUGEPAGE)` first, and then prefault via
  `madvise(MADV_POPULATE_WRITE)` on Linux with a page-stride `write_volatile`
  fallback.

Claimed results:
- Observed on x86_64 Linux: building `flare-cli --features roce` inside
  `ubuntu:22.04` with `libibverbs-dev` produces an executable with `Max GLIBC:
  GLIBC_2.34`, no `libibverbs.so` `DT_NEEDED` entry, and no `ibv_*` dynamic
  symbols, passing `flare --version` and `flare {run,agent,orbit} --help` in
  clean `ubuntu:22.04` and `ubuntu:24.04` containers without `libibverbs1`.
  `eos::map_host` sets `MADV_HUGEPAGE` (`VmFlags: hg`) before prefaulting.
- Expected on hardware not tested here: stock JetPack 6 ARM64 hosts can run
  `flare-linux-arm64.tgz` without `libibverbs1`, discrete CUDA 12.x GPUs execute
  `Stream::copy_batch` without `cuMemcpyDtoDAsync_v2` host-pointer failures, and
  GA10B / Windows WDDM hosts support `--prefix-cache-memory` without `HOST_NUMA`
  VMM failure or post-KV-allocation host-budget double-subtraction.

Supporting evidence and limitations:
- `cargo test --locked --release --manifest-path eos/Cargo.toml`: 2 passed
  (including `map_host_advises_hugepages_and_prefaults_zeroed_pages`).
- `cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support`:
  506 passed (including small-SoC/explicit-limit budget tests,
  `prepare_with_inputs_budget` tests, and `HOST_NUMA` fallback vs OOM tests).
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server,roce --lib -- cuda::tests runtime_core::memory::tests runtime_core::model::tests offload:: execution::roce::tests`:
  40 passed, 16 ignored (GPU-only), including
  `lazy_libibverbs_loader_resolves_symbols_or_reports_install_hint` and
  `integrated_offload_host_budget_matches_small_soc_scaling_and_explicit_limits`.
- `cargo test --locked --release --manifest-path flare/Cargo.toml`: 228 passed
  across full run (226 passed + 2 hub tests passed on individual rerun), 4
  ignored.
- `cargo test --locked --release --manifest-path flare-cli/Cargo.toml`: 24/24
  integration tests passed (`cache_commands`, `cli`, `inspect`,
  `unverified_payload`); 196 unit tests passed (195 + 1 serial rerun), 3
  ignored, with 1 unrelated timeout/BrokenPipe in untouched
  `distribution::tests::source_waits_for_receiver_file_verification`.
- `cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support`:
  84/85 passed in `tests/client.rs`; 1 unrelated failure in untouched
  `a_record_put_into_a_manager_on_another_host_is_restored_over_tcp`
  (`stream: 2 windows` vs `>= 3` on `moved()` metrics snapshot).
- End-to-end x86_64 Docker build in `ubuntu:22.04` (`--features roce`,
  `libibverbs-dev`, `packaging/archive.py`) + ELF `DT_NEEDED`/`--version-info`
  checks + clean `ubuntu:22.04` and `ubuntu:24.04` smoke checks passed.
- Unrun checks: native `aarch64` build and `ubuntu-24.04-arm` CI run, live
  hardware GPU tests on discrete CUDA 12.x / Jetson Orin GA10B / Windows WDDM,
  and full `helios` chat-template tests requiring `FLARE_TEST_TEMPLATE_DIR`.

Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=c3a9
Signed-off-by: Luke Alonso <lalonso@gmail.com>
Captured CUDA graphs already receive per-request inputs such as token IDs,
positions, and the six-column sampling parameters, which are consumed only by
post-logit sampling. Model recipes that condition forward computation on a
client-supplied FP32 parameter cannot reuse the sampling layout without widening
a contract shared by every core, and cannot isolate prefix-cache checkpoints by
the conditioning value without native scheduler support. Declaring named FP32
core parameters in the model contract lets a single loaded core serve requests
with different conditioning values without model-specific native policy or
per-model flags.

This change extends the runtime core contract, Helios runtime, Heliopause
exporter, and Ignition preparation and direct-execution paths additively:

- Schema and helpers (`helios/proto/runtime_core.proto`,
  `ignition/preparation/runtime_core_pb2.py`,
  `ignition/preparation/contract.py`): add `ModelContract.core_parameters = 8`,
  `CoreParameter`, `CoreParameterRange`, `ValueSource::CORE_PARAMETER = 43`,
  and `ValueBinding.parameter = 7`, keeping `ModelContract.version` at 3 and
  leaving existing cores without declarations unchanged.
- Contract and export validation (`helios/src/model/contract.rs`,
  `helios/src/runtime_core/protobuf.rs`, `heliopause/src/export/binding.rs`):
  validate unique nonempty names, required finite FP32 defaults, ordered finite
  ranges containing their defaults, contiguous width-one FP32 destination
  buffers covering prepared request capacity, zero offset and padding, and an
  empty `tensor` field. Restrict `CORE_PARAMETER` bindings to text forward
  graphs (`PREFILL`, `TERMINAL_PREFILL`, `SCORED_PREFILL`, `RESUME`, `DECODE`,
  `SPECULATIVE`, and `MIXED`), rejecting `VISION`, `INIT`, `RESTORE`, and
  `SNAPSHOT` graphs, and require every selected text forward graph to bind every
  declared core parameter so no forward step can read stale slot storage.
- HTTP decoding, discovery, admission, prefix hashing, and packing
  (`helios/src/server/`, `helios/src/scheduler.rs`, `helios/src/cache/hash.rs`,
  `helios/src/model/{admission,packing}.rs`): accept an optional top-level
  `core_parameters` object on Chat, Completions, Responses, and Messages
  requests (treating omitted or `null` as prepared defaults, rejecting unknown
  names, non-objects, booleans, non-numbers, non-finite values, magnitudes
  above `f32::MAX`, and nonzero underflow to FP32 zero with HTTP 400), clamp
  finite values to declared inclusive ranges, canonicalize `-0.0` to `+0.0`,
  advertise declarations under `flare.core_parameters` in `/v1/models`, hash
  every declared core parameter in declaration order into the prefix-history
  root (leaving the root hash unchanged when no core parameters are declared),
  retain the resolved map in `AdmissionPlan` across pool lookup retries and
  preemption/readmission, verify exact bit equality against the planned value
  during step packing, and pre-allocate staging storage in `Inputs::new` with
  checked offset and extent arithmetic.
- Direct diagnostic execution and documentation (`ignition/direct/`,
  `docs/api.md`, `docs/direct-execution.md`, `helios/model-contract.md`):
  mirror the same text-forward binding rules, top-level-only `core_parameters`
  decoding, `/v1/models` metadata, packing, immutable request parameter map,
  and checkpoint isolation.

Claimed result: a model core can declare generic per-request FP32 core
parameters consumed by text forward graphs with shared admission validation,
prefix-cache isolation, and zero steady-state packing allocation, while cores
without declarations retain their wire contract and prefix-cache hashes. No
recipe in this repository binds a core parameter, and no throughput or
output-quality improvement is claimed.

Supporting evidence and limitations:
- Python CPU tests (`tests/direct`, `tests/cli`,
  `tests/preparation/test_core_boundary.py`): 218 passed, 2 CUDA-gated skipped.
- Rust CPU tests (`--locked --release`): `flare-helios --features
  runtime-core,server --lib` 1,692 passed, 43 ignored, 1 unrelated pre-existing
  `origin/main` failure (`packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape`);
  `flare-helios --test '*'` 61 passed, 37 ignored; `flare-heliopause` 209
  passed, 5 ignored (including `serving_metadata_round_trips_and_validates_core_parameters`);
  `flare` 236 passed, 4 ignored; `flare-cli` 224 passed, 3 ignored
  (`distribution::tests::source_waits_for_receiver_file_verification` skipped as
  a pre-existing 130 s environment failure).
- TLA+ models and Rust lifecycle conformance (`verification/helios-lifecycle/check.py`,
  TLC 2.19): all 9 models, model mutations, Rust source mutations, and observed
  Rust transition replays passed across all 8 conformance suites.
- Kani (`cargo kani --manifest-path helios/Cargo.toml --lib`, Kani 0.68.0 /
  CBMC 6.11.0): 9 of 9 harnesses verified, 0 failures, including
  `core_parameter_validation_enforces_finite_ordered_bounds` and
  `core_parameter_resolution_produces_valid_canonical_value`.
- Unrun checks: live GPU export and serving of a core declaring
  `core_parameters` were not run on this rebased revision in this CPU
  verification environment.

Signed-off-by: Joshua Cartu <jcartu@users.noreply.github.com>
Co-Authored-By: Luke Alonso <lalonso@gmail.com>
Signed-off-by: Luke Alonso <lalonso@gmail.com>
Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
Fixes NVIDIA#481

Why:
Three defects affect Helios disk-backed and resident embedding tables, and
PreparedPLELookup in core ignition lacked an advisory lookahead publish path
needed for Qwen3.8's disk-backed per-layer embedding (PLE) table:

1. Multi-worker queue-depth collapse on Unix and Windows
   (helios/src/engram/reader.rs, helios/src/engram/reader/windows.rs) and
   direct Reader::warm truncation (helios/src/engram/reader.rs,
   helios/src/engram.rs): both Unix DiskReader and Windows Readers split the
   fixed DEPTH (128) slot budget evenly across workers (lane_depth = DEPTH /
   workers: 64, 32, or 16 for 2, 4, or 8 workers), yet both routed every batch
   with reads.len() <= DEPTH to lanes[0] alone. For 17-128 reads with 4 or 8
   workers (including Windows' default of 4 workers), effective queue depth
   collapsed 4x-8x onto one lane. Separately, CachedReader::warm silently
   truncated &ids[..ids.len().min(self.max_rows)]; while the serving reader
   loop already bounds pending_warm.len() <= prefetch_max_rows <= max_rows
   through core validation, direct Reader::warm callers passing more than
   max_rows IDs silently dropped tail rows.
2. Pre-6.7 Linux EPERM on sealed resident tables (helios/src/engram/reader.rs,
   NVIDIA#481): Resident::initialize seals its O_RDWR memfd with F_SEAL_WRITE and
   then calls mmap(PROT_READ, MAP_SHARED) on the same O_RDWR descriptor. Linux
   kernels older than 6.7 reject shared mappings whose descriptor retains write
   permission (VM_MAYWRITE), causing --embedding-table-storage ram startup to
   fail with EPERM.
3. Unchecked mailbox byte-length multiplication and scored_prefill omission
   (helios/src/runtime_core/engram.rs, helios/src/engram.rs): validate_mailbox
   computed mailbox.shape[0] * 8 without overflow checking. In release builds,
   a malformed shape[0] such as (1 << 61) + 1 or 1 << 61 wraps to 8 or 0,
   bypassing validation and reaching out-of-bounds reads or pointer underflow
   (address + nbytes - 8) in Transfers::new and Requests::read. Both graph-kind
   filters in runtime_core/engram.rs also omitted "scored_prefill", diverging
   from engram::consumes.
4. Missing PLE advisory lookahead interface (ignition/components/ngram_delivery.py):
   PreparedEngramRequests exposed publish_lookahead, whereas PreparedPLELookup
   exposed only synchronous publish, blocking Qwen3.8 PLE recipes from using
   EngramTable.prefetch_buffer.

What changed:
- helios/src/engram/reader.rs and helios/src/engram/reader/windows.rs:
  - Before: both Unix DiskReader::gather and Windows Readers::gather dispatched
    to lanes[0] whenever reads.len() <= DEPTH (128).
  - After: both call shared helper lane_fanout(reads, lanes), which compares
    reads against DEPTH / lanes and fans across reads.div_ceil(lane_depth)
    .min(lanes) active lanes with reads.div_ceil(active_lanes) reads per lane.
  - Before: CachedReader::warm truncated &ids[..ids.len().min(self.max_rows)]
    and accounted only for the truncated prefix.
  - After: CachedReader::warm processes ids.chunks(self.max_rows) and
    increments prefetch_rows_loaded per completed chunk.
  - Before: ResidentMapping::new mapped file.as_raw_fd() directly for
    read-only remaps.
  - After: on Linux when !writable, ResidentMapping::new reopens
    /proc/self/fd/<fd> read-only (O_RDONLY | O_CLOEXEC) for mmap, falls back
    to file.as_raw_fd() if procfs is unavailable, and includes any reopen
    io::Error alongside a pre-6.7 kernel hint if mmap returns EPERM.
- helios/src/engram.rs:
  - Before: ReaderAction::Warm sliced by WARM_BATCH_ROWS (1024) directly, and
    Transfers::new subtracted 8/16 from nbytes without capacity checks.
  - After: ReaderAction::Warm caps its batch size to
    WARM_BATCH_ROWS.min(max_tokens * heads).max(1), and Transfers::new verifies
    checked minimum byte sizes for both request and prefetch mailboxes before
    computing flag and count addresses.
- helios/src/runtime_core/engram.rs:
  - Before: validate_mailbox used unchecked shape[0] * 8, did not check
    MappedHost allocation bounds against offset + nbytes, and skipped
    "scored_prefill" in both graph-kind filters.
  - After: uses checked_mul(8) and checked_add, verifies offset + nbytes fits
    inside the named MappedHost allocation, and includes "scored_prefill" in
    both graph-kind filters.
- ignition/components/ngram_delivery.py:
  - Before: PreparedPLELookup exposed only publish.
  - After: adds PreparedPLELookup.publish_lookahead(ids, count, step), writing
    row IDs, row count (nbytes - 16), and sequence flag (nbytes - 8) into a
    prepared lookahead buffer during graph capture.

Claimed benefit and result:
- Expected: eliminates pre-6.7 Linux EPERM startup failure for resident RAM
  tables (NVIDIA#481), restores multi-worker NVMe queue depth for 17-128 read batches
  on both Unix io_uring and Windows I/O rings, prevents release-build u64
  overflow and allocation overrun in mailbox loading, aligns scored_prefill
  validation with engram::consumes, and unblocks disk-backed PLE lookahead
  prefetch in Qwen3.8 recipes.
- Measured (strictly attributable to PreparedPLELookup.publish_lookahead paired
  with the companion Qwen3.8 recipe change in
  local-inference-lab/hyperflare-recipes#87, not to the reader or validator
  fixes): on Qwen3.8-Flash-Next-NVFP4-MXFP8-CSF-QAD TP1 on RTX PRO 6000
  Blackwell (SM120, /dev/md0 NVMe RAID, exported core gb202-tp1-202611282155,
  --embedding-table-storage disk --embedding-table-cache-size 4GiB
  --embedding-table-resident-scales --embedding-table-workers 1), synchronous
  PLE gather time dropped 76.5% (0.881 s -> 0.207 s; row-cache hit 43.1% ->
  94.7%) and cold 111,915-token TTFT dropped 4.6% (7.778 s -> 7.418 s; 14,388
  -> 15,087 tok/s) with flare_engram_prefetch_errors_total = 0 and 4/4
  needle-in-a-haystack passkey matches.

Supporting evidence and material limitations:
- cargo test --locked --release --manifest-path helios/Cargo.toml --features
  runtime-core,server --lib -- engram: 45 passed, 0 failed (covers lane_fanout
  across 1/2/4/8 workers, Unix io_uring multi-lane fan-out for 80 reads below
  DEPTH, chunked CachedReader::warm past max_rows, /proc/self/fd read-only
  remap with F_GETFL == O_RDONLY and mprotect EACCES, u64 mailbox overflow and
  MappedHost overrun rejection, and scored_prefill validation).
- cargo test --locked --release --manifest-path flare/Cargo.toml: 228 + 7 + 1
  passed, 0 failed, 4 ignored.
- cargo check --locked --release --manifest-path heliopause/Cargo.toml: clean.
- cargo clippy --locked --release --manifest-path helios/Cargo.toml --features
  runtime-core,server --lib --tests: 0 warnings in modified lines.
- pytest tests/preparation/test_core_boundary.py tests/cli -q: 137 passed.
- Limitations:
  - The paired Qwen3.8 served benchmark ran at --embedding-table-workers 1,
    which bypasses multi-worker fan-out; multi-worker QD fan-out, pre-6.7
    EPERM handling, and u64/scored_prefill validation are verified by unit
    tests rather than exercised by that served run.
  - Pre-6.7 Linux EPERM handling was verified on Linux 6.18 via F_GETFL ==
    O_RDONLY and mprotect EACCES rather than on a kernel older than 6.7.
  - Windows compilation and runtime I/O ring execution were not run on this
    Linux host; Windows shares the unit-tested lane_fanout planner with Unix.

Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
Signed-off-by: Luke Alonso <lalonso@gmail.com>
@FujitsuPolycom
FujitsuPolycom force-pushed the perf/ignition-export-use-node-priority branch from 61f64f1 to 18312bd Compare November 29, 2026 00:12
eugr and others added 10 commits November 28, 2026 17:38
* feat(winui): manage prepared core updates

WinUI can identify installed Hugging Face cores from the acquisition
records in the shared cache. The library previously offered to run the
installed version and left users to check for publisher updates and
manage retained versions outside the desktop app.

The desktop controller now checks recorded Hub revisions and compares
each available commit with the deployments already installed. The
WinUI bridge carries the result to the Update action and the launch
prompt. An approved update passes the displayed commit and recorded
file and tensor-parallel selection to shared acquisition. Successful
verification selects that version. Library cards show the installed
version and its commit date or cache creation date, mark earlier
entries for the same build, and confirm deletion through the cache's
existing lease-aware removal operation.

Users can discover and install a prepared-core update from WinUI,
choose which retained version to run, and remove one version while
other entries retain their shared payloads.

On Windows ARM64, the Flare and WinUI bridge tests passed. A local Hub
fixture verified acquisition of the approved commit and separation of
installed and available update dates. Signed cache fixtures verified
duplicate-offer suppression and that removal and collection preserved
the retained deployment. The ARM64 Release build and embedded bundle
extraction passed. CLI integration tests passed. Two CLI doctor unit
tests failed because Windows rejects their Linux sysfs fixture names. The legacy core
fixture checks and a live update followed by GPU serving were unrun.

* Show the newest cached core on Home and report CLI updates

Home used inventory order to choose which cached version to show. The
CLI listed local versions without showing whether the tracked Hugging
Face revision had changed. Both interfaces can use the acquisition
record to identify the installed commit and the tracked revision.

Choose the newest readable cached version for Home using the cache
timestamp and numeric collision suffix. Share Hub revision lookups and
the installed deployment check with flare models list. The CLI reports
both dates, displays unknown results when metadata is unavailable, and
accepts --offline to skip lookups. The Library styles its Delete button
red in the standard theme and uses system colors in high contrast.

Home shows one cached version per model. Terminal users can distinguish
an available update from a revision already represented in the cache.

On Windows ARM64, the Flare tests covered Home selection and distinct
dates for the installed and available commits. The CLI smoke check
listed both Inkling 2 Mini revisions, suppressed the offer for the
installed update, and returned the same inventory offline. WinUI bridge
and launcher tests passed, and the Release app packaged successfully.
The first shared test run hit a Windows file-replacement error in an
existing fixture. The repeat passed. CLI integration tests passed after
the full run reproduced two doctor failures caused by Linux sysfs
fixture filenames that Windows rejects. The Delete colors passed contrast checks. Interactive
WinUI verification was unrun.

Design-Signed-Off-By: Codex (GPT-6); design-review=c3a9
Signed-off-by: Eugene Rakhmatulin <eugr@eugr.com>
…d drafter scope

Three silent corruption defects affect the core export pipeline:

1. In ignition/preparation/compilation.py, _reads_across_mutations restricted
   taint tracking to single-tensor aten OpOverload nodes and skipped
   operator.getitem in backward last_use propagation, allowing Inductor to
   reorder mutations ahead of reads through multi-output aten ops (such as
   split, chunk, unbind, topk, and var_mean). Separately, _lower_storage seeded
   accesses[node] only for persistent regions, so aten.copy_ into persistent
   storage could defer past a later mutation of a temporary source.
2. In heliopause/src/export/capture.rs, the cached weight-payload export path
   (WeightDownload::queue and resolve_weight_payload) ignored
   allocation.initialize == "zero" (unlike write_allocation and RetainedReader
   on the uncached path), copying dirty post-warmup GPU or mapped-host bytes
   into initial-state.safetensors and breaking deterministic payload hashes.
3. In ignition/parameters.py, SpeculationParameters.manifest_parameters marked
   speculation.method as ParameterScope.DEPLOYMENT, which compatible_for_combine
   and compatible_for_weight_reuse in helios/src/runtime_core/preparation.rs
   ignore, allowing --reuse-weights and ignition combine to mix incompatible
   drafter architectures.

Changes:

- ignition/preparation/compilation.py: Previously, _reads_across_mutations
  propagated last_use only through immutable aten OpOverload nodes and tracked
  live/fresh taint only for single-tensor aten nodes in keys, while
  _lower_storage initialized accesses[node] only for persistent regions. Now,
  _lower_storage hoists operator.getitem(source, int_index) nodes adjacent to
  immutable multi-output aten producers so snapshots precede later mutations,
  _reads_across_mutations propagates last_use through operator.getitem and
  propagates live taint through immutable multi-output aten ops and their
  getitem extractions (marking extracted tensors fresh only when their storage
  key is absent from the producer's input keys so views of mutable storage
  continue observing writes), and accesses[node] adds keys[node] for non-region
  tensor nodes so later writes to temporaries block aten.copy_ deferral.
- heliopause/src/export/capture.rs: Previously, WeightDownload::queue treated
  snapshot_spans: None as covering (0, allocation.nbytes) even when
  allocation.initialize == "zero", and resolve_weight_payload passed only
  request.zero_ranges to weight_payload::extract_retained. Now,
  WeightDownload::queue uses empty recorded ranges when
  allocation.initialize == "zero" (zero-filling the slot buffer with bounds
  checking and issuing no D2H or host copies), both queue and read_into skip
  CUDA tail-fence and event synchronization for zero-init allocations, and
  resolve_weight_payload appends retained non-peer, non-dynamic
  initialize == "zero" allocations to zero_ranges before extract_retained.
- ignition/parameters.py, helios/src/runtime_core/preparation.rs,
  docs/runtime-core-design.md: Previously, speculation.method used
  ParameterScope.DEPLOYMENT and was omitted by from_legacy_rebuild_manifest.
  Now, speculation.method uses ParameterScope.DRAFT_WEIGHT and
  from_legacy_rebuild_manifest projects non-empty speculation.method as
  Scope::DraftWeight, preserving cross-version compatibility between legacy
  RebuildManifest cores and current PreparationManifest cores while rejecting
  drafter method mismatches on combine and --reuse-weights (target-only
  --no-mtp exports omit draft-weight parameters and continue reusing target
  weights).

Result:

- Compiled forwards preserve eager semantics across mutations through
  multi-output aten ops and temporary copies (measured on SM120 CUDA: split
  across overwrite produces [16.0, 18.0, 20.0, 22.0] matching eager instead of
  [2010.0], and copy_ from a later-mutated temporary produces [10.0] matching
  eager instead of [198.0]).
- Cached Heliopause exports issue zero D2H or host copies for
  initialize == "zero" allocations and produce initial-state payloads
  byte-identical to the uncached staged path even when backing GPU or host
  memory contains nonzero post-warmup bytes.
- Core combination and draft-bearing --reuse-weights reject mismatched
  speculation.method values across both modern and legacy manifests.

Validation:

- Rebuilt flare-heliopause in the worktree venv and ran
  `.venv/bin/python -m pytest tests/preparation/test_source_identity.py tests/preparation/test_storage_lifetimes.py tests/preparation/test_core_boundary.py tests/cli -q`:
  377 passed (including 200 randomized graph seeds extended with split/topk +
  getitem, deferred-copy checks, and DRAFT_WEIGHT manifest assertions).
- `FLARE_RUN_CUDA_TESTS=1 CUDA_VISIBLE_DEVICES=0 .venv/bin/python -m pytest tests/preparation/test_storage_lifetimes_cuda.py -q`
  on NVIDIA RTX PRO 6000 Blackwell (SM120): 6 passed.
- `cargo test --locked --release --manifest-path heliopause/Cargo.toml --lib --target-dir flare-cli/target`:
  210 passed, 6 ignored (including new CPU zero-init download and cached vs
  staged resolution test).
- `CUDA_VISIBLE_DEVICES=0 cargo test --locked --release --manifest-path heliopause/Cargo.toml --lib --target-dir flare-cli/target -- --ignored weight_payload_zero_init_device_allocation_matches_staged_bytes weight_payload_device_materialization_matches_staged_bytes`:
  2 passed on SM120.
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib --target-dir flare-cli/target -- runtime_core:: core::`:
  487 passed, 11 ignored (including updated legacy projection and mismatched
  speculation.method rejection tests).
- Unrun checks: full-model checkpoint export (`ignition export` + `flare run`)
  and the remaining 4 ignored heliopause CUDA tests were not run.

Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=c3a9
Signed-off-by: Luke Alonso <lalonso@gmail.com>
…VIDIA#484)

PreparedStateTransfer.prepare() launches `_copy_rows` with grid
`(capacity, cdiv(row_bytes, 4096), 1)`. On CUDA devices, `gridDim.y` is
capped at 65,535, so continuation rows larger than 256 MiB - 4 KiB
(for example, circular sliding-window KV rows of ~405 MiB / 103,683
tiles in FP8 KV or ~810 MiB / 207,363 tiles in BF16 KV on 60-layer
Gemma 4 31B TP1 models in companion PR
`local-inference-lab/hyperflare-recipes#16`) fail kernel launch with
`RuntimeError: Triton Error [CUDA]: invalid argument` during graph
warmup and maintenance transfers.

Changes:
- ignition/components/state_transfer.py:
  - define named constants `_COPY_BLOCK = 4096`, `_PAGE_BLOCK = 1024`,
    and `_MAX_GRID_Y = 65_535` (with a single authoritative comment
    documenting CUDA's 65,535 `gridDim.y` ceiling and 256 MiB - 4 KiB
    striding threshold), removing duplicated inline block literals;
  - keep `row = tl.program_id(0)` in `_copy_rows` and stride byte tiles
    across `tl.program_id(1)` by `tl.num_programs(1) * BLOCK` up to
    `ROW_BYTES`, preserving direct `_copy_rows[(rows, tiles)](*args)`
    callers (such as
    `local-inference-lab/hyperflare-recipes@60411f1:tests/components/test_state_transfer.py`);
  - cap `PreparedStateTransfer.prepare()`'s `gridDim.y` at
    `min(tiles, _MAX_GRID_Y)`, so rows up to 256 MiB - 4 KiB (including
    128 MiB through 256 MiB - 4 KiB rows such as Gemma 4 31B TP2's
    202.5 MiB rows) keep identical single-iteration launch geometry;
  - reject `pool.layout.row_bytes > (1 << 31) - 1 - _MAX_GRID_Y * _COPY_BLOCK`
    (1,879,052,287 B, ~1.75 GiB) in `PreparedStateTransfer.__init__` so
    Triton's signed 32-bit `offset += step` loop induction cannot wrap
    around `INT32_MAX` (verified in Triton TTIR `scf.for ... : i32` and
    generated PTX `add.s32` / `setp.lt.s32`);
  - note on `_copy_pages` that `args[12]` is per-page byte size (one
    physical KV page), not `row_bytes`.
- docs/TODO.txt: record a follow-up item for the 65,535 * 1024
  (~64 MiB/uint8 row) `gridDim.y` ceiling in `ignition/components/state.py`
  row kernels.
- tests/components/test_state_transfer.py: add ungated `FakeTensorMode`
  unit test verifying `PreparedStateTransfer` rejects the first
  256-aligned `row_bytes` above `INT32_MAX - 65_535 * 4096`
  (`1,879,052,288` B) without requiring a CUDA device or
  `FLARE_RUN_CUDA_TESTS=1`.
- tests/components/test_state_transfer_copy_rows_cuda.py: add CUDA-gated
  tests (using production `_COPY_BLOCK = 4096`, a shared expected-row
  oracle, and a shared `_replay_and_verify` helper that snapshots the
  source row before replay and asserts it remains unchanged) covering
  direct `(row, tile)` launches (`grid_y` in `[8, 3]`, with a
  deliberately non-tile-aligned excluded span) and parametrized
  `PreparedStateTransfer.prepare()` + `validate()` + `apply()` across
  `("total_tiles", "expected_y")` in `[(8, 8), (65_535, 65_535),
  (_MAX_GRID_Y + 2, 65_535)]` (`32 KiB`, exact `256 MiB - 4 KiB`
  boundary, and `256 MiB + 4 KiB / 268.4 MB`) with hard-coded
  independent excluded byte spans and 3 freshly dirtied CUDA graph
  replays.

Claimed result:
Continuation rows larger than 256 MiB - 4 KiB copy, reset, and replay
inside CUDA graphs without exceeding CUDA's 65,535 `gridDim.y` ceiling
— verified at 256 MiB + 4 KiB (65,537 tiles) in unit tests, ~405 MiB
(103,683 tiles) in packaged FP8-KV downstream runtimes, and ~810 MiB
(207,363 tiles) in end-to-end BF16-KV serving; larger rows between
~810 MiB and the ~1.75 GiB (`1,879,052,287` B) strided-copy offset
guard follow from the same capped launch geometry (reasoning, not
executed). All continuation rows up to 256 MiB - 4 KiB keep identical
launch geometry and behavior; direct `(row, tile)` callers that launch
one program per tile keep identical behavior, while callers that launch
fewer Y programs than tiles now copy the whole row instead of only the
first `grid_y * 4,096` bytes. Existing exported cores are unaffected by
construction (reasoning, not an export/reload measurement): this change
touches only preparation-time launch geometry in
`PreparedStateTransfer.prepare()`, a preparation-time `row_bytes` bound
in `PreparedStateTransfer.__init__`, and the `_copy_rows` Triton kernel
body, not Helios runtime loading, core wire format, or already-exported
graph binaries.

Supporting evidence and limitations:
- Pre-fix failure on both SM120 (RTX PRO 6000 Blackwell) and SM121
  (NVIDIA GB10, aarch64 DGX Spark): launching `_copy_rows[(1, 65_537)]`
  on a 256 MiB + 4 KiB (268.4 MB) row raises
  `RuntimeError: Triton Error [CUDA]: invalid argument`.
- SM120 (RTX PRO 6000 Blackwell, x86-64 Linux, on `v0.4.0` `5adb27f2`,
  this commit):
  - Ungated CPU-only (`CUDA_VISIBLE_DEVICES=0 pytest -v tests/components/test_state_transfer.py tests/components/test_state_transfer_copy_rows_cuda.py tests/preparation/test_core_boundary.py`):
    5 passed (strided-copy offset guard + 4 boundary checks), 5 skipped
    (GPU cases) in 2.85s.
  - Gated full (`CUDA_HOME=/opt/cuda CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 pytest -v tests/components/test_state_transfer.py tests/components/test_state_transfer_copy_rows_cuda.py tests/preparation/test_core_boundary.py tests/preparation/test_source_identity.py`,
    after rebuilding `flare-heliopause` on `v0.4.0` `5adb27f2`):
    21 passed in 4.73s.
  - External backward-compatibility check (`CUDA_VISIBLE_DEVICES=1 FLARE_RUN_CUDA_TESTS=1 pytest -v tests/components/test_state_transfer.py`
    against untouched `local-inference-lab/hyperflare-recipes@60411f1`):
    7 passed in 3.18s.
- SM121 (NVIDIA GB10, aarch64 DGX Spark, PyTorch `2.14.1+cu132`, on
  `v0.4.0` `5adb27f2`, this commit):
  - Ungated CPU-only (`pytest -v tests/components/test_state_transfer.py tests/components/test_state_transfer_copy_rows_cuda.py tests/preparation/test_core_boundary.py`):
    5 passed, 5 skipped in 4.63s.
  - Gated (`CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 pytest -v tests/components/test_state_transfer.py tests/components/test_state_transfer_copy_rows_cuda.py tests/preparation/test_core_boundary.py`):
    10 passed in 21.23s (1 ungated offset guard + 5 CUDA cases + 4
    boundary checks).
  - External (`CUDA_VISIBLE_DEVICES=0 FLARE_RUN_CUDA_TESTS=1 pytest -v hyperflare-recipes/tests/components/test_state_transfer.py`):
    7 passed in 3.79s.
- End-to-end ~810 MiB BF16-KV serving (SM120x1 RTX PRO 6000 Blackwell,
  x86-64 Linux, `google/gemma-4-31B-it@842da379` BF16 TP1,
  `--max-concurrency 4`, 57 graphs, `--kv-cache-dtype bf16`, MTP
  enabled): exported and served with core stack
  `NVIDIA/hyperflare-inference@v0.4.0` (`5adb27f2`) + this PR NVIDIA#484
  (`rickybrent/hyperflare-inference@core/state-transfer-large-rows`
  `6463aa58`, whose `_copy_rows` kernel and launch geometry are
  unchanged by this commit's tightened 1.75 GiB preparation guard) +
  `rickybrent/hyperflare-inference@core/gemma4-image-frontend`
  (`c3f3311f`, PR NVIDIA#483 image frontend, unused during text-only checks)
  and recipe stack `local-inference-lab/hyperflare-recipes@main`
  (`60411f1`) + `rickybrent/hyperflare-recipes@recipes/gemma4-sliding-window-kv`
  (`eb7ac17`, PR #16 circular sliding-window KV) +
  `rickybrent/hyperflare-recipes@recipes/gemma4-bf16-kv` (`39a61a7`,
  adds `--kv-cache-dtype bf16`, ~810 MiB / 207,363-tile continuation
  rows). Passed 4,082-token wraparound snapshot/restore
  (`cached_tokens=4050`) and 53K / 163.8K needle checks (401,408 KV
  tokens / 38 snapshot slots).
- Packaged FP8-KV downstream runtimes: both packaged cores were
  exported from `rickybrent/hyperflare-inference@gemma4-export`
  (`53eabcad`, 32,768-tile cap — four iterations per program at
  ~405 MiB; the shipped 65,535 cap is covered by the 65,537-tile test
  case) + `rickybrent/hyperflare-recipes@recipes/gemma4-integration`
  (`08bf07a`), with ~405 MiB (103,683-tile) circular sliding-window
  continuation rows:
  - `rickybrent/Gemma-4-31B-IT-NVFP4-HYPERFLARE-TP1-gb202` (SM120,
    core `gb202-tp1-202611240119`, ~405 MiB continuation rows).
  - `rickybrent/Gemma-4-31B-IT-NVFP4-HYPERFLARE-TP1-gb10` (SM121,
    core `gb10-tp1-202611240340`, ~405 MiB continuation rows; 68.5 GiB
    cache, 1,742,848 KV tokens, 168 snapshot slots; 7/7 vision and
    42.8K / 128.4K / 171.1K exact needle checks).
- Limitations: SM103 and Windows were not executed on hardware; rows
  between ~810 MiB and the ~1.75 GiB strided-copy offset guard were not
  executed; `test_source_identity.py` ran on SM120 only (where
  `flare-heliopause` was rebuilt for `v0.4.0` `5adb27f2`); and no
  base-export/branch-reload test was run for existing exported cores.

Design-Signed-Off-By: Antigravity (Gemini); design-review=15f3

Signed-off-by: Ricky Brent <ricky@rickybrent.com>
…che wipe, and DispatchRing peer-exit race

Three verification and runtime defects affected Helios prefix-cache retention,
same-process tensor-parallel step dispatch, and TLA+ trace conformance:

1. Observed-edge conformance in `verification/helios-lifecycle/check.py` left
   `state = Initial` (`UNCHANGED state`) in generated `Observed.tla` and stripped
   every safety `INVARIANT` from `<module>.cfg` when emitting `Observed.cfg`.
   Outside `ResponseLifecycle.tla`, `AllowedEdge` evaluated only the transition
   relation without checking `TypeOK` or safety invariants on `before` and
   `after`. In `DispatchRing.tla`, actions record violations into sticky booleans
   (`slotWriteConflict`, `strandedOnDrain`, `abandonedInFlight`,
   `localLaunchBeforeCommit`) and rely on `.cfg` invariants to reject them, so
   an observed Rust trace setting any sticky violation flag still passed
   `Observed.tla`.
2. `RequestScheduler::retain_snapshot()` in `helios/src/scheduler/cache_memory.rs`
   (called by `finish_early()` and `preempt_newest()` in `helios/src/scheduler.rs`)
   looped `self.evict(EvictionTarget { pages: 0, snapshots: 1 })` (`immediate = false`)
   with no retention-rank or protected-anchor budget. Because `finish_early()`
   requires an immediately usable row and does not retry after GPU completion,
   any unpinned checkpoint with `last_use > completed` (or `ready_after > completed`)
   retired into `cache.pending_retirement` without freeing a row, causing the loop
   to evict every remaining unpinned checkpoint in the GPU prefix cache before
   returning `Ok(None)`. `checkpoint_lifecycle_tests.rs` masked this because its
   terminal cases ran only at `Fence(0)` and manually overwrote `after[start..start + 4]`
   instead of projecting `request.terminal_snapshot` and `cache.pending_retirement()`.
3. `DispatchRing::poll_peer_acks()` in `helios/src/execution/threaded.rs` checked
   `peer_ack[index] >= target` before `self.peer_exited()`, and `coordinate_step()`
   did not re-check `ring.peer_exited()` after `local_validate()` before calling
   `ring.commit(epoch)` or `ring.cancel(epoch)`. A peer exiting via `PeerExitGuard`
   after acknowledging readiness or during `local_validate()` could therefore be
   followed by rank zero publishing `Commit` and launching a multi-GPU collective
   without that peer. The conformance explorer `dispatch_ring_matches_model_edges`
   masked the check order with test-only `&& !state.peer_exited` guards.

What changed (before -> after):

- `helios/src/scheduler/cache_memory.rs` & `helios/src/scheduler.rs`:
  - Before: `retain_snapshot()` looped `revoke_unused_anchor_guards()` and
    `self.evict(pages: 0, snapshots: 1)` (`immediate = false`), bypassing
    retention ranking, protected-anchor budgets, and aliased decode-growth headroom.
  - After: `retain_snapshot(rank, protected_token_budget)` reserves a free row
    directly when snapshot rows do not alias KV pages (`self.snapshot_pages.is_empty()`)
    and otherwise runs an atomic `quote_snapshots_with_budget(1, 0, rank, protected_token_budget)`
    + `apply_snapshot_quote(&quote)` simulation (`immediate = true`). `finish_early()`
    supplies the finishing request's `RetentionRole::Endpoint` rank at `demand_epoch`
    and `Some(gain_tokens)`, and increments `checkpoint_skip_storage` when no row
    is available. Added three regression tests covering in-flight checkpoints,
    skipping in-flight older victims, and aliased live KV pages.
- `helios/src/scheduler/checkpoint_lifecycle_tests.rs`:
  - Before: `Observation::project` omitted `request.terminal_snapshot` and
    `cache.pending_retirement()`, and `terminal_reservations_match_lifecycle_model`
    overwrote `after[start..start + 4]` with synthetic `Armed` state.
  - After: `Observation::project` reads `request.terminal_snapshot` and
    `cache.pending_retirement()` directly; the manual overwrite is removed; and
    `EarlyFinishProtectedAnchorRefused` and `PreemptProtectedAnchorRefused` cases
    are covered.
- `helios/src/execution/threaded.rs`:
  - Before: `peer_exited()` used `Ordering::Acquire`, `poll_peer_acks()` returned
    `Some(Ok(()))` before checking `self.peer_exited()`, `coordinate_step()` called
    `ring.commit(epoch)` / `ring.cancel(epoch)` without re-checking `ring.peer_exited()`,
    and `dispatch_ring_matches_model_edges` added `&& !state.peer_exited`.
  - After: `peer_exited()` uses `Ordering::SeqCst` (matching `mark_peer_exited`,
    `commit`, `cancel`, and `request_drain` in one `SeqCst` total order),
    `poll_peer_acks()` checks `self.peer_exited()` before and after checking
    `peer_ack[index] >= target`, `coordinate_step()` re-checks `ring.peer_exited()`
    before `ring.commit(epoch)` and `ring.cancel(epoch)` (draining and returning
    `on_peer_exit()` without publishing `Commit` or invoking `local_submit()`),
    both masking test guards are removed, and unit/contract tests exercise peer
    exit after acks and during `local_validate()`. Commit-before-launch and
    decision-before-drain orderings are unchanged.
- `verification/helios-lifecycle/{check.py,README.md,*.tla}`:
  - Before: `Observed.tla` kept `state = Initial`, `Observed.cfg` dropped every
    `<module>.cfg` invariant, and `AllowedEdge` outside `ResponseLifecycle.tla`
    did not enforce `TypeOK` or safety invariants.
  - After: `Observed.tla` steps `state` across `ObservedState(before)` and
    `ObservedState(after)` for each observed edge, `Observed.cfg` retains every
    `INVARIANT`/`INVARIANTS` declaration from `<module>.cfg` alongside
    `INVARIANT Corresponds`, and `AllowedEdge` across all checked modules
    (`DispatchRing`, `CheckpointReservation`, `Speculation`, `Lifecycle`,
    `RankProtocol`, `CacheOwnership`, `OffloadTransfer`, `ResponseLifecycle`)
    enforces `ObservedSafe(before) /\ ObservedSafe(after)` and exact projection
    round-trip. `check.py --mutations` adds Rust mutations for `poll_peer_acks`,
    `coordinate_step` pre-commit peer-exit check, and `retain_snapshot`, plus a
    synthetic `DispatchRing SlotReuseSafe` observed-edge violation check.

Claimed result:

- Observed in CPU, formal, and mutation verification: every `<module>.cfg` safety
  invariant is enforced on both endpoints of every observed Rust transition,
  `retain_snapshot()` preserves in-flight, protected-anchor, and aliased-KV
  checkpoints atomically, and `DispatchRing` / `coordinate_step()` abort with
  drain instead of publishing `Commit` or launching local work after a peer exits.
- Expected in production serving: early finish and preemption under GPU prefix-cache
  pressure no longer wipe unpinned in-flight checkpoints or evict protected anchors
  beyond marginal gain, and peer exits after readiness acks or during rank-zero
  validation abort cleanly instead of stranding multi-GPU collectives.

Evidence and limitations:

- Formal lifecycle and mutation suite (`python3 verification/helios-lifecycle/check.py
  --tlc-jar ~/.cache/flare-formal/tla2tools-1.7.4.jar --target-dir flare-cli/target
  --mutations`): passed (exit 0) across all 9 exhaustive models + `Speculation16.cfg`,
  all 8 observed-edge suites with full `Observed.cfg` invariants (`Lifecycle` 1,342;
  `RankProtocol` 1,291; `DispatchRing` 7,940; `OffloadTransfer` 8,490;
  `CacheOwnership` 195,492; `Speculation` 13,566; `ResponseLifecycle` 365,508;
  `CheckpointReservation` 33), all 12 TLA+ mutations, all 22 Rust mutations, and
  the synthetic `DispatchRing SlotReuseSafe` observed-edge violation check.
- Helios release tests (`cargo test --locked --release --manifest-path helios/Cargo.toml
  --features runtime-core,server --target-dir flare-cli/target --lib -- scheduler::
  execution:: cache:: --skip core::cache::`): 560 passed, 0 failed, 6 ignored.
- Release build (`cargo build --locked --release --manifest-path flare-cli/Cargo.toml`):
  succeeded.
- Live multi-GPU collective serving on 2x NVIDIA RTX PRO 6000 Blackwell (SM120)
  with `flare-cli/target/release/flare run nvidia/Qwen3.8-Flash-Next-FP4-Local@gb202-tp2-202610270419
  --host 127.0.0.1 --port 18089 --gpus 0,1`: served 4 concurrent `/v1/chat/completions`
  requests plus 1 follow-up request across 2 ranks (9,962 kernels, 787 shared
  snapshot slots) and drained cleanly on SIGTERM (exit code 0 in 5.7s).
- Limitations: the 2 ignored CUDA unit tests in `helios` (`FLARE_THREADED_TEST_CORE`),
  TP > 2 cores, multi-process socket `TensorParallelExecutor` (`parallel.rs`,
  unchanged), and chat-template tests requiring `FLARE_TEST_TEMPLATE_DIR` were
  not executed in this run.

Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
Signed-off-by: Luke Alonso <lalonso@gmail.com>
Why:
In non-strict tool calls on /v1/chat/completions, /v1/responses, and
/v1/messages, models that emit valid JSON values under an unconstrained
JSON Schema field (such as `"value": {}` or `{"description": "..."}`)
had those values silently rewritten into JSON-stringified strings (for
example, `["user_input"]` became `"[\"user_input\"]"`). In
helios/src/output/chatml.rs (used by ToolParserKind::QwenCoder and
ToolParserKind::Atem via helios/src/output/recipient.rs),
parameter_value recursively converted every already-parsed nested field
back to text with value.to_string() and passed it through
scalar_parameter_value; parameter_types then fell back to ["string"]
whenever a schema declared no type, enum, anyOf, oneOf, or allOf. That
same string fallback also prevented top-level unconstrained parameters
from parsing as JSON in chatml.rs, recipient.rs, minimax_xml.rs, and
tagged.rs (used by GLM ArgumentTags), and parameter lookup in chatml,
recipient, and argument_tags ignored schema additionalProperties.

What changed:
- helios/src/output/chatml.rs:
  - Before: parameter_value serialized every nested JSON object field or
    array item via value.to_string() and re-ran parameter_value;
    parameter_types pushed "string" for any schema lacking type, enum,
    anyOf, oneOf, or allOf; object/array matching in
    scalar_parameter_value did not verify value kind; top-level lookup
    read only parameters.properties.
  - After: parameter_types returns whether a present schema is
    unconstrained (accepting any JSON value, including {}, true,
    annotation-only objects, and unions containing an unconstrained
    branch), recognizes const, properties/additionalProperties, and
    items/prefixItems, and defaults to ["string"] only when schema is
    None (undeclared tool or parameter). scalar_parameter_value parses
    unconstrained schemas with serde_json::from_str (falling back to
    Value::String for non-JSON text) and checks is_object()/is_array()
    on typed container branches. parameter_value replaces string
    round-tripping with depth-bounded coerce_nested, which keeps
    already-parsed JSON containers and scalars intact and coerces nested
    Value::String entries only when the subschema forbids strings.
    Top-level parameter lookup falls back to additionalProperties when
    it is an object schema or true.
- helios/src/output/recipient.rs and helios/src/output/argument_tags.rs:
  - Before: top-level parameter lookup read only parameters.properties.
  - After: lookup falls back to parameters.additionalProperties when it
    is an object schema or true; ATEM inherits the chatml.rs recursion
    and unconstrained-schema behavior.
- helios/src/output/tagged.rs:
  - Before: declared_value returned Ok(Some(Value::String)) whenever a
    present schema omitted type, anyOf, and oneOf, bypassing
    parameter_value's serde_json::from_str fallback, and short-circuited
    on "string" before checking non-string union branches or type-array
    entries.
  - After: declared_value distinguishes Declared::Unconstrained from
    Declared::NoMatch and Declared::Value, supports boolean schemas,
    const, string-only enum, and allOf, and tries non-string branches
    before string fallbacks so unconstrained and mixed unions parse
    valid JSON while explicit string schemas and schema: None still
    preserve raw strings.
- helios/src/output/minimax_xml.rs:
  - Before: convert filtered out boolean schemas and passed
    parameter_types without distinguishing unconstrained schemas from
    explicit string types.
  - After: convert accepts boolean true schemas and checks the
    unconstrained flag alongside types.contains(&"string") so typeless
    container schemas (such as {"items": ...}) produce empty containers
    on empty text and declared {} leaf fields parse JSON while
    undeclared parameters (schema: None) stay strings.

Claimed result:
- Observed in CPU unit tests: QwenCoder, ATEM, GLM ArgumentTags, and
  MiniMaxXml preserve JSON arrays, objects, numbers, booleans, null, and
  explicit JSON strings for nested and top-level unconstrained schemas
  (including the issue NVIDIA#594 apply_filters payload), while preserving raw
  strings for explicit string schemas, plain non-JSON text, and
  undeclared parameters.
- Expected in live serving: Qwen3.8, ATEM, GLM, and MiniMax cores served
  through /v1/chat/completions, /v1/responses, and /v1/messages no
  longer stringify JSON values emitted for unconstrained schema fields.
  No core re-export or contract change is required.

Evidence and limitations:
- cargo test --locked --release --manifest-path helios/Cargo.toml
  --features runtime-core,server --lib output:: -> 103 passed, 0 failed
  (includes four new regression tests across chatml, recipient,
  argument_tags, and minimax_xml).
- cargo test --locked --release --manifest-path helios/Cargo.toml
  --features runtime-core,server --test deepseek_output
  --test deepseek_requests --test glm_frontend --test unverified_empty
  -> 30 passed, 0 failed, 1 ignored.
- cargo test --locked --release --manifest-path helios/Cargo.toml
  --features runtime-core,server -- --skip template_fixtures -> 1696
  passed, 43 ignored; 8 failures unrelated to output parsing (6 template
  tests requiring FLARE_TEST_TEMPLATE_DIR, 1 Engram locked-memory
  allocation error, and 1 untouched
  model::tests::packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape).
- cargo test --locked --release --manifest-path flare/Cargo.toml -> 242
  passed, 0 failed, 4 ignored across lib and integration tests.
- cargo test --locked --release --manifest-path flare-cli/Cargo.toml ->
  24/24 integration tests passed (cache_commands, cli, inspect,
  unverified_payload); 200 unit tests passed, 3 ignored, 1 unrelated
  BrokenPipe timeout in untouched
  distribution::tests::source_waits_for_receiver_file_verification.
- Unrun checks: live GPU serving of an exported Qwen3.8 core, helios
  chat-template tests requiring FLARE_TEST_TEMPLATE_DIR, and Kani
  (cargo-kani is not installed in this environment; tagged/kani_proofs.rs
  does not cover declared_value or parameter_value).

Signed-off-by: Luke Alonso <lalonso@gmail.com>
Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
When a tensor-parallel step stalls until the 120-second completion
deadline expires, the bare error string `tensor-parallel graph completion
deadline expired` leaves operators unable to tell which graph kind or
capacity stalled, whether the frame was committed across peers, or
whether all ranks hung together versus a single laggard rank.

Before this change, `ThreadedExecutor::poll_ranks` and
`TensorParallelExecutor::poll_ranks` checked `pending.iter().any(...)`
and returned the static string without inspecting the expired frame.
This change adds a shared `protocol::format_completion_deadline_error`
helper and updates both executors to format the oldest expired pending
frame while preserving the existing `tensor-parallel graph completion
deadline expired` error prefix.

Each deadline failure now reports the graph name, index, kind, batch,
token, and packed-token capacities, fence, grammar flag, committed state,
pending queue depth, elapsed milliseconds, `ranks_done`, and
`ranks_pending` (plus `peers_ready` and `peers_not_ready` when an
uncommitted frame times out waiting for peer readiness).

Verified with `cargo test --locked --release --manifest-path
helios/Cargo.toml --features runtime-core,server --lib execution::`
(125 passed, 0 failed, including the new
`completion_deadline_error_reports_graph_and_rank_progress` test) and
`python3 verification/helios-lifecycle/check.py --tlc-jar ...` (all
TLA+ specs passed). This reports coordinator-visible frame and rank
state only; inspecting which CUDA kernel or collective epoch inside a
graph is spinning still requires GPU-side capture.

Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
Signed-off-by: Martin Vit <martin@voipmonitor.org>
Why:
During rank executable assembly, `materialize_span` extracted disposable
uncompressed graph and cubin spans through the durable payload materializer,
computing a standalone SHA-256 digest and calling `fsync` on temporary files
whose digest was immediately discarded before archive sealing.

What:
Before: `materialize_span` called `materialize`, hashing every temporary span
and syncing its temporary file to disk before rank archive sealing.
After: `materialize_span` copies span pieces through a bounded 4 MiB
`BufWriter`, flushes buffered bytes via `into_inner()`, removes the temporary
file if reading or flushing fails, and leaves compression, hashing, and
`fsync` to rank archive and final core publication. Existing signed runtime
cores and wire schemas remain unchanged.

Result:
Temporary cubin and graph extraction avoids redundant SHA-256 passes and
per-span `fsync` barriers while keeping final executable and core durability
syncs intact. Live GPU export throughput has not yet been measured on this
revision.

Evidence:
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib core::`: 484 passed, 11 ignored, 0 failed.
- `cargo test --locked --release --manifest-path heliopause/Cargo.toml --lib`: 209 passed, 5 ignored, 0 failed.
- `pytest -q -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py`: 22 passed.
- End-to-end GPU export timing and Windows native export remain unverified on this revision.

Discord: Dooner

Design-Signed-Off-By: Antigravity (Gemini 4); design-review=c3a9
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
…IA#578)

* AGENTS.md: keep DSML parsing in deepseek-recipe

Record that DeepSeek DSML markup recognition and recovery belong to the
pinned deepseek-recipe parser. Helios adapts parser actions and must not add a
second DSML parser or reparse raw tags.

This PR tracks the upstream parser correction. Once that lands, it will add
the pinned revision bump and the deepseek_output regression test.

Design-Signed-Off-By: malventano; design-review=c3a9
Signed-off-by: malventano <malventano@users.noreply.github.com>

* helios: bump deepseek-recipe for aborted DSML parameter openers

DeepSeek can emit a parameter tag without a string attribute before the
intended typed tag. The previous parser absorbed the malformed opener's name
boundary into the argument name, so the following typed tag became part of the
name and the synthesized argument object was invalid.

Pin deepseek-recipe to 70be62f3, which holds the parameter name until the opener
is well formed and skips an opener that closes before its string attribute. The
next well-formed parameter then parses normally. Special-token matching, the
1 MiB argument bound, and empty or duplicate name rejection are unchanged.

Add the captured untyped-opener sequence to the DeepSeek output integration
test and document the discard behavior in docs/api.md.

The deepseek-recipe stream suite passes 30 tests and its full crate passes 55.
The Helios deepseek_output suite passes 15 tests, including the retained
empty/duplicate rejection test.

Design-Signed-Off-By: malventano; design-review=c3a9
Signed-off-by: malventano <malventano@users.noreply.github.com>

---------

Signed-off-by: malventano <malventano@users.noreply.github.com>
Co-authored-by: malventano <malventano@users.noreply.github.com>
…y Orbit revision matching (NVIDIA#598)

Why:
Automatic Hub revision detection (`flare/src/hardware.rs`), core export naming
(`heliopause/src/export/capture.rs`), and Orbit placement previously recognized
only six platforms (`ga102`, `ga10b`, `gb10`, `gb202`, `gb206`, `gb300`) and a
subset of their PCI device IDs. Any other Ampere or Blackwell GPU — such as
GB203 (RTX PRO 4500 Blackwell `0x2c31`, RTX 5080, RTX 5070 Ti), GB205 (RTX 5070),
GB207 (RTX 5050), GB100/GB102 (B200/B100/GB200), GB10B (Jetson AGX Thor),
GA100 (A100/A30), GA102 workstation cards (RTX A6000, A40, A10), or GA103/GA104/
GA106/GA107 — failed export and `flare run` with an unsupported PCI ID error,
forcing piecemeal one-die PRs. Separately, Orbit maintained a drifted private
copy of the PCI table in `flare-cli/src/orbit/gpu.rs` and derived a core's
required revision in `controller.rs::describe` only from compute capability,
which conflates distinct dies sharing a compute capability (for example SM 12.0
GB202/GB203/GB205/GB206/GB207 and SM 8.6 GA102/GA103/GA104/GA106/GA107).

What exactly changed:
- `helios/src/core/naming.rs`: expands `PLATFORMS` from 6 to 19 entries covering
  all known Ampere (`ga100`, `ga102`, `ga103`, `ga104`, `ga106`, `ga107`,
  `ga10b`) and Blackwell (`gb10`, `gb100`, `gb102`, `gb10b`, `gb112`, `gb120`,
  `gb202`, `gb203`, `gb205`, `gb206`, `gb207`, `gb300`) GPU dies using PCI
  device IDs from `pciutils/pciids` (also completing `GA102_DEVICES`,
  `GB10_DEVICES`, `GB202_DEVICES`, and `GB300_DEVICES`). Replaces the chained
  `if` checks in `platform_from_pci` with a single `PCI_PLATFORMS` dispatch
  slice, adds `(11, 0) => Some("gb10b")` (Jetson AGX Thor) to
  `platform_from_capability`, and tests disjointness, non-NVIDIA vendor
  rejection, and representative IDs across every die.
- `flare-cli/src/orbit/{gpu,controller,plan}.rs`: deletes Orbit's private PCI
  ID table so `gpu::revision` delegates directly to `naming::platform_from_pci`
  with `capability_revision` (which now delegates integrated capabilities to
  `naming::platform_from_capability`) as fallback. Adds `gpu::core_revision`
  and updates `controller::describe` to read `authorized.identity()?.hardware`
  so placement matches a core's signed platform identity instead of collapsing
  distinct dies onto one compute-capability name, keeping `capability_revision`
  only for legacy cores without a device identity.
- `flare/src/catalog.rs`: builds the multi-branch fixture in
  `published_build_match_uses_all_platform_branches` from `PLATFORMS` and tests
  prefix separation across `gb10` vs `gb100`/`gb102`/`gb10b` and `gb202` vs
  `gb203`.
- `flare-cli/src/cli.rs`, `docs/cli-design.md`, `docs/core-format-design.md`,
  `docs/orbit.md`: updates platform revision documentation, the `gb*` `-tp1`
  404 retry rule, and Orbit placement semantics.

Claimed benefit:
Every known Ampere and Blackwell GPU resolves to its own die-specific platform
identifier across hardware detection, Hub revision selection, core export
naming, and Orbit placement through one shared table, preserving all existing
platform labels (`ga102`, `ga10b`, `gb10`, `gb202`, `gb206`, `gb300`) and
legacy core compatibility.

Supporting evidence and limitations:
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib -- core::`: 487 passed, 0 failed, 11 ignored (including `core::naming::tests::*`).
- `cargo test --release --manifest-path flare/Cargo.toml`: 234 unit tests passed (4 ignored), 7 `packed_canonical_download` passed, 1 `reference_workflows` passed.
- `cargo test --release --manifest-path flare-cli/Cargo.toml`: 24 integration tests passed (`cache_commands`: 7, `cli`: 6, `inspect`: 4, `unverified_payload`: 7); 201 of 202 unit tests passed (3 ignored), with 1 pre-existing unrelated `BrokenPipe` failure in `distribution::tests::source_waits_for_receiver_file_verification`.
- `cargo test --release --manifest-path heliopause/Cargo.toml --lib`: 211 passed, 0 failed, 6 ignored.
- Live hardware check on RTX PRO 6000 Blackwell Max-Q (`0x2bb4`): `flare hardware-revision 1` prints `gb202`.
- Limitations: `flare`, `flare-cli`, and `heliopause` ran without `--locked` locally because base commit `92a5b888` bumped `deepseek-recipe` in `helios/Cargo.toml` without updating their lockfiles (lockfiles left untouched here). Live NVML hardware was exercised only on `0x2bb4` (GB202); the other PCI IDs were verified against `pciutils/pciids` and unit tests. Repositories without a published branch for a newly recognized platform require an explicit `--revision` override until builds for that platform are published, and Orbit placement matches the core's signed platform identity exactly.


Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9
Co-authored-by: Alexander Korolev <alexander.korolev.germany@gmail.com>
Signed-off-by: Luke Alonso <lalonso@gmail.com>
…, Sonnet, and Haiku

Why:
The kernel authorship rule in repository guidance and design principle 14
previously named only Claude Opus 5.5, leaving Fable, Sonnet, Haiku, and other
Opus versions uncovered even though the same reliability concerns apply to low-
level CUDA kernels and GPU execution optimizations across all four Claude model
families.

What exactly changed:
- `AGENTS.md` ("CUDA kernel and model optimization authorship") and
  `docs/design-review.md` (principle 14): replaced the Claude Opus 5.5-only
  restriction with Claude Opus, Fable, Sonnet, and Haiku models for designing,
  implementing, or indirectly incorporating low-level CUDA kernels (CUDA C++,
  PTX, CuTe DSL, Triton) and changes to projection packing, fused arithmetic,
  stream overlap, or scratch aliasing in optimized model paths. General PyTorch
  modeling, recipe integration, checkpoint loading, frontend processing,
  preparation orchestration, CLI/runtime work, tests, and documentation remain
  permitted when they do not modify those restricted mechanisms.

Claimed benefit:
Aligns repository authorship guidance and commit design-review enforcement
across all Claude Opus, Fable, Sonnet, and Haiku models.

Supporting evidence and limitations:
Inspected `git diff --cached` and ran `git diff --cached --check` with no
formatting or whitespace issues. Documentation-only change; no runtime or GPU
tests were run.

Signed-off-by: Luke Alonso <lalonso@gmail.com>
Design-Signed-Off-By: Antigravity (Gemini); design-review=2e5b
@FujitsuPolycom
FujitsuPolycom force-pushed the perf/ignition-export-use-node-priority branch from 18312bd to 7fc5993 Compare November 29, 2026 15:59
original-el8 and others added 7 commits November 29, 2026 11:38
…files (NVIDIA#604)

Commit 92a5b88 (the deepseek-recipe parser pin bump, NVIDIA#578) updated
`deepseek-recipe`, `deepseek-recipe-core`, and `deepseek-recipe-encoding` in
`helios/Cargo.toml` from `6d09e9be` to `70be62f3` along with
`helios/Cargo.lock` and `flare-cli/Cargo.lock`, but left three downstream
lockfiles that depend on `helios` (`flare/Cargo.lock`, `heliopause/Cargo.lock`,
and `flare-winui/bridge/Cargo.lock`) pinned at `6d09e9be`. Because each crate
maintains its own lockfile and builds and tests run with `--locked`, locked
builds fail for those three crates.

Update the four `deepseek-recipe*` (`deepseek-recipe`, `deepseek-recipe-core`,
`deepseek-recipe-encoding`, and `deepseek-recipe-macros`) git source pins in
`flare/Cargo.lock`, `heliopause/Cargo.lock`, and `flare-winui/bridge/Cargo.lock`
from `6d09e9be68dbf4ae488f6b22ee9114dcf9ea6270` to
`70be62f30c64400229fcdb233a7f19a03a5e8ed6`. No source code, model core
contracts, or unrelated dependency versions change.

Locked Cargo resolution and release test builds now succeed for `flare`,
`heliopause`, and `flare-winui/bridge`, and every Cargo manifest in the
repository resolves cleanly under `--locked`.

Evidence (Linux aarch64, rustc 1.99.0, base 44f59df):
- Before: `cargo metadata --locked` failed on `flare/Cargo.toml`,
  `heliopause/Cargo.toml`, and `flare-winui/bridge/Cargo.toml` with
  `cannot update the lock file ... because --locked was passed to prevent this`.
- After: `cargo metadata --locked` succeeded on all 9 Cargo manifests (`eos`,
  `selene`, `selene-manager`, `helios`, `flare`, `flare-cli`, `heliopause`,
  `flare-winui/bridge`, `flare-winui/launcher`).
- `cargo test --locked --release --manifest-path flare/Cargo.toml`: 242 passed,
  0 failed, 4 ignored.
- `cargo test --locked --release --manifest-path heliopause/Cargo.toml`: 211
  passed, 0 failed, 6 ignored.
- `cargo test --locked --release --manifest-path flare-winui/bridge/Cargo.toml`:
  11 passed, 0 failed, 0 ignored.
- Limitations: Windows compilation and WinUI packaging for
  `flare-winui/bridge` were not run on Windows; GPU- and checkpoint-gated
  ignored tests (4 in `flare`, 6 in `heliopause`) were not run.

Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b

Signed-off-by: Jason Cook <1637905+original-el8@users.noreply.github.com>
…head (NVIDIA#497)

Why

Disk-only prefix-cache offload (`--prefix-cache-memory 0` with
`--prefix-cache-disk`, default `--lossless-kv-compression off`) incurred five
host and coordination costs: (1) opening a raw v1-v3 record file
(`selene/src/disk.rs`) issued two sequential `O_DIRECT` reads (4 KiB header,
then page checksums); (2) `xxh3` page hashing ran serially on the single disk
thread across up to 64 pages (`268 MB` at `4.19 MB`/page); (3) `Staged::pump_all`
(`selene/src/disk_store.rs`) submitted unlinks/truncates and outbound writes
ahead of interactive restores; (4) while waiting on an inbound restore with an
idle GPU, Helios's worker (`helios/src/server/runtime.rs`) slept up to `2 ms`
and multi-host disk peers (`selene/src/shard.rs`) slept `1 ms` instead of waking
on socket readability; and (5) on integrated-memory GPUs
(`CU_DEVICE_ATTRIBUTE_INTEGRATED`), disk-only offload scaled registered host
intake with concurrency (`2 * max_active * row_slots + 128`, up to `8.2 GiB`
needed on `Qwen3.8-27B-NVFP4` at `--max-concurrency 16`), carving GPU KV cache
out of shared RAM even though paged disk streaming stages at most two windows
(`2 * (64 + row_slots)` slots).

What

- Single-read raw open (`selene/src/disk.rs`): preserve `NVIDIA#504`'s v4 packed
  `Header::read_metadata` open branch, and on raw v1-v3 `O_DIRECT` opens read
  the 4 KiB header and expected checksum segment in one transfer when
  `expected.tail_pages <= MAX_TAIL_PAGES` (`CHECKSUM_SCRATCH_BYTES = 1 MiB`),
  falling back to a 4 KiB header-only read on failure while preserving retry
  I/O errors, truncated-file checks, and shared scratch span helpers.
- Scoped parallel page hashing (`selene/src/disk.rs`): cache `parallel_cpus`
  once at `Worker::new` and hash raw batches of >= `HASH_PARALLEL_MIN_PAGES`
  (`4`) pages across `parallel_cpus.min(MAX_HASH_THREADS).min(buffers.len())`
  `std::thread::scope` threads (`MAX_HASH_THREADS = 4`) when `parallel_cpus >=
  HASH_PARALLEL_MIN_CPUS` (`4`), with `0` idle helper threads, Linux
  `SCHED_BATCH` inheritance via `clone`, inline recomputation on helper spawn
  or unwind failure, and fault hooks folded into `Faults` under
  `cfg(any(test, feature = "test-support"))` (zero test-only parameters on
  shipped signatures).
- Bounded restore-first submission and wakeup (`disk_store.rs`,
  `helios/src/server/runtime.rs`, `shard.rs`): order `Staged::pump_all` as
  inbound restores, then outbound writes, then maintenance while submitting one
  reserved maintenance job ahead of inbound and outbound after
  `MAINTENANCE_DEFER_LIMIT` (`8`) consecutive passes where queued maintenance
  lost free disk-queue space; poll `Worker::idle_wait` at `50 us` during
  active/waiting inbound restores; and wake Unix disk peers via `libc::poll`
  (`POLLIN`).
- Bounded integrated disk-only intake & `NVIDIA#589` unified-memory budget integration
  (`selene/src/offload.rs`, `helios/src/offload/mod.rs`,
  `helios/src/runtime_core/{memory,model}.rs`, `docs/prefix-cache-offload.md`):
  pass explicit `PrepareInputs` (`max_active`, `input_staging`, `shard`,
  `integrated`) into `headroom_with_inputs`, `headroom_with_inputs_for_budget`,
  `prepare_with_inputs`, and `prepare_with_inputs_budget` (deleting unused
  `prepare` and dead `core: &Path`), unify `disk_enabled()`, `headroom_inner`,
  private `target_intake_slots`, and parameterless `Prepared::intake_warning()`
  (`required_intake` + `sized_concurrency`), preserve `options.pool_only()` so a
  degraded disk directory under `--prefix-cache-pool --prefix-cache-memory 0`
  remains restore-only against `NVIDIA#589`'s `planned_offload_host`, and target
  `intake_slots(layout, 1)` (`2 * (64 + row_slots)`) on integrated disk-only
  hosts without shrink warnings across `NVIDIA#589`'s small-SoC headroom scaling,
  explicit `--memory-limit` budgets, pre-planned post-KV `planned_offload_host`,
  and `HOST_NUMA` split-mapping fallback while preserving `NVIDIA#504` lossless KV
  compression. No core re-export or record-format change is required.

Result

Live `flare run` A/B on NVIDIA GB10 (SM121) measured `NVIDIA#497` standalone
(`cd5a366b`) against pre-`NVIDIA#504` `main` (`c0c4f798`) with `--prefix-cache-memory
0 --prefix-cache-disk /tmp/selene-disk` and default `--lossless-kv-compression
off` (the raw v3 `.ckpt` path, whose default GB10 disk-only execution is
unchanged by rebasing onto `ba3afb13` / `NVIDIA#589` because GB10 128 GiB exceeds the
16 GiB small-SoC threshold and disk-only intake targets the same two-window
floor; ingress-to-first-token TTFT; bandwidth is rank-0
`flare_host_cache_inbound_bytes_per_second`):
- `Qwen3.8-27B-NVFP4` (TP1, `--max-concurrency 16 --prefix-cache-disk-limit
  40G`, 3 interleaved repeats): intake drops `7.3 GiB` (`1,877` slots, shrink
  warning) -> `1.0 GiB` (`252` slots, `0` warnings), raising GPU KV cache `64.4
  -> 71.6 GiB` (`+7.2 GiB` / `+235.5K` tokens); median single-restore bandwidth
  and TTFT improve `7.05 -> 8.02 GB/s` (`348.0 -> 301.7 ms`, `-13.3%`; wall
  `353.5 -> 306.5 ms`) at `30.0K` and `6.28 -> 8.68 GB/s` (`+38.2%`, `551.8 ->
  447.6 ms`, `-18.9%`; wall `561.7 -> 455.4 ms`) at `61.1K`; `NVIDIA#497` standalone
  8-way `61.1K` cold-restart burst mean median TTFT drops `8,156.1 -> 6,963.4
  ms` (`-14.6%`, 2 interleaved repeats; combining this change with concurrent
  ancestor-restore read coalescing in companion PR `NVIDIA#496` is unmeasured).
- Isolated `std::thread::scope` `xxh3` (`cd5a366b` with `MAX_HASH_THREADS = 1`
  at `selene/src/disk.rs:157` and no other change vs unmodified `cd5a366b` with
  `MAX_HASH_THREADS = 4`, 3 interleaved repeats on `Qwen3.8-27B-NVFP4`):
  parallel hashing alone improves median TTFT `486.8 -> 447.6 ms` (`-8.1%`,
  `7.73 -> 8.68 GB/s`, `+12.3%`, faster on all 3 repeats: `[447.6, 432.7,
  451.2]` vs `[479.9, 557.5, 486.8] ms`) at `61.1K` and `322.4 -> 301.7 ms`
  (`7.55 -> 8.02 GB/s`) at `30.0K`. `HASH_PARALLEL_MIN_PAGES = 4` and
  `HASH_PARALLEL_MIN_CPUS = 4` assign at least one page per thread at the
  4-thread cap and leave cores for serving threads on narrow hosts (not swept
  separately).
- `Qwen3.8-Flash-Next` (TP1, `--max-concurrency 8 --prefix-cache-disk-limit
  24G`, `cd5a366b` vs `c0c4f798`): intake drops `1.9 -> 0.3 GiB` (`2,288 -> 398`
  slots), raising GPU KV cache `23.28 -> 24.98 GiB` (`+1.70 GiB` / `+127.0K`
  tokens); bandwidth improves `5.67 -> 7.05 GB/s` (`372.1 -> 355.6 ms`) at
  `30.0K` and `6.65 -> 8.35 GB/s` (`+25.6%`, `458.0 -> 413.8 ms`, `-9.7%`) at
  `61.0K`; `NVIDIA#497` standalone 8-way burst median TTFT drops `3,327.5 -> 3,078.5
  ms` (`-7.5%`).
- Expected interaction with `NVIDIA#589` (`ba3afb13`): on unified-memory GPUs with an
  explicit `--memory-limit`, disk-only intake remains bounded at
  `intake_slots(layout, 1)` so unlocked unified RAM expands GPU KV cache rather
  than concurrency-scaled staging, while warm+disk (`--prefix-cache-memory > 0`)
  and pool-only capture retain `NVIDIA#589`'s pre-planned host budget and small-SoC
  scaling.

What it costs: up to three short-lived scoped `xxh3` helpers during >=4-page
raw batches (`0` idle helpers), `50 us` `Worker::idle_wait` polling during
active/waiting inbound restores (`969.9 -> 1,069.2 ms/s` `/proc/<pid>/stat`
server CPU across 8-way `Qwen3.8-27B-NVFP4` bursts: `+99.3 ms/s` / ~`0.10` of
20 Grace cores combined; the `50 us` poll's CPU share and latency contribution
are unisolated from scoped `xxh3` helpers), two-window serialization for
concurrent unique-prefix restores and outbound stores on integrated disk-only
hosts, and up to `8` passes of maintenance deferral.

Companion PR (NVIDIA#496, concurrent ancestor-restore open and window coalescing):
merge `NVIDIA#497` first, then rebase `NVIDIA#496` onto `main` so `Staged::pump_all` retains
`MAINTENANCE_DEFER_LIMIT = 8` (submitting one reserved maintenance job first
after `8` deferred passes) and runs `NVIDIA#496`'s private `host_inbound` and shared
`pump_device_inbound` queues ahead of `outbound` and `maintenance`.

Evidence

- Rebased crate and Python checks over `origin/main` (`ba3afb13`, `NVIDIA#589`) on
  x86_64 Linux (`O_DIRECT` + `io_uring`): `selene --features test-support`
  (`514` lib + `1` `mixed_codec_root` integration passed, `0` warnings; also
  `cargo check --release` without `test-support`, `0` warnings), `selene-manager
  --features test-support --test client --test offload` (`85 + 2` passed, `0`
  warnings), `helios --features runtime-core,server --lib -- offload::
  runtime_core::memory::tests runtime_core::model::tests
  server::runtime::phase_tests` (`144` passed, `14` GPU-only ignored, `0`
  warnings in touched files, covering `NVIDIA#497` + `NVIDIA#589` small-SoC,
  `--memory-limit`, and degraded-disk restore-only pool coexistence), and
  `pytest tests/preparation/test_core_boundary.py
  tests/test_design_review_hook.py` (`22` passed).
- Prior SM121 GPU unit and live checks (at `cd5a366b`, `--lossless-kv-compression
  off`): `helios` `offload::` (`FLARE_RUN_CUDA_TESTS=1 --include-ignored`, `21`
  single-GPU SM121 tests passed; `split_pools` requires 2 local GPUs);
  corrupting a multi-page `.ckpt` payload on `Qwen3.8-27B-NVFP4` incremented
  `fetch_failed_total` (`1`), launched `0` `restore` graphs, and recomputed
  identical `top-5 logprobs` and tokens; under `--prefix-cache-disk-limit 6G`
  (`4` concurrent restores + `3` fresh `30K` stores), disk bytes peaked at
  `6.38 GB` (`<= 6 GiB`) and settled at `6.37 GB` with `0` `retry_abandoned`
  and `0` `io_error` drops (`2` normal `end_of_chain` evictions); four
  concurrent decode streams spilling checkpoints over 30 s on
  `Qwen3.8-Flash-Next` had `0` errors (`100.0 -> 95.9 tok/s`).
- Not covered: live `--lossless-kv-compression` (`cpu`/`gpu`) serving,
  post-rebase SM121 `flare run` re-measurement, live Jetson Orin GA10B /
  `--memory-limit` GPU serving, isolated `50 us` `Worker::idle_wait` A/B,
  `NVIDIA#496 + NVIDIA#497` combined serving, multi-host RoCE serving, 2-GPU `split_pools`,
  discrete PCIe GPUs, Windows serving, and live warm-plus-disk
  (`--prefix-cache-memory > 0`) or `PooledStore` HTTP serving (`CompositeStore`
  + `DiskStore` CUDA transfers were covered at `cd5a366b` in `helios`
  `offload::`).

Discord: Dooner

Design-Signed-Off-By: Antigravity (Gemini 4); design-review=c3a9

Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
The TLS Compose example binds metrics to the container loopback and
leaves port 9108 unpublished, so a scraper on the host cannot connect.

Bind the listener to 0.0.0.0:9108 inside the container and publish
127.0.0.1:9108:9108 on the host. Remove the resolved metrics item from
the TODO list.

Host scrapers can retrieve metrics through the host loopback address.

Both variants started with the same Selene image on Docker Desktop.
The host scrape was refused before the change and returned HTTP 200
with Selene metrics after it. Compose reported 127.0.0.1:9108. The
targeted deployment grace test and git diff --cached --check passed.

Design-Signed-Off-By: Codex (GPT-6); design-review=2e5b

Signed-off-by: Mawen Salignat-Moandal <mwnslgt@gmail.com>
…IA#602)

The Selene network guide still states that the TLS Compose example
shares the host PID namespace. The example has omitted that setting
since the deployment update in NVIDIA#384.

Remove the stale statement and link to the README's PID namespace
requirements for clients connecting over the local Unix socket.

Operators can identify the configuration their kernel and connection
mode require from the deployment guide.

Docker Compose resolved the manager with no pid override and confirmed
control port 9200 and data port 9201. Verified the README link and ran
git diff --cached --check. No runtime tests were run for this edit.

Design-Signed-Off-By: Codex (GPT-6); design-review=2e5b

Signed-off-by: Mawen Salignat-Moandal <mwnslgt@gmail.com>
…VIDIA#496)

Why

When concurrent requests restore distinct branch checkpoints sharing a
disk-resident ancestor prefix, Helios deduplicates inbound restore tickets by
endpoint key, so each branch submits its own GPU restore (`Staged::fetch`) in
`selene/src/disk_store.rs`. Before this change, each restore opened every
ancestor record file independently and staged private 64-page windows, repeating
`O_DIRECT` opens, reads, and checksum verification once per branch.

Published record files are immutable and stay pinned in `DiskStore` across every
referencing restore. Coalescing belongs in `Staged` rather than `DiskThread`
because `DiskThread` sees only file offsets and raw buffers and finishes once
direct I/O completes, whereas shared `SlabPool` staging slots and v4
`ReadPacked` payload buffers must remain pinned until every attached follower's
asynchronous `Copier` decode or GPU upload completes.

What

- Shared device-inbound state machine (`selene/src/disk_store.rs`,
  `selene/src/disk_store/coalesce.rs`):
  - Before: `Staged` ran every host and GPU inbound read through an isolated
    per-fetch `InboundRecord`, opening each segment and staging private 64-page
    windows independently.
  - After: caller-owned host reads (`Staged::read_into` using
    `plan_windows(..., false)` and `Staged::read_into_packed` storing
    `(Header, Arc<Vec<u8>>)` in `completed_packed_reads` for `CompositeStore`)
    stay on private `HostInbound`. Device fetches (`Staged::fetch`,
    `plan_windows(..., true)`) delegate to `DeviceCoalescer` in
    `selene/src/disk_store/coalesce.rs`, slicing on `WINDOW_PAGES` (64-page)
    file boundaries and sharing one open file handle per `SegmentKey` and one
    `SharedWindow` per `WindowKey` (`O(1)` `window_index` lookup) across both
    raw v1-v3 `SlabPool` staging windows and v4 `packed` `ReadPacked` buffers
    (which allocate zero `SlabPool` slots and retain `Arc<Vec<u8>>` until every
    follower's `Copier` decode and upload completes).
- Exhaustive `Header`/`packed::Layout` hashing with cached digest and lazy
  demand indexing (`selene/src/shared/packed.rs`, `selene/src/shared/record.rs`,
  `selene/src/disk_store/coalesce.rs`):
  - Before: `Header` and `packed::Layout` had no `Hash` implementation; hashing
    an entire `packed::Layout` (up to 8,200 `PackedUnit`s on TP8 1,024-page
    records) or eagerly rebuilding `demand` on full-credit `poll()` ticks
    would stall the worker thread.
  - After: `packed::Layout` implements `Eq` and exhaustive `Hash` over `Layout`,
    `PackedOffer`, and `PackedUnit`; `RankSizes` derives `Hash`; `Header`
    implements exhaustive `Hash` beside `PartialEq` (omitting only encoding
    `version`); `HeaderIdentity::new(Arc<Header>)` precomputes a deterministic
    `u64` digest once with `DefaultHasher::new()`, `HeaderIdentity::hash`
    hashes only that cached `u64`, and `HeaderIdentity::eq` short-circuits on
    digest mismatch and `Arc::ptr_eq` before comparing full `Header` values;
    and `start_new_windows` builds `demand` lazily only when a fetch holds free
    window credit and needs to start a new window (skipping demand indexing
    when at most one fetch is active).
- Tight-pool shared-ancestor holdback (`selene/src/disk_store/coalesce.rs`):
  - Before: skipping any unstarted plan whose `Layout::record_slots` exceeded
    currently free slots allowed a sibling on a tight `2 * (64 + row_slots)`
    pool to grab leftover slots for a small private tail instead of waiting for
    a 64-page shared ancestor window, fragmenting slots and forcing re-reads.
  - After: `pick_next_pending_plan` computes `reachable_free = free +
    self.staged_slots() + outbound_slots` and holds back lower-demand windows
    whenever a higher-`peer_demand` shared window fits within `reachable_free`.
    Because in-flight staged windows drain without allocating new slots,
    waiting never deadlocks when no staged slots can free or under external
    pool retention.
- End-to-end `DiskStore::inbound_rate` and per-fetch `bytes_in`
  (`selene/src/disk_store.rs`):
  - Before: `DiskStore::inbound_rate` observed every completed fetch's
    `(bytes, started.elapsed())`, which would let staggered coalesced followers
    riding pre-existing windows overstate bandwidth.
  - After: `StoreStats.bytes_in` continues counting per-fetch payload bytes
    restored across completed fetches (raw bytes for v1-v3 records and
    compressed payload bytes for v4 packed records, credited once per completed
    fetch including coalesced followers), while `StoreStats.inbound_rate`
    observes end-to-end uncompressed checkpoint bytes
    (`layout.record_bytes(chain.pages)`) over full fetch wall time (covering
    `Open`, slot queueing, disk read, codec decode, GPU upload, and all
    `Sharded` ranks) in the same units as `HostHit::estimated_seconds` and
    `worth_fetching()`. Restores submitted while an in-flight restore already
    reads a shared segment (`rode_preexisting`) skip `inbound_rate.started()`
    and observe `inbound_rate` only downward (when `(logical_bytes / elapsed) <
    inbound_rate.get()`), so fast coalesced followers never inflate bandwidth
    while continuous overlapping streams, mid-stream slowdowns, and bursts
    whose leader fails still push `inbound_rate` down without drifting to the
    3.0 GB/s seed, and slow disks can still recover upward when throughput
    improves. No `DiskTransport` or `shard.rs` rate-sampling plumbing and no
    `TransportEvent` change are added.
- Failure isolation and docs (`selene/src/disk_store/coalesce.rs`,
  `docs/prefix-cache-offload.md`): private child or transient follower GPU
  upload errors fail only that restore; shared open, read, or packed-payload
  content errors (`is_packed_content_error`, marked with `with_record_read()`)
  fail all attached restores after in-flight I/O drains so `DiskStore::apply`
  drops the corrupt endpoint's lookup row. The last user of a shared segment
  waits for disk close (`disk_settled`) before emitting `Fetched`, and
  `Staged::close` reports abandoned transport jobs separately from leaked
  shared staging entries. Diagnostic counters are gated under `test-support`,
  and `docs/prefix-cache-offload.md` (sections 2.4 and 4) documents raw and v4
  packed coalescing, tight-pool holdback, and end-to-end rate accounting. No
  core re-export, record format, wire protocol, or `TransportEvent` change is
  required.

Result

Overlapping GPU restores open a shared ancestor file once and read each aligned
64-page raw or v4 packed window once while staged (windows already released
before a later restore attaches are read again). As an expected bound,
single-restore callers skip demand indexing (`device_inbound.len() <= 1`) and
pay at most one extra partial window per segment when `skip_pages % 64 != 0`.

On x86_64 Linux (`--release` `selene` tests over `io_uring` + ext4, `rustc
1.100.0`, 1,000 full-credit polls), full-credit (2/2) `Staged::poll()` mean
latency with 8 concurrent v4 packed fetches drops from `1,354.937 us` ->
`0.693 us` (`1,955x`, p99 `0.701 us`, credit-regained demand pass `31.396 us`)
at TP1 512 pages (`513` `PackedUnit`s), `10,347.821 us` -> `0.664 us`
(`15,584x`, p99 `0.679 us`, demand pass `31.298 us`) at TP8 512 pages (`4,104`
`PackedUnit`s), and `44,447.427 us` -> `0.745 us` (`59,661x`, p99 `1.392 us`,
demand pass `39.897 us`) at TP8 1,024 pages (`8,200` `PackedUnit`s), with zero
demand rebuilds at full credit. Single-fetch full-credit mean latency stays at
`0.252-0.256 us` (`23.8-26.6 us` demand pass).

Live `flare run` A/B on NVIDIA GB10 (SM121) comparing `main` before v4 packed
records (`c0c4f798`) against `0c04b1e2` with `--lossless-kv-compression` off
and `--prefix-cache-memory 0 --prefix-cache-disk /tmp/selene-disk`
(`--max-concurrency 16 --prefix-cache-disk-limit 40G` on `Qwen3.8-27B-NVFP4`;
`--max-concurrency 8 --prefix-cache-disk-limit 24G` on `Qwen3.8-Flash-Next`).
Each trial warms one ~61K-token shared prefix plus 8 child branches (~256
unique tail tokens each) to disk, restarts `flare run` so GPU memory starts
empty, and sends 8 concurrent `/v1/chat/completions` follow-ups (ingress-to-
first-token TTFT; read-reduction ratios are ratios of tabulated means):
- `Qwen3.8-27B-NVFP4` (TP1, `60.5K`, 2 interleaved repeats): physical NVMe reads
  drop `18,177.5 -> 4,306.7 MB` (`2,274 MB` single restore — `472` pages at
  `128` tokens/page plus `101 MB` continuation row, so `18,177.5 MB` is `8x`
  full copies; `4.22x`, `-76.3%`), median TTFT `7,974.6 -> 5,662.8 ms`
  (`-29.0%`) simultaneous; and `18,194.2 -> 4,843.6 MB` (`3.76x`, `-73.4%`),
  TTFT `6,883.6 -> 5,951.9 ms` (`-13.5%`) at `+25 ms` stagger.
- `Qwen3.8-Flash-Next` (TP1, `61.0K`): NVMe reads drop `7,944.9 -> 1,981.1 MB`
  (`4.01x`, `-75.1%`, TTFT `3,327.5 -> 3,225.0 ms`) simultaneous, and `7,958.0 ->
  2,251.5 MB` (`3.53x`, `-71.7%`, TTFT `3,137.7 -> 3,049.9 ms`) at `+25 ms`
  stagger.

Recommended merge order with companion PR `NVIDIA#497` (Selene pipeline
prioritization and tighter `2 * (64 + row_slots)` intake pools): merge `NVIDIA#497`
first, then rebase `NVIDIA#496` onto `main` so `Staged::pump_all` retains
`MAINTENANCE_DEFER_LIMIT = 8` and runs `host_inbound` and `pump_device_inbound`
ahead of `outbound` and `maintenance`.

Evidence

- Verified on x86_64 Linux (`O_DIRECT` + `io_uring`, ext4, `rustc 1.100.0`) on
  the exact archived tree over `main` (`6d74db3a`; merges cleanly against
  `origin/main` `9031847a`):
  - `cargo check --locked --release --manifest-path selene/Cargo.toml
    --all-targets` (`0` warnings, with and without `test-support`).
  - `cargo test --locked --release --manifest-path selene/Cargo.toml --features
    test-support`: `522` lib + `1` `mixed_codec_root` passed, `0` failed,
    including `HeaderIdentity` cached-digest equality, full-credit large packed
    header `poll()` latency and zero-demand-rebuild verification (reproducible
    with `--lib
    poll_at_full_window_credit_with_large_packed_header_avoids_demand_rebuild_and_rehashing
    -- --nocapture`), end-to-end `inbound_rate` and `worth_fetching()` pricing
    on delayed v4 packed and multi-rank `Sharded` + `Peer` restores, staggered
    follower non-inflation, continuous overlapping shared-stream aging,
    mid-stream slowdown, and slow-to-fast upward recovery, leader private
    failure with slow follower rate update and `worth_fetching()` rejection,
    tight `2 * (64 + row_slots)` pool shared-ancestor holdback
    (`disk_window_reads == 5`, `coalesced_windows == 3`) and deadlock freedom
    under external pool retention and concurrent outbound stores, multi-rank
    `Sharded` + `Peer` coalescing, 4-way v4 packed coalescing and
    corrupt-packet `record_read` invalidation, misaligned follower
    partial-tail+row parity, private vs shared failure isolation, and
    `Staged::close` draining.
  - `cargo test --locked --release --manifest-path selene-manager/Cargo.toml
    --test client --test offload`: `85 + 2` passed, `0` failed.
  - `cargo check --locked --manifest-path helios/Cargo.toml --features
    runtime-core,server --all-targets`: passed (`0` warnings in touched crates).
  - `pytest tests/preparation/test_core_boundary.py
    tests/test_design_review_hook.py`: `22` passed, `0` failed.
- Prior SM121 GPU evidence at `0c04b1e2` against `main` before v4 packed
  records (`c0c4f798`, raw v3 records / `--lossless-kv-compression` off):
  `helios` `offload::` (`FLARE_RUN_CUDA_TESTS=1 --include-ignored`) passed all
  `21` single-GPU SM121 tests (`split_pools` requires 2 local GPUs); live SM121
  parity across 5 cold-VRAM restart repeats (`seed = 1234..1238`, `60,534`
  tokens, `top_logprobs = 5`) on `Qwen3.8-27B-NVFP4` TP1 produced identical FP32
  `top-5 logprobs` and token IDs vs `main` (`c0c4f798`) on all 5 repeats; and 4
  concurrent decode streams spilling checkpoints over 30 s on
  `Qwen3.8-Flash-Next` TP1 had `0` errors (`100.0 -> 100.6 tok/s`).
- Not covered: live SM121 `--lossless-kv-compression` (`cpu`/`gpu`) serving,
  post-fix SM121 `flare run` re-measurement, multi-host RoCE serving, 2-GPU
  `split_pools`, discrete PCIe GPUs, Windows serving, and live warm-plus-disk
  (`--prefix-cache-memory > 0`) or `PooledStore` HTTP serving (`CompositeStore`
  + `DiskStore` CUDA transfers are covered in `helios` `offload::`).

Discord: Dooner

Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=eb2f

Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
Co-authored-by: derek <derek.yates@live.com>
…NVIDIA#580)

During disk-backed embedding gathers (`--embedding-table-storage disk` with a
nonzero host row cache), inserting demand misses into `RowCache` before
signaling `engram_ready` keeps GPU streams waiting on host-only cache
bookkeeping after staged output bytes are already complete in mapped host
memory. Because each table worker owns its `Reader` and bounded miss workspace
exclusively and processes operations sequentially, it can publish the staging
frame's readiness generation as soon as staged rows and any advisory lookahead
snapshot are written, then commit the fetched misses into `RowCache` before
taking its next action.

- `helios/src/engram/reader.rs` (`CachedReader`, `Reader`, `UnixLane`) and
  `helios/src/engram/cache.rs`:
  - Before: `CachedReader::gather` inserted demand misses into `RowCache`
    inside the pre-signal gather and included that host insertion in
    `flare_engram_gather_nanoseconds_total`, and `UnixLane` dropped its
    `io_uring` fd without synchronously unregistering fixed staging buffers.
  - After: `Reader::gather_into_output` stages cached hits and direct-I/O
    misses into `output`, records `pending_commit: Option<[usize; 2]>` holding
    the `[weights, scales]` row byte widths, and returns `Ok(true)` when misses
    await cache insertion. `Reader::commit_misses` consumes `pending_commit`,
    inserts the staged misses into `RowCache`, and flushes batched
    `resident_rows` and `evictions` counters once per commit without adding to
    `flare_engram_gather_nanoseconds_total`. `clear_pending_commit` clears
    `pending_commit` and `miss_ids` at the start of `gather_into_output` and
    chunked `warm` (`ids.chunks(self.max_rows)`), on validation or disk errors
    in `gather_into_output` and `warm`, and on teardown skips so truncated or
    superseded workspace state never enters `RowCache`. `Drop for UnixLane`
    calls `unregister_buffers()` synchronously before closing the ring fd so
    teardown releases `RLIMIT_MEMLOCK` accounting promptly instead of queuing
    locked pages behind deferred `io_uring` exit work.
- `helios/src/engram.rs` (`Stats`, `WorkerFrame`, `run_reader_worker`,
  `commit_gathered_misses`) and `helios/README.md`:
  - Before: the table worker called `reader.gather` before signaling the
    staging frame, and `flare_engram_gather_nanoseconds_total` described
    undifferentiated gather wall time.
  - After: `run_reader_worker` preserves bounded `warm_batch` sizing
    (`WARM_BATCH_ROWS.min(max_tokens * heads).max(1)`), snapshots any advisory
    mailbox, signals `buffers.signal(job.generation)`, and calls
    `commit_gathered_misses`. `commit_gathered_misses` skips `commit_misses`
    (clearing `pending_commit`) when `stop` is already set during teardown, and
    wraps `commit_misses` in `std::panic::catch_unwind` so a panic records
    `buffers.error`, clears pending advisory warming, sets `stop`, and lets
    pipelined waiting frames (`STAGING_FRAMES = 2`) drain cleanly. Updated the
    Prometheus `HELP` string for `flare_engram_gather_nanoseconds_total` and
    `helios/README.md` to state that gather time covers pre-signal staging and
    excludes deferred row-cache insertion.
- Compatibility: model core format, Protobuf schemas, and prepared graph
  contracts are unchanged; existing signed cores load and serve without
  re-export.

Claimed benefit and observed results:
- GPU consumers waiting on the mapped readiness flag proceed without waiting
  for host `RowCache` insertion, while subsequent gathers on the same worker
  observe the cached rows. Moving `commit_misses` after `signal` shifts
  deferred cache insertion out of `flare_engram_gather_nanoseconds_total`.
- Isolated `flare run` A/B on prior revision
  `bc1af24721f3f2850886a04a2f61510df6d03c77` (4x RTX PRO 6000 Blackwell SM120,
  DeepSeek-V4.1-Flash TP4, Gen5 NVMe, `--embedding-table-storage disk
  --embedding-table-cache-size 4GiB --embedding-table-resident-scales`): with
  default advisory prefetch enabled, `cold_8k` improved `21,729 -> 22,661
  tok/s` (`+4.3%`, readiness wait `0.20 -> 0.18 s`), `decode C=1` `419.6 ->
  457.6 tok/s`, `decode C=8` `678.8 -> 682.5 tok/s`, `cold_250k_1` `40,843 ->
  40,940 tok/s` (`+0.2%`, readiness wait `1.82 -> 1.79 s`, `gather_sum` `3.51
  -> 3.16 s`), and `warm_250k_1_rep` readiness wait stayed `0.29 s`; with
  `--no-embedding-table-prefetch`, `cold_64k` improved `23,849 -> 24,504 tok/s`
  (`+2.7%`, readiness wait `1.55 -> 1.48 s`) and `cold_8k` `22,010 -> 22,505
  tok/s` (`+2.2%`).

Supporting evidence and limitations:
- Rebased cleanly atop `origin/main` (`9031847aacbc0037ac54c3ef854083c43b34124a`),
  preserving `lane_fanout`, `/proc/self/fd` read-only resident remap, checked
  mailbox validation, `warm_batch`, and chunked `CachedReader::warm`.
- Verified from clean `git archive` on Linux/WSL2 x86_64 (`rustc 1.100.0`,
  plain local `ext4`, 64 MiB `RLIMIT_MEMLOCK`):
  - `cargo test --locked --release --manifest-path helios/Cargo.toml --features
    runtime-core,server --lib engram -- --test-threads=1` (and `--test-threads=4`):
    48 passed, 0 failed, 0 ignored (0 compiler warnings in touched files),
    covering pre-signal output staging, `pending_commit` clearing across
    validation/disk errors and multi-chunk `warm`, batched eviction accounting,
    `Stats::render` metric help text, teardown skip when `stop` is set, and
    `catch_unwind` draining a pipelined second frame on `commit_misses` panic.
  - `cargo test --locked --release --manifest-path helios/Cargo.toml --features
    runtime-core,server --lib`: verified zero regressions relative to
    `9031847a` (only `FLARE_TEST_TEMPLATE_DIR`-gated frontend template tests
    and pre-existing `model::tests::packed_combined_budget_keeps_width_one_batches_without_a_useful_packed_shape` fail on this host).
  - `pytest -q -rs tests/preparation/test_core_boundary.py
    tests/test_design_review_hook.py`: 22 passed, 0 failed.
  - `python3 verification/helios-lifecycle/check.py --mutations`: all 9 TLA+
    lifecycle models, 8 Rust trace-conformance suites, 12 TLA+ model mutations,
    and 20 Rust guard mutations passed.
- Limitations: live GPU `flare run` serving was measured on
  `bc1af24721f3f2850886a04a2f61510df6d03c77` (before the post-review
  `526e1457` `catch_unwind` / `pending_commit` hardening and this rebase onto
  `9031847a`) and was not re-run on this commit or on SM103, SM121, Windows,
  or cross-node setups.

Discord: Dooner

Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=c3a9

Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
…ulti-process put corruption, and offload lifecycle bugs (NVIDIA#607)

Why:
Six memory-safety, remote-DoS, and state-corruption defects exist across
`selene-manager`, `selene`, and `helios` in Selene pool transfers and prefix
cache offload:

1. Remote data-channel staging UAF (`selene-manager/src/pool/claims.rs`):
   `Core::window_released` omitted the `claim.channel().is_some()` guard that
   `Core::window_filled` applies for `source_channel()`. A remote gRPC
   `WindowReleased` message cleared reader bit 0 and dropped
   `window.extent = None` while `selene-manager/src/data/channel.rs` (which
   holds no `Arc<Extent>`) was still reading `regions.bytes` or issuing RDMA
   writes from that staging slice, allowing use-after-free and cross-tenant KV
   leakage when the arena reallocated the extent.
2. Remote 100% CPU hang in `walk_chain` (`selene-manager/src/pool/mod.rs`,
   `selene-manager/src/pool/index.rs`): `entry_from` accepted self-parenting or
   non-monotonic parent keys (`parent.consumed_tokens >= key.consumed_tokens`),
   and `walk_chain` skipped `nodes.push` when `parent.tail_pages == 0`, so
   `nodes.len() >= max_nodes` never triggered on zero-page cycles or long
   zero-page chains. A single self-parenting notice could freeze
   `selene-manager` at 100% CPU.
3. Staging slot aliasing UB and premature peer window release
   (`selene/src/pool/agent.rs`, `selene/src/pool/engine/requester.rs`):
   When `channel.send(...)` returned `false` in `Agent::window_drained`, the
   agent released the staging slot without removing the window from
   `run.windows`, causing `Agent::drive` to release the same slot a second time
   into `Staging::free` (allowing concurrent `&mut [u8]` aliasing). In
   `Engine::withdraw_queued`, rank 0 released windows as soon as
   `w.jobs_left == 0` without checking `w.peers_left.is_empty()`, emitting
   `WindowReleased` while a shared-memory peer rank still had in-flight DMA.
4. Store transfer ID collision and broken linked multi-process puts
   (`selene-manager/src/pool/store_bridge.rs`,
   `selene-manager/src/pool/claims.rs`): `Core` passed raw client `put_id` and
   `claim_id` directly as `StoreCommand::*::transfer` into the store's single
   per-connection `ops` map, allowing concurrent puts and manager-backed claims
   with the same numeric client ID to collide or silently cross-cancel each
   other on `StoreCommand::Cancel`. Separately, `Core::put_answer` stored
   chain-absolute `grant.page_first` in `PutWin.first_page` instead of the
   record-relative offset used by `WindowSpec.first_page` and `put_commit`, so
   `put_pass_done` populated `mp.whole` starting at the parent's page count and
   `put_commit` failed every linked multi-process put with missing page
   checksums.
5. Stale pool plan on `Worker::park`, async CPU-codec refill pin leak, v3 disk
   quarantine gap, and expiry sweep hiding (NVIDIA#439)
   (`helios/src/server/runtime.rs`, `selene/src/memory.rs`,
   `selene/src/composite.rs`, `selene/src/shared/index.rs`):
   - `Worker::park` extended `incoming.prompt.tokens` and called
     `begin_pool_lookups` without clearing surviving pre-admission
     `pool_plan` / `pool_lookup`, causing `begin_pool_lookup` to keep or
     refresh the shorter pre-park `PrefixHistory`.
   - `MemoryStore::drain_compressed` guarded `start_deferred` with
     `if !refill`, stranding child checkpoints deferred during an async
     CPU-codec row refill and leaking their VRAM checkpoint pins.
   - `CompositeStore::disk_read` only quarantined corrupt disk records on the
     packed v4 path; unpacked v1/v2/v3 read errors hit `(Err(error), _)`
     without releasing the incomplete memory copy or quarantining damaged disk
     pages, causing repeated failing lookups on corrupt ancestors.
   - `Index::expired` used `take_while` over access-tick order and stopped at
     the first fresh leaf, so a leaf whose `last_used` was refreshed by
     `touch_ancestors` without advancing its access tick (issue NVIDIA#439) hid
     expired leaves behind it.

What exactly changed:
- `selene-manager/src/pool/claims.rs`:
  - Before: `Core::window_released` called `reader_done(key, m.index, 0)` even
    when the claim used a rank-0 data channel.
  - After: returns `Ok(())` immediately when `claim.channel().is_some()`, so
    only the data-channel handler's `Event::Sent` or `Event::Closed` releases
    bit 0 and the staging extent.
- `selene-manager/src/pool/mod.rs` and `selene-manager/src/pool/index.rs`:
  - Before: `entry_from` did not compare `parent.consumed_tokens` against
    `key.consumed_tokens`, and `walk_chain` bounded only page-bearing nodes in
    `nodes.len()`.
  - After: `entry_from` rejects `parent.consumed_tokens == 0` or
    `parent.consumed_tokens >= key.consumed_tokens`; `walk_chain` returns
    `None` for `page_tokens == 0 || max_nodes == 0`, requires strictly
    decreasing non-zero `consumed_tokens` on every step, and counts every
    visited entry against `max_nodes`.
- `selene/src/pool/agent.rs`, `selene/src/pool/net.rs`, and
  `selene/src/pool/engine/requester.rs`:
  - Before: `Agent::window_drained` released `slot` on `!sent` while leaving
    the window in `run.windows`, and `Engine::withdraw_queued` released windows
    on `w.jobs_left == 0` alone.
  - After: `Agent::window_drained` calls `self.forget_window(xfer, index)`
    after `self.release_slot(slot)` on `!sent`; `Staging::release` adds a
    `debug_assert!` rejecting duplicate slot release; `Engine::withdraw_queued`
    requires `w.jobs_left == 0 && w.peers_left.is_empty() && !w.released`.
- `selene-manager/src/pool/{store_bridge,core,claims}.rs`:
  - Before: `StoreCommand` requests used raw client `put_id` / `claim_id` as
    `transfer`, and `PutWin.first_page` stored `grant.page_first as u32`.
  - After: `StoreHandle::next_transfer` allocates monotonic manager-side
    transfer IDs stored on `PutRec::transfer` and `ManagerGet::transfer` for
    all `StoreCommand` calls (`PutBegin`, `GetBegin`, `WindowFilled`,
    `PutCommit`, `RequestWindow`, `Cancel`), and `Core::put_answer` computes
    record-relative `first_page` once (`grant.page_first as u32 - accepted.1`
    when `page_count > 0`, else `0`) for both `PutWin` and `WindowSpec`.
- `helios/src/server/runtime.rs`:
  - Before: `Worker::park` left `blocked`, `pool_lookup`,
    `pool_lookup_started`, `pool_plan`, and `restore_wait` intact before
    calling `begin_pool_lookups`.
  - After: clears all five fields before calling `begin_pool_lookups` on the
    extended prompt tokens.
- `selene/src/memory.rs`:
  - Before: `MemoryStore::drain_compressed` skipped `start_deferred` when
    `rec.refill` was true.
  - After: calls `self.core.start_deferred(&key, events)` unconditionally after
    `apply_compressed`.
- `selene/src/composite.rs`:
  - Before: `CompositeStore::disk_read` recorded `inbound.error` on
    `(Err(error), _)` without completing/discarding the memory allocation or
    quarantining the disk record.
  - After: releases the incomplete memory record via
    `complete_record(&node, false)`, resets the inbound node state to
    `NodeState::Waiting`, and calls `self.disk.quarantine_corrupt(&node)` when
    `error.is_record_read()`.
- `selene/src/shared/index.rs` and `docs/prefix-cache-offload.md`:
  - Before: `Index::expired` stopped at the first fresh leaf via `take_while`.
  - After: filters `self.ordered()` for eligible expired leaves (`children == 0`
    and age `>= max_age`) without moving LRU ticks, and updates
    `docs/prefix-cache-offload.md` to match.

Claimed benefit and result:
- Observed in CPU unit tests: all 11 added regression tests verify each
  invariant directly on production entry points (data-channel extent retention
  across gRPC `WindowReleased`, rejection of self-parent/cyclic/oversized
  zero-page chains, single staging-slot release on failed channel send,
  peer-DMA gating in `withdraw_queued`, disjoint store transfer IDs for
  concurrent `put_id == claim_id`, successful linked multi-process put commit,
  fresh `PrefixHistory` planning after `Worker::park`, deferred child wakeup
  after async CPU-codec row refill, quarantine and repair of corrupt v3 disk
  ancestors, and expiry past leaves refreshed without a new access tick).
- Expected in production serving: eliminates remote data-channel staging UAF
  and self-parenting CPU DoS in `selene-manager`, prevents staging slot
  aliasing and mid-DMA window release in multi-process `selene` clients,
  restores linked multi-process puts and concurrent put/get isolation in the
  manager store bridge, prevents stale pool prefix planning after parking in
  Helios, prevents VRAM pin leaks after async row refills, quarantines damaged
  v3 disk records, and resolves NVIDIA#439. No model core re-export or wire protocol
  change is required.

Supporting evidence and limitations:
- Targeted regression tests (all 11 passed, 0 failed):
  - `cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support --target-dir flare-cli/target --lib -- failed_channel_send_releases_staging_slot_once withdraw_queued_waits_for_peer_dma_before_releasing_window async_cpu_codec_refill_wakes_deferred_child corrupt_ancestor_v3_page_is_quarantined_and_replaceable expired_sweep_skips_leaf_refreshed_without_new_tick` (5/5 passed).
  - `cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support --target-dir flare-cli/target --lib -- window_released_from_channel_requester_does_not_drop_extent entry_from_rejects_self_parent_and_non_monotonic_parent walk_chain_rejects_self_parent_cycles_and_zero_page_chains_beyond_max_nodes put_and_get_with_same_client_id_use_disjoint_store_transfers linked_multi_process_put_stores_record_relative_window_first_page` (5/5 passed).
  - `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target --lib -- worker_park_clears_stale_pool_plan_and_lookup` (1/1 passed).
- Full crate and formal verification runs:
  - `cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support --target-dir flare-cli/target`: 510 passed, 0 failed.
  - `cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support --target-dir flare-cli/target`: 185 `--lib` tests and all 11 integration test binaries (`builder`, `l0`, `offload`, `packed`, `pool_channel`, `pool_claims`, `pool_l0`, `pool_net`, `pool_relay`, `pool_store`, `rank_processes`) passed; `--test client` passed 84/85, with `a_record_put_into_a_manager_on_another_host_is_restored_over_tcp` exhibiting a pre-existing timing race against the 10 ms `Core::tick()` metrics refresh (`stream: 2 windows` when the second restore completes before the next tick; passed 1/5 isolated reruns).
  - `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --target-dir flare-cli/target --lib -- server::runtime`: 133 passed, 0 failed, 1 ignored.
  - `python3 verification/helios-lifecycle/check.py --tlc-jar ~/.cache/flare-formal/tla2tools-1.7.4.jar --java ~/.cache/flare-formal/jdk-21.0.13+9-jre/bin/java --target-dir flare-cli/target`: exited 0 (all TLC models and observed-edge Rust conformance checks passed, including `ResponseLifecycle` and reasoning continuation).
- Limitations and unrun checks:
  - `flare/Cargo.toml --locked` failed on an unrelated upstream lockfile mismatch for `deepseek-recipe` (`flare/` and `flare-cli/` were not modified).
  - `helios` chat-template tests requiring `FLARE_TEST_TEMPLATE_DIR` and live GPU/RDMA execution (`FLARE_RUN_CUDA_TESTS=1`) were not run.


Design-Signed-Off-By: Antigravity (Gemini); design-review=c3a9

Signed-off-by: Luke Alonso <lalonso@gmail.com>
lukealonso and others added 2 commits November 29, 2026 09:23
… script separation (NVIDIA#608)

Why:
With the Native serving workflow disabled and no Python CPU workflow in
place, several regressions accumulated across Helios graph validation,
direct-scheduler benchmarking, and post-split packaging:
1. Removing hardcoded batch-capacity lists from `helios/src/model/catalog.rs`
   replaced per-batch lifecycle and speculative checks with whole-manifest
   existence checks, allowing incomplete per-batch catalogs and breaking
   `packed_round_tests`. In `helios/src/runtime_core/selection.rs`, width
   eligibility still filtered against `active.next_power_of_two()` instead
   of the covering `max_batch` derived from core metadata, and
   `ActionCosts::fresh_duration` hardcoded `batch: 1`, silently disabling
   prefix checkpointing when a core's smallest declared `Snapshot` batch is
   not 1.
2. Both `pyproject.toml` and `local-inference-lab/hyperflare-recipes`
   declared `[project.scripts] ignition`, causing `uv sync` with a warm
   cache to clobber `.venv/bin/ignition` with the recipe-free entrypoint
   (`hyperflare-recipes#20`). Core `ignition` must remain recipe-free
   without a plugin discovery framework, so separating core's console script
   name eliminates the collision without adding discovery machinery.
3. `Request._core_parameters` wrapped resolved parameters in a
   `MappingProxyType`, causing `copy.deepcopy(scheduler, ...)` in
   `ignition/bench/runner.py` and `tests/bench/test_runner.py` to fail with
   `TypeError: cannot pickle 'mappingproxy' object`.
4. `.github/workflows/native-serving.yml` omitted `--recipe minimax_m3`
   when fetching template fixtures required by `frontend::jinja::tests`,
   two capture tests omitted `capture_allocation_sizes` and
   `all_gather_object`, two core-protection assertions lagged refactored
   Rust error messages, and two CUDA component tests whose support modules
   moved to `hyperflare-recipes` broke `pytest` collection.

What exactly changed:
- `helios/src/model/catalog.rs`: Replaced manifest-wide `.any(...)` checks
  with per-batch parity validation across the union of declared lifecycle
  (`Init`, `Restore`, `Snapshot`, `Resume`) and generation (`Decode` or
  `Speculative`) batches, including per-batch width-one and wider
  speculative verification checks when `batch * 2 <= speculative_token_capacity`.
- `helios/src/runtime_core/selection.rs`: Computed `speculative_max_batch`
  from the smallest declared speculative batch covering `active` before
  filtering `eligible_widths`, matching the subsequent `max_batch` graph
  retention filter, and added a unit test for intermediate bucket 6 vs 8.
- `helios/src/scheduler/cost.rs`: Changed `ActionCosts::fresh_duration` to
  query `self.batches(kind).first().copied()?` instead of hardcoded
  `batch: 1`, and added a unit test for a `Snapshot(batch=2)` catalog.
- `pyproject.toml` and `tests/preparation/test_packaging.py`: Renamed core
  Ignition's console script from `ignition` to `ignition-core` (`python -m
  ignition` is unchanged).
- `ignition/direct/scheduler.py`: Added `Request.__deepcopy__` preserving
  read-only `MappingProxyType` wrappers on `_core_parameters`.
- `.github/workflows/native-serving.yml` and
  `.github/workflows/python-cpu.yml`: Added `--recipe minimax_m3` to
  template fixture preparation and added an `ubuntu-24.04` CPU pytest
  workflow (`uv sync --extra prepare --extra test` and
  `CUDA_VISIBLE_DEVICES="" .venv/bin/python -m pytest tests/ -q`).
- `tests/preparation/{test_capture_roce_wait,test_transient_retention,test_core_protection}.py`
  and `tests/components/test_{draft_block_broadcast,vocabulary_commit}_cuda.py`:
  Updated capture test doubles to match `capture.py`'s allocation-ordering
  and retirement hooks, aligned two `test_core_protection.py` error-string
  assertions with `protection.rs:995` and `archive.rs:134`, and removed the
  two leftover split CUDA tests relocated to `hyperflare-recipes`.

Claimed benefit and result:
Restores green Rust (`helios`, `flare`, `eos`, `selene`, `selene-manager`,
`heliopause`), TLA+ lifecycle conformance, and CPU Python test suites on
`main`, prevents `.venv/bin/ignition` script clobbering when
`hyperflare-recipes` installs `ignition` as a dependency, and adds
automated CPU Python CI coverage.

Supporting evidence and limitations:
- Rebased on `f7256584`: `cargo test --locked --release --manifest-path
  helios/Cargo.toml --features runtime-core,server --lib` with prepared
  templates (including `minimax_m3`) passed 1,713 tests (0 failed, 43
  ignored), including `packed_round_tests` and both new `selection.rs` and
  `cost.rs` tests.
- Prior to the final docs/Selene rebase (identical code diff): `eos`,
  `selene` (`test-support`), `selene-manager` (`test-support`), `flare`
  (234 lib + 7 + 1), `heliopause` (211 passed, 6 ignored), and
  `python3 verification/helios-lifecycle/check.py --tlc-jar /tmp/tla2tools.jar`
  (all 8 TLA+ models and 95 observed Rust traces) passed.
- Rebased on `f7256584`: `CUDA_VISIBLE_DEVICES="" pytest` passed 190 tests
  (1 skipped) across `tests/bench/test_runner.py`,
  `tests/preparation/{test_capture_roce_wait,test_transient_retention,test_packaging,test_core_boundary}.py`,
  and `tests/cli/`. Full CPU `pytest tests/` prior to rebase passed 2,317
  tests (454 skipped); `test_core_protection.py` passed 4/4 targeted tests;
  `test_source_identity.py::test_heliopause_build_source_identity_matches_workspace_sources`
  failed only because the pre-existing `.venv` held an older compiled
  `flare_heliopause` binary rather than one rebuilt from this worktree.
- Limitations: `cargo kani` is not installed on this host and was not run
  locally (covered by `helios-lifecycle.yml`); no GPU export or live
  serving run was executed; `flare-cli`'s
  `distribution::tests::source_waits_for_receiver_file_verification` hit a
  host-local loopback probe (`BrokenPipe`, unrelated to this diff).


Design-Signed-Off-By: Antigravity (Gemini); design-review=2e5b

Signed-off-by: Luke Alonso <lalonso@gmail.com>
Why:
Exported serving graphs that capture overlapped work on higher-priority CUDA
streams such as `ScratchArena.auxiliary_stream` record per-kernel
`CU_LAUNCH_ATTRIBUTE_PRIORITY` attributes, but CUDA ignores kernel-node
priorities during replay unless the graph executable is instantiated with
`CU_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY` (`8`). Recording
`USE_NODE_PRIORITY` alongside permitted flags already present on the captured
executable (`CUDA_GRAPH_INSTANTIATE_FLAG_AUTO_FREE_ON_LAUNCH`, `1` -> `9`)
enables Helios to honor captured stream priorities during
`cuGraphInstantiateWithFlags`. Requesting explicit instantiation flags also
requires a retained CUDA graph template (`keep_graph=True` without
post-instantiation release metadata) so export rejects missing or released
templates before handing a zero template handle to Heliopause.

What:
- `ignition/preparation/runtime_core.py`:
  - Before: `record_export_graph` retained owners and instantiated the graph
    without serializing `USE_NODE_PRIORITY`, so exported serving graphs kept
    only executable-derived flags (`1`).
  - After: `record_export_graph` defaults `instantiation_flags` to
    `CUDA_GRAPH_INSTANTIATE_FLAG_USE_NODE_PRIORITY` (`8`). When
    `instantiation_flags` is not `None`, it validates the bitmask against
    `PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS` (`9`, bits `1` and `8`), rejects
    graphs carrying `_flare_graph_metadata` or a released/zero
    `raw_cuda_graph()` handle, and verifies pool ownership before calling
    `retain_object` or `instantiate_graph`. After instantiation, it clears any
    pre-existing `_flare_instantiation_flags` attribute, queries
    `cuGraphExecGetFlags` through a lazily cached `_Cuda` driver wrapper,
    rejects unsupported executable flags, and records
    `prior_flags | instantiation_flags`. Passing `instantiation_flags=None`
    clears any prior `_flare_instantiation_flags` override so export falls back
    to executable-derived or recorded graph metadata. `_graphs` reuses
    `PERMITTED_CUDA_GRAPH_INSTANTIATE_FLAGS` and rejects zero
    `raw_cuda_graph()` handles when `_flare_instantiation_flags` is set.
- `helios/src/runtime_core/` (`format.rs`, `mod.rs`, `node_priority_tests.rs`),
  `helios/tests/node_priority_core_fixture.py`, and `tests/preparation/`
  (`test_capture_graph_metadata.py`, `test_recorded_export_graph_cuda.py`,
  `test_runtime_core.py`):
  - Helios runtime loading already validates `flags & !9 == 0` and passes
    serialized flags to `cuGraphInstantiateWithFlags`. Add Rust validation
    coverage, Python CPU unit tests for template-retention guards,
    pre-mutation rejection, stale-flag clearing, `_Cuda` caching, and
    zero-template rejection, plus a signed-core CUDA fixture and Helios
    `NativeResources::load` + `ReplayWorker` test verifying via CUPTI that
    `cuGraphInstantiateWithFlags` receives `9` on the serving graph and `1` on
    the startup tuning graph with bit-exact main- and auxiliary-stream replay.
- Compatibility: Existing signed cores keep their recorded graph flags (`1`)
  and load and serve without re-export or re-signing. Startup tuning graphs
  continue to call `capture_graph` and `instantiate_graph` directly
  (`flags = 1`).

Result:
Newly exported serving graphs instantiate with `USE_NODE_PRIORITY` (`8`,
combined with `AUTO_FREE_ON_LAUNCH` -> `9`) while startup tuning graphs keep
`flags = 1` and existing signed cores remain compatible. In paired ABAB
multi-GPU `flare run` serving qualification by `@voipmonitor` (review
`PRR_kwDOVRNQZM8AAAABa9GF4Q`) on `4x NVIDIA RTX PRO 6000 Blackwell` (SM120)
with `DeepSeek-V4.1-Flash` TP4 (`flags = 1` vs `flags = 9` across `135/135`
graphs, `91/135` containing `43,290` `priority = -5` auxiliary-stream kernels),
`flags = 9` produced zero errors, hangs, or CUDA faults, identical VRAM
(`79.47 GiB` weights/rank, `59.8 GiB` KV), 4/4 greedy, 16/16 vision, and 16/16
cold NIAH (`8K-128K`) passes, flat cold prefill (`-0.30%` to `+0.23%`), and
decode GPU step latency reductions of `-1.24%` to `-1.68%` at `C=1`, `C=4`, and
`C=32` (with wide `W=8` speculative buckets `B4xW8`, `B8xW8`, and `B16xW8`
improving `-2.47%` to `-5.38%`, and `C=8`/`C=16` overall means at
`+0.44%`/`-0.17%`). That multi-GPU A/B used the equivalent `flags = 9` core
manifest generated by commit `7fc5993b`; recipes other than
`DeepSeek-V4.1-Flash` and architectures other than SM120 were outside that
serving A/B scope.

Evidence:
- Verified on a clean `git archive` extraction with freshly built
  `flare_heliopause` on WSL2 Linux with `1x NVIDIA GeForce RTX 5090` (SM120):
  - `ruff==0.12.8 check` on the 5 touched Python files: passed.
  - `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core::`: 186 passed, 0 failed, 11 ignored.
  - `pytest -v -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py tests/preparation/test_capture_graph_metadata.py tests/preparation/test_runtime_core.py`: 57 passed, 14 skipped (CUDA-gated tests in `test_runtime_core.py`), 0 failed.
  - `FLARE_RUN_CUDA_TESTS=1 CUDA_VISIBLE_DEVICES=0 pytest -v -rs tests/preparation/test_recorded_export_graph_cuda.py`: 2 passed, 0 skipped, 0 failed (verifying `flags_by_name == {"decode": 9, "tune": 1}`, negative auxiliary-stream kernel priority, CUPTI-observed `cuGraphInstantiateWithFlags` flags `9` on `"decode"` and `1` on `"tune"`, retained `cuGraphExecGetFlags == 1`, and bit-exact `ReplayWorker` main- and auxiliary-stream outputs).
- Multi-GPU serving A/B evidence: `@voipmonitor` review `PRR_kwDOVRNQZM8AAAABa9GF4Q`
  on `4x NVIDIA RTX PRO 6000 Blackwell` (SM120) TP4 `DeepSeek-V4.1-Flash`
  (`flags = 1` vs `flags = 9`, paired ABAB, `135/135` graphs).
- Limitations: Single-GPU SM120 runtime-core export, CUPTI instantiation-flag
  verification, and `ReplayWorker` replay ran directly on this commit; multi-GPU
  `flare run` serving A/B was performed by `@voipmonitor` on `DeepSeek-V4.1-Flash`
  TP4 (SM120) on the equivalent `flags = 9` manifest at `7fc5993b`, leaving
  other recipes and SM103/SM121 serving A/B outside the measured scope.

Discord: Dooner

Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
@FujitsuPolycom
FujitsuPolycom force-pushed the perf/ignition-export-use-node-priority branch from 7fc5993 to 4270e90 Compare November 29, 2026 17:50
@FujitsuPolycom

Copy link
Copy Markdown
Owner Author

Merged upstream in NVIDIA#581.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.