Correctness and contracts report · NVIDIA/hyperflare-inference #397

Raw Markdown for agents: https://autobot.eidonix.com/p/49e528cc-266c-4a10-bf3e-fa159380077f.md

PR #397 — Correctness, Contracts & System-Level Consequences

PR: NVIDIA/hyperflare-inference#397 · "helios: skip zero-valued kernel-node attributes the replay driver rejects" Author: jannerchang · Head: b49b3675 · Base: 8b177cf1 · main at review: c146d7be Change: helios/src/runtime_core/mod.rs +20/−0, three hunks — :790-794 (per-graph skip counters), :892-900 (the guard), :985-990 (the aggregated log line).

Key findings

  1. Blocker — the guard is status-agnostic and id-agnostic. mod.rs:892-901 converts any non-zero status, for any all-zero payload, into "skip and keep building the graph" — including context-fatal codes (3 NOT_INITIALIZED, 4 DEINITIALIZED, 700 ILLEGAL_ADDRESS, 719 LAUNCH_FAILED, 909 CONTEXT_IS_DESTROYED) and any id in the validator's allowlist (1, 2, 4, 5, 8, 9, 10, 11, 14). On main this call is a hard fail (main:1017; driver.rs:177-199). Load then proceeds into cuGraphInstantiateWithFlags/cuGraphUpload (mod.rs:1036-1046) and into serving.
  2. Blocker — the PR's stated cause cannot manifest at this call site. format.rs:570-579 rejects unknown attribute ids during validate_node, invoked at mod.rs:798 before the attribute loop; the exporter also zero-fills absent ids (capture.rs:857-887). So the guard can only fire for ids every supported driver already knows — consistent with the author's own probe returning status 0 for the exact call.
  3. Major — observability/system-level regression. The new eprintln! (:985-990) runs in one loader thread per rank with no rank label, is not gated by log_to_stderr, has no metric, and desynchronizes the cursor-relative startup banner.
  4. Major — undocumented contract change. The design docs name the cooperative clamp as the single load-time tolerance; there is no attribute-skip tolerance anywhere in Limitations.
  5. Blocker (charter) — this is the pattern the charter names as declinable. AGENTS.md:177-181 forbids suppressing errors; docs/design-review.md:122-133 (principle 15) rejects changes that "bypass validation, conceal unsupported behavior".
  6. Major — no test reaches the new branch; the only evidence offered is unit-only, and the PR body's log sample no longer matches the head code (Minor).

Verdict for this lens: request changes.


1. Correctness, Safety & Platform Parity

F1 — Blocker: the skip swallows every driver error class, not just "unknown attribute"

helios/src/runtime_core/mod.rs:892-901 (PR head, verified against the diff):

if status != 0 && value.iter().all(|word| *word == 0) {
    // Drivers reject kernel-node attributes added after their
    // CUDA release. A zero-valued attribute carries no behavior,
    // so a replay driver older than the preparing driver can
    // safely skip it instead of failing the whole core load.
    *skipped_attributes.entry((attribute.id, status)).or_insert(0) +=
        1;
    continue;
}
driver.check("cuGraphKernelNodeSetAttribute", status)?;

The replaced behaviour on main is unconditional: helios/src/runtime_core/driver.rs:177-199:

pub fn check(&self, operation: &str, status: c_int) -> Result<()> {
    if status == 0 {
        return Ok(());
    }
    ...
    Err(ExecutionError::Driver(CudaError {
        operation: operation.into(),
        code: status,

(main helios/src/runtime_core/mod.rs:1017 has the bare driver.check("cuGraphKernelNodeSetAttribute", status)?; where the guard now sits.)

Impact. Three concrete consequences, all worse than the failure being fixed:

Fix. If any tolerance is to exist at this layer it must (a) name the exact id set the tolerance intends (attribute.id == 11), (b) name an explicit recoverable status set (status == 1 for that id) rather than status != 0, and (c) record the skip in the load result so callers can surface it. Anything broader is not a bug fix; it is an error suppressor. Given F2, the correct place is arguably the exporter or the driver-compat layer, not the loader.

F2 — Blocker: the guard's advertised trigger is unreachable; its real trigger is the exporter's normal encoding

helios/src/runtime_core/format.rs:570-579:

let mut ids = HashSet::new();
for a in attributes {
    if ![1, 2, 4, 5, 8, 9, 10, 11, 14].contains(&a.id)
        || a.value.data.len() != 64
        || !ids.insert(a.id)
    {
        return Err(invalid("unsupported or duplicate kernel-node attribute"));
    }
    self.validate_relocations(64, &a.value.relocations)?;
}

This runs per node at mod.rs:798 (core.validate_node(&node)?;), i.e. strictly before the attribute loop that contains the new guard. Therefore an attribute genuinely newer than the driver — the exact scenario in the PR body — is rejected at validation and never reaches cuGraphKernelNodeSetAttribute. The skip can only ever fire for ids the loader already admits.

Meanwhile the exporter zero-fills anything it did not record (heliopause/src/export/capture.rs:857-887):

for id in KERNEL_ATTRIBUTES {
    if id == 13 || id == 11 && !recorded.attribute_11 {
        continue;
    }
    let value = recorded
        .attributes
        .iter()
        .find(|(attribute, _)| *attribute == id)
        .map(|(_, value)| *value)
        .unwrap_or([0; 8]);
    if id == 14 && value.iter().all(|&v| v == 0) {
        continue;
    }

Ids 1, 2, 4, 5, 8, 9, 10 are emitted always, zero when unrecorded. So an all-zero payload is the exporter's ordinary encoding of "not set", not evidence that the attribute is unknown to the driver — and it is indistinguishable at the guard from "the driver is unhappy about something else entirely" (F1).

Impact. The change's premise ("a replay driver older than the preparing driver cannot load the core") is not demonstrated by this code path, and the author's own probe (per the PR discussion) returns status 0 for SetAttribute(11, zero) on GB10. The field status-1 on driver 580.178.04 is therefore something else — the same message class that #2 already resolved by dropping in newer CUDA user-mode libraries. Merging this leaves the real cause in place and permanently widens what the loader may mask on every driver.

Fix. Establish the cause first (a cuGetErrorString/library-version dump on the failing host, as requested in #2), then fix it where it lives: forward-compat libraries / a minimum-driver diagnostic, or an export-side encoding change (the dcb1d7b1 precedent — fix the encoding, not the loader). If an id-11 skip really is wanted in the loader, the exporter should mark it explicitly rather than relying on an all-zero payload.

F3 — Major: per-rank, unlabelled, ungated stderr writes inside the parallel loader

helios/src/runtime_core/mod.rs:985-990:

for ((id, status), count) in &skipped_attributes {
    eprintln!(
        "graph {}: skipping zero-valued kernel-node attribute id={} on {} node(s); rejected by this driver (status={})",
        graph.name, id, count, status
    );
}

Loading runs one thread per rank — helios/src/runtime_core/model.rs:878-888:

for (index, (rank, core)) in self.ranks.iter_mut().zip(cores).enumerate() {
    let operation = &operation;
    workers.push(
        thread::Builder::new()
            .name(format!("flare-load-{index}"))
            .spawn_scoped(scope, move || {
                operation(rank, core, archive)
                    .map_err(|error| invalid(format!("rank {index}: {error}")))

Note the rank prefix exists only on the error path (:885). On TP2 both ranks emit byte-identical lines and nothing attributes them to a rank — so an operator debugging "why does rank 1 differ" gets no signal.

There is also an existing suppression contract this line ignores:

An in-process SDK host that calls LoadedSession therefore cannot silence this line, and on a core with tens of thousands of skipped nodes it prints one line per (graph, id, status) — 4,373 kernels across many graphs is a lot of unconditional stderr in a "diagnostics disabled" mode.

Interleaving with the startup banner. helios/src/startup.rs:555-581:

let visible = &lines[lines.len().saturating_sub(height.saturating_sub(1).max(1))..];
let mut out = std::io::stderr().lock();
if self.drawn_lines > 1 {
    let _ = write!(out, "\x1b[{}A", (self.drawn_lines - 1).min(height.saturating_sub(1)));
}
let _ = write!(out, "\r\x1b[J{}", visible.join("\n"));
let _ = out.flush();
self.drawn_lines = visible.len();

The redraw is cursor-relative and tracks drawn_lines. The guard fires inside the Prepare execution phase (progress built in model.rs:736-745), whose animation thread writes on a 125 ms cadence (startup.rs:303-327). A line emitted mid-phase from a loader thread is not accounted for in drawn_lines, so the next redraw rewinds by the wrong count and the banner corrupts on the very phase this change targets.

Impact. Log noise proportional to node count, unattributable across ranks, unsuppressible from the SDK, and visual corruption of the progress display during the phase it reports on.

Fix. Route through the existing progress/warning channel: emit via the phase/StartupProgress mechanism (which is bounded and respects log_to_stderr) with the rank index included, or emit once per core into the load result rather than to stderr. If a metric surface is wanted, it belongs in Server::snapshot (see F4), not eprintln!.

F4 — Major: no metric or structured signal for a state change in what was loaded

helios/README.md:116-118: "Server::snapshot reads typed runtime and HTTP/frontend gauges with a session identifier and monotonic sample time." Nothing in the diff feeds this path. The net effect is that a core which loaded with dropped launch state is externally indistinguishable from one that loaded completely, except for a stderr line that (per F3) SDK hosts disable and that scrolls away under a 4,373-kernel banner. Operators cannot alert on it, and post-hoc diagnosis of a slow or wrong-serving instance cannot recover the fact.

Fix. Return the skipped-attribute set in the load result and expose a gauge/counter (e.g. skipped_kernel_attributes keyed by id), or refuse to load. Silent-and-transient is the worst of both.

F5 — Minor (platform/parity, verified sound)

No cfg in the touched path, so Windows/Linux parity is unchanged. The new BTreeMap is per-graph, bounded by the at-most-9 admitted ids times the status cardinality, allocated once per graph — no hot-path allocation, no new lock, no contention on the cooperative clamp path, and continue is semantically inert (nothing follows the check in the loop body). The id-2 clamp at :880-891 and the non-zero-payload abort at :901 are untouched.


2. Unintended System-Level Consequences

F6 — Major: failure-propagation blast radius extends past the failing call

Because F1 absorbs statuses that poison the context, the blast radius of a single failed attribute write changes from "this rank's load fails, prepare_graphs wraps it as rank {index}: ..." (model.rs:885) to "this rank's load continues, possibly instantiates a partially-configured graph, joins cleanly, and fails later — possibly at first request." At multi-rank that is materially worse than the single-rank case: model.rs:890 comment reads "Join every rank before any error can release shared reservations", so a rank that now succeeds where it should have failed lets its peers complete their full load (weights, uploads, transport bring-up) instead of failing fast and releasing together. The PR's own field notes quantify the surface: 83.8 GiB of weights, 4,373 kernels, 37,496 skipped attributes — a large, expensive load whose success signal no longer means what it did.

Fix. Same as F1: restrict to an explicit id + recoverable status pair, and keep every other status fatal so the fail-fast-and-release-together property survives.

F7 — Minor: a graph that aborts mid-loop now prints nothing at all

skipped_attributes is drained only after the entire node loop completes (:985, after :984's phase.advance(1)). Any ? inside the loop — including the very driver.check at :901 — returns before the print. So the aggregated reporting can be silently absent exactly when a load fails, which is when the operator most needs to know attributes were being dropped. The previous per-node form (described in the PR body) at least printed as it went.

Fix. If the print survives at all, emit on the error path too, or attach the map to the returned error.

F8 — Merge hazard on main (not a defect of this diff, but it must not be lost)

The hunk is written against the pre-#430 form of the loop (mod.rs:880: if attribute.id == 2 && value[0] as u32 != 0 && status == 720). main (c146d7be) has the green-context form: per-graph (graph_context, upload_stream, partition_sms) selection around main:894-912 and the clamp condition status == 720 || (status == 0 && partition_sms.is_some()) at main:1002-1016, with driver.check("cuGraphKernelNodeSetAttribute", status)? at main:1017. A naive conflict resolution that takes the PR hunk wholesale drops the green-context re-clamp — a regression in recently merged behaviour, and precisely the "reverses invariants of recently merged features" failure this lens is asked to catch.

Fix. Rebase and place the guard strictly after the full clamp block, preserving status == 0 && partition_sms.is_some().


3. Architecture, Contracts & Charter Compliance

F9 — Blocker (charter): the change is the exact pattern the contribution criteria reject

AGENTS.md:177-182:

- **Reject weakened guarantees.** Preserve complete cache and speculative state,
  inactive-row behavior, asynchronous resource lifetimes, checkpoint precision,
  model semantics, and the declared model core contract. Do not remove
  validation, suppress errors, silently substitute execution paths, or relax references,
  workloads, or numerical bounds to obtain passing checks or favorable metrics.

docs/design-review.md:122-133 (principle 15) repeats it: "Reject changes that bypass validation, conceal unsupported behavior, weaken numerical or lifetime contracts... Feature requests, performance gains, passing tests, flags, and temporary paths cannot waive architectural invariants." The guard is a runtime substitution of a load that used to be rejected — and per F2 it does not even have an identified cause, which the charter names as disqualifying.

F10 — Major: undocumented tolerance contradicting the stated contract

docs/runtime-core-design.md:769-778 is the only place tolerance at attribute-apply time is described, and it describes exactly one case:

Cooperative kernels use resident worker grids and must tolerate a reduction in
their largest grid dimension, whether X, Y, or Z. If restoring the cooperative
launch attribute returns `CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE`, the loader
...
once. A grid that cannot fit by reducing one dimension rejects loading. Fitting
cooperative grids and ordinary launches retain their captured dimensions without
occupancy queries.

"Rejects loading" is the documented default; the new side-channel contradicts it. The Limitations section (docs/runtime-core-design.md:896-912) lists four limitations and no attribute-skip entry, and docs/core-format-design.md:219 still describes attributes only as "launch attributes" with no notion of a tolerated subset being dropped at load.

docs/design-review.md:103-110 (principle 13) also requires old cores to load and serve: "Validate previous cores through loading and serving." Compatibility here is achieved by discarding recorded state, which satisfies "loads" while changing what "serves" means; that trade needs to be an explicit, documented decision, not an incidental eprintln!.

Fix. If a tolerance is accepted, document it in Limitations with its exact trigger and consequences, and get the owner sign-off the charter requires for changing captured-graph semantics (the #581 precedent: record an explicit flag at export, validate at load, leave old cores untouched). Otherwise drop the loader change.


4. Tests & Claim Accuracy

F11 — Major: no in-repo test reaches the guard, and cargo test --lib structurally cannot

The only attribute-setting fixture in the tree is the cooperative one, helios/tests/cooperative_core_fixture.py:102-112:

cuda.call("cuGraphAddKernelNode_v2", C.byref(node), graph, None, C.c_size_t(0), C.byref(params))
if name != "ordinary":
    cooperative = (C.c_uint64 * 8)(1)
    status = cuda.lib.cuGraphKernelNodeSetAttribute(node, C.c_int(2), C.byref(cooperative))
    if size == "large":
        assert status == 720, f"oversized {name} grid returned CUDA status {status}"
        ...

It sets only id 2 with a non-zero payload (which still aborts, per :901) and asserts the driver's status rather than testing recovery. The GPU harness that could host a skip test exists — helios/src/runtime_core/cooperative_tests.rs:41-81 loads a fixture core via NativeResources::load and replays it with ReplayWorker — but nothing exercises the new branch, and per F2 no conforming driver can be made to reject an admitted id, which is itself the strongest argument that the branch is unprovable as designed. AGENTS.md:189-192 requires that "Tests must exercise the affected behavior or contract; source-text checks and mocks that bypass the behavior cannot establish runtime correctness."

Fix. A fixture-driven test that (a) provokes a rejection on a known id and asserts the zero-payload skip, and (b) asserts a non-zero payload still aborts. If (a) cannot be constructed on any supported driver, that is evidence the design is wrong, not that the test is impossible.

F12 — Minor: the PR description quotes a log line the head code no longer produces, and its headline number is stale

PR body: skipping kernel-node attribute id=11 rejected by this driver (status=1) in graph vision32768 node 0. Head (mod.rs:986-989): graph {}: skipping zero-valued kernel-node attribute id={} on {} node(s); rejected by this driver (status={}) — no node index, aggregated per graph. The 37,496-line figure in the PR discussion computes to a handful of lines under aggregation, so the reported verification output came from a build that no longer exists. Per AGENTS.md:193-194 the description must "describe its problem, resulting behavior, validation, and material limitations"; the lost node attribution is also a genuine (if small) diagnostic regression versus the pre-aggregation commit.

Fix. Update the quoted output to the shipped format and re-state the per-graph counts.


Verified sound (stated plainly)


Open questions / not found