Code review summary report · NVIDIA/hyperflare-inference #332

Raw Markdown for agents: https://autobot.eidonix.com/p/ddfabee7-9e43-41f9-b11b-91f0ed12de97.md

Full report — PR #332 "Report unresolved kernel argument address candidates during export"

Head reviewed: c3cc87e · Base: main · Diff: +434/−30 across 2 files (heliopause/src/export/reachability.rs +428/−29, heliopause/src/export/capture.rs +6/−1) · Refs #266 · Author: mark-yong (CONTRIBUTOR, branch fix/reject-unrecorded-graph-args) · Third round of review, status CHANGES_REQUESTED (reviewer yatesdr, 2026-11-18 / 11-19 / 11-20) · No CI checks on the head commit.

Key findings


Blockers

B1. The report counts and prints byte windows, not argument values

Finding. heliopause/src/export/reachability.rs:259-271:

for (offset, bytes) in data.windows(8).enumerate() {
    let pointer = u64::from_le_bytes(bytes.try_into().unwrap());
    if pointer >= floor && pointer < ceiling {
        ...
        misses.push((base + offset, pointer));
    }
}

data is the encoded argument blob, one entry per parameter (encode_kernel). windows(8) yields a value at every byte offset, so a single 8-byte pointer parameter is also read at its seven misaligned offsets. CUDA places a pointer at an 8-byte-aligned offset inside its parameter, so a value at offset 4 spans two fields and cannot be a pointer. The PR's own first example is exactly that case: prefill4096, node 34, MHCPostPrePartialKernel, argument 0, offset 4, 0x100000000800 (PR description; author comment 2026-11-19), and all ten printed examples per rank are the same kernel at that offset. The reported totals — 175,329 occurrences / 2,646 distinct addresses on rank 0, 170,544 / 2,637 on rank 1 — therefore measure straddling windows. Independent corroboration that this is an artifact of the technique: an out-of-tree check on a healthy, already-fixed package found "864 unaligned byte-window matches and one aligned match per rank" (FujitsuPolycom, PR #331, 2026-11-19).

Request. Apply (base + offset) % 8 == 0 to the reporting push only (reachability.rs:267-270). Do not narrow the scan loop: unaligned_pointer_across_chunks_retains_target (reachability.rs:480-489) writes a pointer at byte offset 5 of a 19-byte buffer split across two contents() chunks and asserts reach.reached.contains("target"), so retention depends on scanning every byte offset plus the tail/boundary reassembly. Then rerun the same export and post before/after occurrence and distinct-address counts per rank; if thousands remain, print one example per kernel symbol so an operator can see which kernels produce the noise. Also check kernel_argument_candidate_offset_counts_from_the_argument_start (:772-790), which asserts a candidate at offset 16 for data whose composition implies a straddling window at offset 4 — confirm or adjust it against the filter so the suite does not fail confusingly. This is the maintainer's 2026-11-20 item 1.

Why. The diagnostic does not fail an export, so its entire value is whether its numbers and examples point at #266's stale arguments. As printed, the occurrence count can be inflated up to ~8× per parameter and the ten first-seen slots (UNRESOLVED_EXAMPLES = 10, :75; first-insert order, :222-224) are exhausted before a real stale pointer can appear. #266's actual cases sit at offset 256 of a 384-byte parameter and at offset 0 of argument 1 — both aligned, so the filter keeps them, which is worth stating in the description as the acceptance criterion. Without this, the check trains operators to scroll past it.

B2. Raw inactive ranges vs granule-trimmed live intervals: the report can state something false

Finding. Reachability::new is given the raw request.inactive (capture.rs:3074; merged unchanged at reachability.rs:107), while intervals come from allocations — which reached capture_rank through prepare_allocations (capture.rs:2786, :1337-1428), where live_pieces (:1196-1240) rounds each hole edge inward to the allocation granule:

let start = start.max(begin).div_ceil(granule) * granule;
let stop  = stop.min(end) / granule * granule;

So [hole_start, aligned_start) and [aligned_stop, hole_stop) stay inside a retained live piece. A kernel-argument value in such an edge is inside a live recorded allocation, but candidate returns early on the raw inactive hit without referencing (reachability.rs:131-135), scan recomputes the same raw predicate as in_free_block (:262-265), and the miss is recorded at :266-270 — after which the summary line asserts the value is "outside every live recorded allocation" (:211-214). Misaligned hole edges arise from partially-live preparation-pool blocks, whose range starts at block.address + block.requested_size (ignition/preparation/core_storage.py:303-318), while the granule is MiB-class (core_storage.py:93, :497-499).

Both existing inactive tests are blind to it: freed_interval_boundaries_report_kernel_candidates_without_retaining_storage (reachability.rs:928-966) uses a hole 1024..3072 inside a 4096-byte allocation with alignment: 256, and kernel_argument_inactive_ranges_are_reported_but_numeric_ranges_stay_lenient (:902-916) uses a hole 0x3000..0x3100 — both granule-aligned, so trimmed == raw.

Request. Pass the geometry live_pieces actually trimmed out (or the granule) into Reachability::new and derive the report predicate from it, so candidacy is decided once over the same geometry as intervals. Add a test with a non-granule-aligned inactive range asserting that a value in the retained edge is not reported and a value in the trimmed hole is.

Why. This is the same failure mode the PR exists to surface elsewhere: one lifetime-adjacent rule stated in two places that disagree. It is gated rather than deferred because it is the same edit as maintainer item 2 (one classifier over one geometry), so the incremental cost is near zero — and if it is left in, Blocker 1's rerun still posts counts containing false "no live owner" claims. I am not attaching a magnitude: how many misaligned hole edges exist in recorded core allocations is unmeasured; the defect stands on its own.

B3. No regression test for the straddling window

Finding. Nothing asserts that an unaligned window is not reported. The nearest tests only assert what is reported: unresolved_examples_are_capped_while_occurrences_are_counted (:750-770) builds back-to-back 8-byte values and expects 12 candidates at offsets 0, 8, 16, …, and kernel_argument_candidate_offset_counts_from_the_argument_start (:772-790) expects a hit at offset 16.

Request (maintainer's 2026-11-20 item 3). One test: an 8-byte pointer to a live allocation followed by a small integer in the same argument; assert the straddling window is not reported and that a stale pointer at an aligned offset is.

Why. Without it, Blocker 1 has no guard and the byte-window census returns the next time the loop is touched. It should land with the alignment fix, not after it.


Should fix

S1. State the inactive rule once (maintainer item 2)

Finding. candidate (:131-145) returns a bare bool, and scan re-derives the identical partition_point as in_free_block (:262-266) purely to recover which case it was. The composite !self.candidate(pointer)? || in_free_block means "in an inactive range, or in a gap".

Request. Have one classifier return the classification once — Retained / Inactive / Unallocated — with reference called only for Retained, reporting for Inactive | Unallocated, and Blocker 2's geometry behind it. That deletes in_free_block and the second binary search.

Why. Two copies of a lifetime-adjacent rule drift silently, and this is the maintainer's open 2026-11-20 item 2. Caution: the second lookup is not dead code — candidate returns Ok(true) for an inactive value and does not record it, so deleting in_free_block alone while keeping !self.candidate(...) silently stops inactive-range reporting. kernel_argument_inactive_ranges_are_reported_but_numeric_ranges_stay_lenient (:902-916) pins that behaviour and is the reason the classification must be returned rather than inferred.

S2. The printed summary line misstates which candidates it reports

Finding. reachability.rs:211-214 prints "… fall inside the recorded address envelope but outside every live recorded allocation, so each may be a stale pointer or a numeric constant". That is wrong for one of the two classes the code reports: free-block values inside a recorded segment are reported too (scan, :262-270). The PR description's own Change section states the correct rule. The struct doc at :45-48 has the same contradiction in miniature ("resolves to no live recorded allocation, including a value in an inactive range" — an inactive range is inside a recorded allocation).

Request. Name both conditions in the summary line and in the struct doc; update the pinned literals in unresolved_report_names_the_kernel_and_its_symbol (:830-841) and unresolved_report_bounds_examples_and_counts_hidden_occurrences (:860-865).

Why. The maintainer raised exactly this wording problem for the commit message in the 2026-11-19 review (item 4); the commit message was corrected, but the string an operator actually sees was not. A reader told "outside every allocation" will not think to look at a free block of a live segment — which is the #266 case.

S3. "… N more occurrences not shown" reports a number it does not compute

Finding. reachability.rs:238: let hidden = occurrences - examples.len().min(UNRESOLVED_EXAMPLES);. occurrences is the sum of per-address occurrence counts (:190-195); examples.len() is the number of distinct addresses. The subtraction mixes units. In the PR's own test (:844-870): 12 addresses scanned in two graphs = 24 occurrences; 10 examples print, each with occurrences == 2, so 20 occurrences are shown and 4 are hidden — the code computes 14 and :869 asserts " … 14 more occurrences not shown", locking the wrong number into the suite. In the other direction, 5 addresses × 2 occurrences prints a non-zero hidden count when nothing is hidden.

Request. Sum the occurrences of the examples actually printed (examples.iter().take(UNRESOLVED_EXAMPLES).map(|(_, e)| e.occurrences).sum()), or print omitted distinct addresses instead; make the description and the test say whichever is printed.

Why. It is the only quantitative handle a reader has for "did I see everything?", and it quietly weakens the round-2 concern that ten early constants fill every slot — the compensating number is inflated or deflated depending on how many sites each address has.

S4. The posted evidence is not scoped to the code that produced it, and the W4A8 contrast is self-undermining

Finding. The Validation section quotes the offset-4 example and the pre-fix totals without saying the run predates the restriction the reviewer requires (AGENTS.md:98-107). Further, "The recipe configures its MXFP4 experts with A8 activations (load_mxfp4_experts), but the printed diagnostic does not identify any W4A8 MoE kernel among its examples" asserts the A8 configuration and then reports the absence of the kernels that configuration produces — load_mxfp4_experts calls load_fp4_experts(..., format="mxfp4", activation_mode="a8") (ignition/components/weights.py:1574-1588) and the CSF branch defaults to a8 (:1593-1597). The later Limitations paragraph half-retracts the sentence.

Request. State which scan rule produced the posted numbers, or rerun after Blocker 1 and post the new counts; drop or repair the W4A8 contrast (or name the kernels the recipe's experts actually compiled to); confirm the commit message and description agree on MXFP4/A8 coverage (maintainer 2026-11-20 item 4).

Why. Evidence has to be connected to the behaviour tested and the limits of the conclusion; two paragraphs that disagree on what the run showed is what AGENTS.md:101-102 asks authors to reconcile. Charter line 11 ("Bring real evidence") applies.

S5. The new per-rank export message is undocumented

Finding. capture.rs:3137-3141 prints export: rank N: kernel argument scan: … on every rank of every export. docs/runtime-core-design.md:310-313 enumerates what native capture reports on stderr ("storage clearing, graph inspection and serialization, module/global capture, storage scans, weight materialization, and frontend assets") and omits it; docs/model-preparation.md:1471-1487 documents the comparable unconditional per-rank VRAM inventory.

Request. One short paragraph: the line exists, it does not fail the export, and where the scan is blind — reuse the Limitations wording already in the PR description.

Why. AGENTS.md:47-55 treats repository documents as present-state specifications; as written a reader of model-preparation.md cannot learn the line exists.

S6. The pending verification lives only in the discussion

Finding. The four-GPU deepseek-ai/DeepSeek-V4.1-Flash-1017 export and the unverified W4A8 path appear only in PR comments; this PR adds no docs/TODO.txt entry (search of docs/TODO.txt for 266 / W4A8 / kernel argument: no matches).

Request. Add the pending measurement to docs/TODO.txt.

Why. AGENTS.md:53 directs unresolved defects and pending measurements there.


Nits

  1. capture.rs:3137 repeats the callee's contract. unresolved_report already returns an empty Vec at zero occurrences (reachability.rs:206-210, pinned by :872-876), so if reach.unresolved_count() > 0 cannot change behaviour. Drop the if; unresolved_count then has one in-module caller and pub(crate) at :190 can become private. Two copies of one rule drift apart — the same class the maintainer rejected in item 2.
  2. reachability.rs:147-169 — the cache clones its key and cached miss list. data.to_vec() / numeric.to_vec() rebuild the key on every call (:148), and misses.clone() runs on both the hit (:150) and store (:166) paths, at ~2,646 distinct addresses per rank. Return a slice from the hit branch, or fill the cache in place.
  3. reachability.rs:170-186 — a full site is retained per distinct address while ten print. Each entry stores an UnresolvedCandidate with an owned graph: String (:176-182), i.e. ~2.6k heap-backed site records per rank written and never read. Fill first only while self.unresolved.len() < UNRESOLVED_EXAMPLES (compute the count before the entry call so self.unresolved is not borrowed twice).
  4. reachability.rs:455-461 — with_count is new machinery where the repo inlines the suffix. flare-cli/src/cache_commands.rs:307 (not opened), :309, :600, :602, :612, :617, :691, :697 all write if n == 1 { "" } else { "s" } inline; no pluralizer helper exists anywhere else (fn plural|pluralize: no matches). Inline it, or use "occurrence(s)" / "address(es)".
  5. Duplicate tests and two lookup idioms. shared_argument_bytes_record_one_example_per_address (:792-807) repeats :751-770 plus the graph-name assertion already made by :844-870 — the same overlap the maintainer flagged under its old name in the 2026-11-18 review item 6. unresolved_report_is_empty_without_candidates (:872-876) asserts a path production cannot reach while capture.rs:3137 keeps its own guard: keep one of the two. first() (:728-730) versus direct reach.unresolved[&address] (:767, :805) are two idioms for one lookup, and unresolved_unique_addresses (:197-199) exists to be asserted four times alongside .len(). The singular form of the hidden-count line is untested (only the plural at :869).
  6. reachability.rs:232-233 — unreachable kernel unknown (unknown). graph rejects an out-of-range function index (:290-292) and functions is built one-per-kernel in kernel order (capture.rs:2986-2992), so functions.get() always succeeds; the placeholder (pinned at :866) is indistinguishable from a kernel literally named unknown. Replace with a one-line comment that the two lists must stay in the same order, or say the recorded index was out of range.
  7. capture.rs:3137-3141 — raw eprintln! bypasses StartupProgress. Rank 0 builds stderr_rows() and other ranks silent() (:2774-2778), yet the report prints on every rank with a bare eprintln!, so it cannot be gated by is_enabled and never reaches StartupObservation. The maintainer accepted the author's resolution (2026-11-19 item 2) and capture.rs:3993 sets the same precedent, so keep it — noting that raw stderr does not corrupt the animated rows, because stderr_rows() never sets Output::started. If ever revisited, emit through the progress object and gate on is_enabled().
  8. Re-measure before keeping the surrounding machinery. If aligned candidates collapse to a handful after Blocker 1, the cap/order/example/symbol/cache layers may no longer earn their ~300 lines (charter: "Bring real evidence", "Reject unsupported abstractions and churn").

Verified correct (no finding)

Open questions / could not be settled