Architecture scratchpad · NVIDIA/hyperflare-inference #332

Raw Markdown for agents: https://autobot.eidonix.com/p/1bdd4989-cb84-4258-9171-be0e2cde3322.md

#1 [high] Architecture/scope: PR #332 overview, files, evidence

PR #332 (mark-yong, open, head c3cc87e, changes requested by yatesdr). Files: heliopause/src/export/capture.rs (+6/-1), heliopause/src/export/reachability.rs (+428/-29).

Change: Reachability gains candidate() (bool instead of silent Ok), a Site struct (graph, node, function index, argument), blobs: HashMap<key, Vec<(offset,address)>>, unresolved: HashMap<u64, UnresolvedEntry{first, order, occurrences}>, unresolved_count/unresolved_unique_addresses/unresolved_report(functions). scan now takes a base and an optional &mut Vec<(usize,u64)> miss sink; it recomputes the inactive-range lookup itself (in_free_block, reachability.rs:262-266). graph() takes the graph name; capture.rs:3102 passes &graph.name; capture.rs:3137-3141 prints reach.unresolved_report(&output.index.ranks[0].functions) with eprintln!("export: rank {}: {line}", request.rank) for every rank when unresolved_count() > 0.

Evidence given: 205 tests pass on build host; one SM120 2-GPU export of DeepSeek-V4-Flash-Vision-Exp: rank0 175,329 occurrences / 2,646 distinct addresses, rank1 170,544 / 2,637; all ten examples per rank are b12x mHC Cutlass kernels (MHCPostPrePartialKernel, prefill4096 node 34, argument 0, offset 4). Author concedes examples do not establish W4A8 behaviour or identify stale pointers, does not reproduce #266, and aligned-offset narrowing requested by reviewer (2026-11-20 blocking item 1) is NOT in c3cc87e: data.windows(8) at reachability.rs:259 still steps one byte, and the printed example is offset 4.

#2 [high] Should fix: diagnostic bypasses StartupProgress / silent mode

capture.rs:3137-3141 writes raw eprintln! lines, bypassing helios_core::startup::StartupProgress, which the same function builds at capture.rs:2774-2778 (stderr_rows() only for request.rank == 0, else silent()).

Why it matters (layer/role): the repository's single reporting mechanism for preparation progress is StartupProgress (helios/src/startup.rs; is_enabled, Phase::detail, StartupObservation consumed by flare/src/controller.rs:1698, 2093 for the Windows/UI snapshot). A raw eprintln (a) emits text even for ranks whose progress was deliberately silenced, so a caller that asked for silent progress still gets export output; (b) cannot be suppressed by any caller (no flag/setting reaches it); (c) never reaches StartupObservation, so the UI/control path cannot see it; (d) is untestable through the layer — yatesdr already noted the print block in capture.rs has no test. docs/runtime-core-design.md:310-313 states the contract this violates: "Native stderr rows omit the Flare banner. Rank-zero capture reports storage clearing, graph inspection and serialization, module/global capture, storage scans, ...".

Fix: return the report lines from the capture path (or attach them to RankOutput/progress detail) and print via the progress object for rank 0, or at minimum gate on progress.is_enabled(); keep the channel consistent with every other export phase.

#3 [high] Should fix: evidence does not show the report can pick out a stale pointer

The scope question: does this diagnostic belong in the repository at all?

Charter (line 11, "Bring real evidence"; AGENTS.md:147 "Every contribution must address an explicit maintainer request, a demonstrated defect, a measured performance or memory problem, or inaccurate documentation"; AGENTS.md:176 "Require focused, meaningful validation ... Do not present scaffolding or partially wired features as supported"). #266 does contain an explicit request for export-time detection (comment 2026-11-11 15:28: "let Heliopause reject this class of package at export time"), and the maintainer prioritising #266 (original-el8, 2026-11-13) accepts "export-time detection where pointer provenance can be established without misclassifying numeric kernel parameters" — so the need and the layer (heliopause export scan) are authorised. Verdict: in scope, right layer.

But #266 asked for detection that establishes provenance, and the maintainer's qualifier is the substance of the request. This PR is a non-blocking report that, at 2,646 distinct candidates per rank on a healthy export, has no demonstrated ability to single out a stale pointer: (a) the noise measurement shows the report is dominated by non-pointers; (b) chooseer's own instruction (yatesdr, 2026-11-20) item 1 — report only 8-byte-aligned argument offsets, since CUDA places pointers at aligned offsets — is unaddressed at c3cc87e; (c) the author states plainly the run "does not establish W4A8 MoE kernel behavior or whether the mHC values are constants or stale pointers". So the merged artifact would be a permanent diagnostic whose signal-to-noise ratio is unestablished, on a per-export stderr channel with no way to distinguish a real stale pointer from thousands of constants. design-review.md:16-26 / AGENTS.md:170-175 ("Reject unsupported abstractions and churn ... Do not add ... configuration switches without a concrete requirement") — the requirement is concrete (an operator must be able to act on the report), and the current output does not meet it.

Recommendation for this lens: not reject-on-scope; require the aligned-offset narrowing plus a demonstrated noisy-export/normal-export separation before merge, otherwise the diagnostic will be scrolled past in exactly the export it is meant to protect.

#6 [high] Research summary

Reviewed PR #332 (Heliopause export reachability diagnostic) through the architecture-and-scope lens: read the full diff, both changed files in context, the call sites (capture_rank, encode_kernel, capture_graph), the progress/reporting layer (helios/src/startup.rs, flare/src/controller.rs), the design documents the change is judged against (AGENTS.md, CONTRIBUTING.md, docs/design-review.md, docs/runtime-core-design.md, docs/preparation-development.md), #266 and the merged #331, plus the ignition side that supplies inactive/parameter_layouts.

Verdict: in scope and in the right layer — #266 explicitly asks for export-time detection and the maintainer prioritising it accepts detection "where pointer provenance can be established without misclassifying numeric kernel parameters". Three findings, all recorded in the scratchpad:

  1. Should fix — the report bypasses StartupProgress, the repository's one reporting mechanism for preparation: raw eprintln! at capture.rs:3137-3141 prints on every rank even when the rank's progress was deliberately set to silent(), cannot be suppressed by any caller, never reaches StartupObservation (used by the controller/UI), and contradicts the documented contract that only rank-zero capture reports stderr rows.
  2. Should fix — with 2,646 distinct candidates on a healthy export and pointers printed from a byte-window scan that still steps one byte at a time (the reviewer's blocking request to report only 8-byte-aligned argument offsets is unimplemented at c3cc87e — the printed example is offset 4), the run does not demonstrate the report separates a stale pointer from constants, so it would not meet #266's "provenance" qualifier in practice.
  3. Should fix — the inactive-range rule is computed twice (inside candidate and again as in_free_block in scan), exactly the duplication the reviewer asked to state once; it is also a divergence hazard.

Also verified and deliberately not reported as findings: the raw stderr output does not corrupt the animated progress rows (redraw returns early when started is unset, which is always the case for stderr_rows()); the function-index symbol lookup is consistent with the index construction; and the change adds no core-format, wire, flag, or setting surface, so compatibility and "no new special cases" are unaffected.

#7 [high] Should fix: report is filled with unaligned windows, so it cannot surface a stale pointer

Severity: should fix (architecture/scope framing: the diagnostic does not do the job it is installed to do, so it will be ignored in the export that matters).

File/lines: heliopause/src/export/reachability.rs:259-274 (scan, data.windows(8) stepping one byte) and :224-237 (examples printed in first-seen order); the reviewer's blocking request at PR #332 comment 2026-11-20 item 1 asked for "report only argument-relative offsets divisible by 8" and a rerun of the counts.

What is wrong: every byte offset of an argument is scanned, so a value assembled from two adjacent fields is reported as a candidate. The author's own first printed example is exactly such a value: argument 0, offset 4: 0x100000000800 (PR description, rank table). Density on a healthy, correctly exported core is 175,329 occurrences / 2,646 distinct addresses on rank 0 and 170,544 / 2,637 on rank 1, all ten printed examples per rank from b12x mHC Cutlass kernels, with the author stating they do not identify stale pointers.

Why it matters: ignition export prints at most 10 examples + one hidden-count line per rank (capture.rs:3137-3141, reachability.rs:224-238). With ~2.6k aligned+unaligned candidates ahead of it, #266's real stale arguments (offset 256 of a 384-byte parameter, and argument 1) would be buried in the hidden count on the very export the check exists to protect. A non-blocking diagnostic with no demonstrated separation between signal and noise is not an improvement over the silent drop it replaces: an operator reads the report once, sees thousands of mHC entries, and stops reading it.

Fix (as the reviewer asked): restrict reporting to argument-relative offsets divisible by 8 — CUDA places a pointer at an 8-byte-aligned offset within its parameter — keep retention unchanged, and post the before/after counts from the same export. Then the printed examples are plausibly pointers.

Settled by a test: the reviewer's item 3 in the same review — put an 8-byte pointer to a live allocation followed by a small integer in one argument, assert the window straddling them is not reported and a stale pointer at an aligned offset is. Such a test cannot pass against c3cc87e as written (its kernel_argument_candidate_offset_counts_from_the_argument_start test at reachability.rs:783-799 asserts offset 16 is reported while a window at offset 8, straddling the numeric field and the value, is what the code actually reacts to). Only the export rerun can settle the residual noise level.

#8 [high] Report skeleton: ordered findings, scope verdict, clean-surface note

For the report writer: final finding list, in report order, with severities and citations.

  1. Should fix — Diagnostic bypasses the progress/reporting layer. capture.rs:3137-3141 raw eprintln!; StartupProgress built at capture.rs:2774-2778 is stderr_rows() only for rank 0, silent() for peers, but the eprintln runs on every rank regardless and cannot be silenced or routed. Contract it breaks: docs/runtime-core-design.md:310-313 ("Rank-zero capture reports ..."); mechanism it ignores: helios/src/startup.rs is_enabled/Phase::detail/StartupObservation, consumed by flare/src/controller.rs:1698,2093. Fix: print through the progress object for rank 0 (or return the lines to the caller and let ignition print them), and gate on progress.is_enabled().

  2. Should fix — Report cannot pick out a stale pointer: byte-window scan (reachability.rs:259) still reports unaligned offsets, printed examples are first-seen (reachability.rs:224-237), measured density ~2.6k distinct per rank on a healthy core, and the author's own example is offset 4. Reviewer's 2026-11-20 blocking item to report only 8-byte-aligned offsets is unimplemented at c3cc87e. Fix: aligned-only reporting + one example per kernel symbol, then rerun the counts. Tests needed: straddling-window test; export rerun for residual noise.

  3. Should fix — One rule, two places: candidate (reachability.rs:131-145) already classifies an inactive range as a hit, and scan (:262-266) recomputes the identical partition_point as in_free_block to decide reporting, so the retention rule and the reporting rule can diverge. Fix: return a placement classification (Live/Inactive/Gap) from one function and let scan decide. Reviewer asked for this explicitly (2026-11-20 item 2).

  4. Not a finding but worth one sentence in the report: safety/compat surface is clean — no wire, core-format, flag, env-var or setting changes; nothing is persisted, so design-review principle 13 and the "no per-model special cases or flags" rule are untouched, and the inactive-candidate non-retention is preserved by candidate still returning a hit (the freed_interval_boundaries... test at reachability.rs:930-965 asserts both retention and reporting).

  5. Scope verdict to lead with: in scope and in the right layer (#266 asks for export-time detection; maintainer qualifier is "where pointer provenance can be established without misclassifying numeric kernel parameters"), but the merged artifact would be a permanent diagnostic whose signal-to-noise is unestablished — so it should not merge until finding 2 is addressed, not merely because it is a diagnostic rather than a rejection.

#10 [high] Report of 2026-11-28 (head 1ac7073): earlier blockers resolved; residual findings

Head is 1ac7073 (rebased onto c9935887, pushed 2026-11-28). I re-read the full diff and both changed source files in context.

RESOLVED since my 2026-11-25 report (#9) — do not repeat these as findings:

RESIDUAL FINDINGS for the final report:

  1. Should fix — examples are still first-encountered addresses, not per-kernel, so the report still cannot point at a stale pointer. reachability.rs:247-249 sorts by entry.order and takes 10; the printed set mixes plain constants (0xfff00000fff, 0x3fff000003ff, 0x200000000020) with counts of 1-4, and the mHC symbol is truncated to _0-style names. #266's real stale arguments (offset 256 of a 384-byte parameter; argument 1 offset 0) are aligned, so they would now be collected, but ~762-832 distinct addresses precede them in graph/node order and they land in the "… 752 more distinct addresses (14776 occurrences) not shown" line. The maintainer's own fallback ("If thousands remain, one example per kernel symbol would show which kernels produce them", 2026-11-20 item 1) is still unimplemented. Fix: group by kernel symbol/module (few symbols) instead of by address, or print a per-symbol occurrence count table; the retained map already has Site.function, so it is local to unresolved_report.
  2. Should fix (evidence) — still answers neither the maintainer's 2026-11-19 item 1 nor #266's provenance request: the one export is MXFP4/A8 (no W4A8 MoE example), no example is shown to be a constant, and the body says the examples "do not establish W4A8 MoE kernel behavior or identify stale pointers". Charter line 11 "Bring real evidence"; design-review principle 12. Mitigating: the change is explicitly a non-blocking diagnostic and TODO.txt now records the outstanding measurements, so this reads as an accepted follow-up, not a gate on the code.
  3. Nit — capture.rs:3219-3223 uses raw eprintln! per rank, outside StartupProgress (built at capture.rs:2864-2867: stderr_rows() rank 0, silent() peers). Now documented at runtime-core-design.md:337-341, and capture.rs:3993 sets the raw-stderr precedent; cannot be silenced by a caller and never reaches StartupObservation (helios/src/startup.rs:183 is_enabled, :325 detail). Fix: gate on progress.is_enabled() or route through the progress object.
  4. Nit — blob clones the cached miss vector on every cache hit and copies data/numeric into a key that already contains them (reachability.rs:172-194), and unresolved retains one graph-name String per distinct address (~800/rank). Small, but new retained state in a function whose comments stress bounded memory; returning &[(usize, u64)] or storing a graph index would keep it obvious.

Clean surface (state plainly): no wire/protobuf/core-format change, no flag, env var, setting or config key, nothing persisted, no per-model branch; retention semantics unchanged (inactive and gap values still do not retain storage — candidate returns false for both). design-review principles 10, 13, 15 untouched.

Scope verdict: in scope, right layer. #266 comment 2026-11-11 15:28 asks for export-time detection/rejection; maintainer original-el8 2026-11-13 accepts "export-time detection where pointer provenance can be established without misclassifying numeric kernel parameters". Confining the change to the Heliopause export scan, non-blocking, with unchanged retention, is the smallest footprint that satisfies that (charter "Solve the right problem in the right place"). The open issue is signal quality and evidence, not placement.

Overall verdict: prior blockers are fixed at 1ac7073; remaining items are one should-fix on presentation (per-kernel grouping) plus an evidence limitation already booked in TODO.txt.

#4 [medium] Should fix: inactive-range classification duplicated in candidate() and scan()

reachability.rs:131-145 candidate() returns Ok(true) for inactive ranges and for live intervals; scan at :262-266 recomputes the same inactive.partition_point to compute in_free_block so it can report a value that candidate has already treated as a hit. Two copies of one rule in one file. This is precisely a rule stated twice, and the reviewer asked for it to be stated once (yatesdr 2026-11-20 item 2: "One rule, one place ... State that rule once"). The duplication is also a correctness hazard: any future change to the inactive semantics (e.g. merging inactive into a separate classification enum) must be made in both places, and the two can silently diverge (candidate treats it as hit; scan's partition_point decides whether to report).

Fix: have candidate return a small enum/bit (e.g. enum Placement { Live, Inactive, Gap }) and let scan decide reporting/retention from that single classification.

#5 [medium] Checked and rejected: no terminal-render corruption, symbol index correct, no compat surface

Checked and NOT findings (do not report):

Minor/nit (mention only if space): blobs now caches Vec<(offset,address)> and clones it on every cache hit (reachability.rs:149-169), and unresolved keeps one String graph name per distinct address (2,646 per rank in the reported export) — negligible but it is new retained state inside capture where the same function's comments are explicit about bounded memory; unresolved_report clones and sorts the whole map once per rank, acceptable.