#1 [high] PR 332 structure: files and behaviour
PR 332 (mark-yong), base main, head c3cc87e, 2 files +434/−30: heliopause/src/export/capture.rs, heliopause/src/export/reachability.rs.
reachability.rs (head):
- 45-55 UnresolvedCandidate {graph,node,function,argument,offset}; 57-61 UnresolvedEntry {first, order, occurrences}; 66-71 Site<'a>; 75 UNRESOLVED_EXAMPLES=10.
- 84 blobs: HashMap<(Vec,Vec<(usize,usize)>), Vec<(usize,u64)>> (was HashSet); 85 unresolved: HashMap<u64,UnresolvedEntry>.
- 131-145 candidate(): inactive check first (returns Ok(true) without referencing), then interval check → reference + Ok(true), else Ok(false). Same semantics as old pointer().
- 147-188 blob(): first site scans once and caches misses (offset,address); every site (cache hit or miss) replays misses into
unresolved, order = map len at first insert. - 190-246 unresolved_count (sum occurrences), unresolved_unique_addresses (map len), unresolved_report(functions): summary line, up to 10 examples sorted by entry.order, then "… N more occurrences not shown" where hidden = occurrences − min(distinct,10).
- 248-274 scan(data, base, misses): windows(8); if pointer in [floor,ceiling): in_free_block = inactive contains pointer;
if (!self.candidate(pointer)? || in_free_block) && let Some(misses) = ... { misses.push((base+offset,pointer)) }. - 276-362 graph(name, nodes, kernels): node_index enumerate; Site{graph:name,node:node_index,function:node.function as usize,argument:position}.
- 364-380 scan_spans passes base 0 / misses None; contents() and opaque_contents() pass misses None (never report).
capture.rs:
- 3102 reach.graph(&graph.name,&nodes,&kernels)
- 3074 Reachability::new(&allocations,&request.numeric,&request.inactive,&roots) — raw, unaligned request.inactive
- 1408-1423 live_pieces() trims allocations to granule-aligned holes for memory=="device" && sizing.is_none() && !peer && snapshot_spans.is_none()
- 3137-3141 if reach.unresolved_count()>0 → eprintln!("export: rank {}: {line}", request.rank) for reach.unresolved_report(&output.index.ranks[0].functions)
- functions pushed per kernel in order (2986-2992); wire::Kernel.function = kernels index (encode_kernel 889) ⇒ functions.get(candidate.function) aligns.
- request.inactive from ignition/preparation/runtime_core.py:296 storage.unused_ranges(); core_storage.py:303-318 (packed weight arena inactive ranges, torch segment inactive blocks/slack, persistent arena unused ranges).
#2 [high] Blocking: report still counts unaligned 8-byte windows (maintainer item 1 unaddressed)
heliopause/src/export/reachability.rs:248-274 scan iterates data.windows(8).enumerate() (line 259) and pushes (base + offset, pointer) for every byte offset; there is no offset % 8 == 0 (or argument-relative count-offset) filter anywhere in the head commit c3cc87e. blob (147-169) then reports each of those as a candidate.
Consequence: within one argument, every byte offset produces an 8-byte window, and all but the naturally aligned ones straddle two CUDA parameter fields, so they are not pointer-shaped values of any field. The counts in the PR description (rank 0: 175,329 occurrences / 2,646 distinct addresses) are therefore dominated by straddling window values, and the printed first examples are exactly such windows: the description's first example is argument 0, offset 4: 0x100000000800. The tests confirm unaligned offsets are reported, e.g. kernel_argument_candidate_offset_counts_from_the_argument_start asserts offset 16 and unresolved_examples_are_capped... asserts offsets 0,8,16…; nothing asserts that a straddling window at offset 4 is excluded.
This is exactly maintainer yatesdr's 2026-11-20 blocking review item 1 ("Keep retention as it is, report only argument-relative offsets divisible by 8"), which the head does not implement. Related missing test: their item 3 (a live pointer followed by a small integer in one argument, asserting the straddling window is not reported).
Fix: in scan, only record a miss when (base + offset) % 8 == 0 (or step data.chunks_exact at aligned offsets while keeping the per-byte retention scan), and add the straddle test. Keep retention iteration over all windows so the pre-existing conservative retention is unchanged.
Cited: PR #332 review 2026-11-20 (yatesdr), reachability.rs:259-269, 147-169, tests at 749-796.
#3 [high] Should fix: in_free_block uses raw inactive ranges while intervals are granule-trimmed
heliopause/src/export/reachability.rs:261-271 computes in_free_block from self.inactive, the raw merged ranges from CaptureRequest::inactive (Reachability::new line 107). But self.intervals, which decide what is a live allocation, are built from the allocations after live_pieces trims each inactive range at allocation.alignment boundaries (capture.rs:1196-1240: start.max(begin).div_ceil(granule) * granule, stop.min(end) / granule * granule; applied at capture.rs:1408-1423 for device allocations with sizing.is_none()).
So whenever an inactive range edge is not granule-aligned, the trimmed live piece still covers [raw_start, aligned_start) and [aligned_stop, raw_stop). A kernel-argument value there resolves to a live recorded allocation (it is inside an interval), and candidate() would return true for it — but candidate() returns early on the raw inactive hit (reachability.rs:131-135) before the interval lookup, and scan's in_free_block is also true, so line 266's (!candidate || in_free_block) reports it. The summary line then asserts the value falls "outside every live recorded allocation", which is false for those values, and the export cannot tell them apart from #266's real gap pointer.
Granularity comes from cuMemGetAllocationGranularity (ignition/preparation/core_storage.py:93 via the allocator snapshot, virtual_storage.py:28-36), i.e. 2 MiB-class granule on the supported devices, while storage.unused_ranges() ranges come from torch block addresses/sizes and packing padding (core_storage.py:303-318, packed_weights.py:100-105, alignment 512). Unaligned (non-granule-multiple) hole edges are thus the normal case, and each hole contributes up to a granule of live-but-reported addresses on each side, on every graph argument — a large false-positive source that also inflates occurrence and distinct-address counts.
Fix: derive in_free_block from the same geometry as intervals, i.e. treat a value as a candidate only when it falls in no self.intervals entry (the interval lookup already covers granule-trimmed holes), and delete the separate raw-inactive check, which also answers the maintainer's "one rule, one place" item. A test with a non-granule-aligned inactive range asserting that the value in the retained edge is not reported would settle it.
Cited: reachability.rs:131-145, 259-271; capture.rs:1196-1240, 1408-1423; ignition/preparation/core_storage.py:93, 303-318; tests reachability.rs:902-966 use granule-aligned holes (256-aligned offsets) so they do not cover this case.
#6 [high] Report of 2026-11-28, run 941 (head 1ac7073d) — verdict: no blocking issues; 2 should-fix, 3 nits
Review — PR #332 "Report unresolved kernel argument address candidates during export"
Lens: correctness. Head 1ac7073d, base main; 4 files, +599/−37 (heliopause/src/export/{capture.rs,reachability.rs}, docs/TODO.txt, docs/runtime-core-design.md).
Verdict: no blocking issues. 2 should-fix, 3 nits.
All three blocking items from the 2026-11-25 review of c3cc87e are fixed at this head:
- Alignment filter landed at the reporting push only.
reachability.rs:294-304: the loop still iteratesdata.windows(8)byte by byte for retention, and the push additionally requires(base + offset).is_multiple_of(8).baseis the chunk's byte offset within the argument blob (blobpassesstart as usize, reachability.rs:184-190), so the predicate is argument-relative, which is the right frame:blob.datais one parameter's bytes (encode_kernel, capture.rs:836-850), so parameter start is offset 0 and a pointer field sits at a multiple of 8. #266's offsets (256, 0) survive. Counts fell from 175,329/2,646 to 22,618/762 (rank 0) and 170,544/2,637 to 19,417/832 (rank 1) in the author's rerun, consistent with removing ~7 straddling windows per parameter. - Single rule.
in_free_blockis gone;candidate()(reachability.rs:156-170) is the only classifier and is byte-for-byte equivalent tomain'spointer()(main reachability.rs:118-131): inactive hit →Ok(false)with no reference; interval hit →reference+Ok(true); elseOk(false)). Retention semantics are therefore unchanged frommain, which I verified by comparing against themainblob atref=main. - Straddle regression test exists.
unaligned_straddling_window_is_not_reported_while_aligned_stale_pointer_is(reachability.rs:1046-1069) builds [live pointer][small int][aligned stale pointer], asserts the straddling window0x1000_0000_0800is absent while the aligned stale value at offset 16 is reported, and that the live target is still retained.
Also verified correct (no finding):
- Symbol lookup index mapping holds.
Site.function = node.function as usize(reachability.rs:346) indexeskernels;wire::Kernel.functionis set to that same kernels index (encode_kernel, capture.rs:889);functionsis pushed once per kernel infor kernel in &mut kernelsorder (capture.rs:3001-3083);graph()errors when the index is out of range (reachability.rs:322-324), sofunctions.get(...)never falls back to "unknown" in production. Test at reachability.rs:842-874 pins the index with a decoy function at position 1. blobsmiss cache is sound.candidate()depends only onintervals/inactive, both immutable afternew, so caching the first site's miss list per(data, numeric)and replaying it per site cannot drift.- Only kernel arguments report.
scan_spans,contents,opaque_contentspassmisses: None(reachability.rs:396-412), so allocation-content scans never fabricate candidates; testallocation_contents_still_tolerate_gap_candidates(1036-1043) covers it. - Numeric exclusions unchanged, subtracted before scanning (reachability.rs:177-190), and offsets are still argument-relative across split spans (test 805-822).
- Hidden-count arithmetic fixed and tested: distinct and occurrence totals are now separate (
reachability.rs:264-279; tests 876-987, including the "omit the line when nothing is hidden" case at 907-942). - Docs landed: diagnostic documented in
docs/runtime-core-design.md(reachability paragraph and the rank-stderr paragraph, +8/−2) and the pending four-GPU/Eight-GPU measurement indocs/TODO.txt(+6). - stderr is safe to print: no parent parses export stderr; the Python side reads a JSON summary string (
ignition/preparation/runtime_core.py:140-145), and per-rank stderr is already used for progress rows (capture.rs:2864-2868). is_multiple_ofis stable and within the crate'srust-version = "1.88"(heliopause/Cargo.toml:6).
#7 [high] Should fix: report and retention now disagree about inactive ranges, so sub-granule freed blocks go unreported
Should fix — the retained-edge false positive is explained away, not removed, and the raw/tri mmmed mismatch can now also hide real candidates.
heliopause/src/export/reachability.rs:156-170 (candidate) checks self.inactive first, and Reachability::new is still given raw request.inactive (capture.rs:3164). The exported live intervals, by contrast, come from live_pieces, which trims each hole inward to granule boundaries (capture.rs:1259-1303, applied at 1471-1485 for device allocations with sizing.is_none(), no peer address, no snapshot spans). Raw hole edges are not granule-aligned in practice: core_storage.unused_ranges() (ignition/preparation/core_storage.py:308-323) returns allocator-block slack such as (block.address + live, block.address + block.size) — 512-byte-class torch alignment — and PersistentTensorArena.unused_ranges() returns tensors' alignment padding (ignition/preparation/persistent.py:135-141), while the granule is cuMemGetAllocationGranularity (core_storage.py:502-504, virtual_storage.py:28-31), MiB-class.
Two consequences, in opposite directions:
- Values in a retained edge are still reported. The trimmed piece covers
[raw_start, aligned_start)and[aligned_stop, raw_stop). A candidate there resolves to a live exported allocation, yetcandidate()returns early on the raw inactive hit before the interval lookup, so it is reported as resolving to no active allocation. The new summary wording ("(gap or inactive range)") no longer asserts the false claim, which is an improvement over the 2026-11-19 head, but the values are still counted in the occurrence and distinct-address totals that the PR asks the reader to interpret. - Values inside a genuinely freed sub-granule block are not reported at all. The author's stated reason for keeping raw
request.inactive(comment at 2026-11-28 19:09, item 5) is that trimming inward would let a pointer into a freed sub-granule block retain the segment. That is true, but it is only half the trade:live_piecesalready retains that block as part of the enclosing piece, so the segment is retained either way, and the value silently drops out of the diagnostic (the!self.candidate(pointer)?guard at reachability.rs:298 is false, so nothing is pushed). A stale workspace freed at sub-granule granularity inside an otherwise live segment — precisely the #266 shape, a cuBLAS split-K workspace — is therefore invisible. Non-reporting here is not visible in any test:freed_interval_boundaries_report_kernel_candidates_without_retaining_storage(1072-1133) usesalignment: 256with hole edges 1024/3072, both granule-aligned, so raw == trimmed and the two geometries coincide.
Why it matters: the deliverable is the counts and the ten examples (charter line 11, "Bring real evidence"; line 35). With one geometry retained and one reporting, neither the totals nor the silence can be attributed.
Fix: derive candidacy from the exported geometry, and keep the conservative retention separately. Concretely, keep the current candidate() (which is main's retention rule) but compute the report predicate from self.intervals only — report when the value falls in no interval at all — and pass a second, granule-trimmed inactive list from capture_rank for that purpose, or pass the granule and trim inside candidate() for the report branch while leaving retention on the raw ranges. Add a non-granule-aligned test: one hole whose raw edge is not a multiple of the allocation alignment, asserting (a) a value in the retained unaligned edge is not reported, and (b) a value in a freed sub-granule block inside a retained piece is reported.
Cited: reachability.rs:156-170, 294-304; capture.rs:1259-1303, 1471-1485, 3164; ignition/preparation/core_storage.py:308-323, 502-504; ignition/preparation/persistent.py:135-141.
#10 [high] Research summary
I reviewed PR #332 at head 1ac7073d through the correctness lens, reading all four changed files (both Heliopause sources in full context, plus the two docs) and comparing candidate() against main's pointer() to confirm retention semantics are unchanged.
No blocking issues remain. All three blockers from the 2026-11-25 review of c3cc87e are fixed at this head: the 8-byte alignment filter landed on the reporting push only (reachability.rs:294-304), keeping the conservative byte-by-byte retention scan that #266's aligned offsets depend on; the duplicate in_free_block rule is gone, leaving candidate() as the single classifier and byte-equivalent to main; and the maintainer's straddle regression test exists (:1046-1069), asserting the straddling window is not reported while an aligned stale pointer is. I also verified the symbol-lookup index chain (Site.function → kernels index → wire::Kernel.function → the functions push order) holds, that only kernel-argument scans can report, and that the blobs miss cache cannot drift.
Two should-fix items. First, the report and retention still disagree about inactive ranges: the exported live pieces are granule-trimmed by live_pieces, but the report still uses raw request.inactive, so values in a retained unaligned edge are counted while values in a genuinely freed sub-granule block inside a retained segment are silently not reported — the #266 shape. The author kept raw ranges deliberately, but the trade has a missed-detection half that no test covers, since existing tests use granule-aligned holes. Second, the argument-relative alignment term (base + offset) has no test across numeric spans, so a regression to base = 0 would pass.
Three nits (first-encountered example ordering lets one kernel family fill all ten slots, test-only pub(crate) visibility, summary wording), plus notes on what I verified as consistent. Details and citations are in scratchpad entries #6–#9; the earlier-round notes remain #1–#5.
#11 [high] Round reconciliation: which earlier findings are closed vs superseded at head 1ac7073d
This PR has now had three review rounds from me. The final report must use only the current round (#6–#9) as open findings; the earlier rounds are history. Mapping:
#2 (blocking, "scan still counts unaligned windows") — CLOSED at 1ac7073d. The filter (base + offset).is_multiple_of(8) is at reachability.rs:300, inside the reporting push, exactly as the maintainer's item 1 asked. Do not re-report this as blocking. Evidence the fix is real: counts fell 175,329→22,618 (rank 0) and 170,544→19,417 (rank 1) in the author's rerun, roughly the ~7 straddling windows per parameter that the filter removes.
#3 (should fix, raw inactive vs granule-trimmed intervals) — SUPERSEDED BY #7, not withdrawn. #3 argued the mismatch produces false positives: values in a retained unaligned hole edge are reported though they resolve to a live exported allocation. That is still true at this head (candidate() checks self.inactive first, reachability.rs:157-160, before the interval lookup at 161-167). What changed is that #7 found the direction that matters more: the same mismatch also hides real candidates, because a pointer into a freed sub-granule block inside a retained piece resolves to a live interval and is never pushed (:298). The final report should present #7's both-directions framing and cite #3 only as the earlier statement of the false-positive half. One improvement since #3: the summary line now says "resolve to no active recorded allocation (gap or inactive range)" (:236-246), so the literal false claim #3 objected to is gone; the misleading counts remain.
#4 items. The duplicated-rule item (maintainer item 2) is CLOSED — in_free_block is deleted and candidate() is the only classifier. The "hidden-count mixes occurrences and distinct addresses" nit is CLOSED — distinct and occurrence totals are now reported separately (:264-279) and tested (:876-987). The "no test for the print path" item is WITHDRAWN as a general complaint: unresolved_report_names_the_kernel_and_its_symbol (:842-874) now pins the function-index mapping with a decoy entry, which was the load-bearing part; the remaining eprintln wrapper in capture.rs:3219-3223 still needs a GPU and is disclosed, not fixed, which is acceptable for a diagnostic. Items 5 (prose) and 6 (verified-clean) are folded into #9 and #6.
#5 was the formal report of round two. Nothing in it should be carried forward as an open finding except through #7 and #8.
Net open findings for the final report: 2 should-fix (#7, #8) and 3 nits (#9). No blocking items.
#4 [medium] Should fix: duplicate inactive rule, untested print path, hidden-count wording; and unaffected-behaviour notes
-
Duplicated rule (should fix, maintainer item 2):
candidate()treats an inactive range as a hit (reachability.rs:131-135) andscanrepeats the lookup asin_free_block(262-265). Two copies of one rule; combined with the raw-vs-trimmed mismatch in note 3 this is the mechanism of the false positives. State the rule once, fromself.intervalsonly. -
No test for the print path: the only caller is capture.rs:3137-3141 (
eprintln!("export: rank {}: {line}", request.rank)), which needs a CUDA context, sounresolved_report's wiring, the rank label and thefunctionsargument beingoutput.index.ranks[0].functionsare unverified by any test. The alignment ofwire::Kernel.function(capture.rs:889 sets it to the kernels index) with thefunctionspush order (capture.rs:2986-2992) is the only reason symbol lookup is right; a test or an assertion would settle it. Only a test can settle this. -
Nit in wording:
unresolved_report(reachability.rs:238-243) computeshidden = occurrences - examples.len().min(10), i.e. it mixes occurrences and distinct addresses: with 2,646 distinct addresses and 175,329 occurrences the line says "… 175,319 more occurrences not shown", while what is omitted is 2,636 distinct addresses as well. Say which quantity is hidden ("… 2,636 more distinct addresses, 175,319 occurrences not shown"). -
Nit:
UnresolvedCandidate/Site/UnresolvedEntryarepub(crate)only so the test module can inspect them (reachability.rs:45-71);candidate()returningboolplus the separatein_free_blockpredicate makes the "hit" and "report" notions distinct in a way that invites the drift in note 3. Consider a singleclassify()returning hit/report/gap. -
Prose (medium): the summary line says the values fall "outside every live recorded allocation" (reachability.rs:212-214) which, per note 3, is not always true, and the PR description's example ("argument 0, offset 4") is a straddling window that cannot be a pointer (note 2). Under the repo prose skill and AGENTS.md "Bring real evidence", the counts in the description should be re-run after the alignment and trimmed-hole fixes before they are presented as evidence about noise from W4A8 MoE kernels.
-
What is clean (no finding): retention semantics are unchanged —
candidate()returns exactly what the oldpointer()returned (inactive hit = no reference, interval hit = reference, else miss),contents/opaque_contents/allocation scans passmisses: Noneso they never report (reachability.rs:364-380, 421-441), andblobscaching now caches only the first site's miss list, which is correct because the miss set depends only on (data, numeric) while retention still runs per site. Numeric exclusions still subtract before scanning (147-165).unresolved_reportis bounded at 10 examples, memory growth is bounded by distinct addresses per rank. Non-retention of inactive storage is preserved and tested (reachability.rs:929-966). Ranks other than 0 print with a rank label to stderr, which is not JSON-framed output anywhere I found (transfer.rs stdout protocol unaffected), so it does not corrupt a machine-readable stream.
#8 [medium] Should fix: argument-relative alignment (base + offset) is untested across numeric spans and at non-zero argument offsets
Should fix — the alignment rule is tested only through blob(), never through the multi-chunk path, and no test covers an 8-byte field at a non-zero argument offset.
The filter is (base + offset).is_multiple_of(8) (reachability.rs:300), where base restarts at each numeric-exclusion span (blob, 184-190). Kernel arguments are not split only by numeric ranges, so the frame is consistent — but nothing tests that a real argument blob composed of several numeric spans still measures offsets from the argument start rather than from the last span. kernel_argument_candidate_offset_counts_from_the_argument_start (805-822) does check offset 16 across one exclusion, but that blob has no unaligned window to reject, so it would pass with base = 0 as well.
Two gaps worth a test each, both cheap and CPU-only:
- two numeric spans with the stale pointer in the second span at an argument offset that is a multiple of 8 but not a multiple of 8 relative to that span start (so
base = 0would wrongly drop it); - an argument whose 8-byte fields start at offset 8 or 16 with a straddling window at offset 4 or 12, mirroring the real
argument 0, offset 4case from the 2026-11-19 evidence.
Also worth noting: unaligned_straddling_window_is_not_reported... (1046-1069) asserts the exact positive/negative pair the maintainer asked for, but uses a blob() with numeric: vec![], so it does not reach the base logic at all — the base term remains untested.
Fix: add the two cases above to export::reachability::tests. Only a test can settle this; the code reads correctly as written.
Cited: reachability.rs:172-213, 283-306, 805-822, 1046-1069.
#9 [medium] Nits and verified-consistent notes for head 1ac7073d
Nit — example selection is first-encountered, so one kernel family can fill all ten slots. UNRESOLVED_EXAMPLES = 10 (reachability.rs:76) and examples are taken in first-insert order (247-263). The author's own rerun shows the effect: all ten printed examples on both ranks come from mHC and dense-GEMM kernels, and the author had to ask whether the reviewer wants one example per kernel symbol (2026-11-28 19:09). docs/TODO.txt already records "establish whether per-kernel example grouping is needed". No code change requested — the report is explicitly non-blocking and bounded; noting only that the current ordering makes the printed evidence about one kernel family per rank and should not be read as a survey of the scan.
Nit — UnresolvedCandidate/Site/UnresolvedEntry visibility. UnresolvedCandidate and Site are pub(crate) (reachability.rs:50, 67) only so mod tests can build a Site and inspect first. Not a defect; a #[cfg(test)] constructor or a pub(crate) const SITE would keep graph as &str in a struct that is only ever constructed internally.
Nit — the summary line's "… , so each may be a stale pointer or a numeric constant" (reachability.rs:236-246) is accurate, but the report still cannot say which; #266's case and W4A8 MoE constants are indistinguishable by construction, which the PR description already states honestly. No change needed.
Verified, no finding — commit-message/description consistency. The description's latest table (22,618/762 and 19,417/832, with 752/822 omitted) matches the verbatim stderr pasted in the 2026-11-28 comment, and the "aligned" wording matches (base + offset).is_multiple_of(8). The earlier contradictory MXFP4/A8 sentence has been replaced with the MLP-expert limitation paragraph, which is accurate: format="mxfp4", activation_mode="a8" — I did not re-open ignition/components/weights.py this round (it is not in the PR's diff), so I treat the recipe claim as the author's and out of this lens.
Verified, no finding — non-retention of inactive storage is preserved. candidate() returns Ok(false) without reference for both inactive hits and gaps (reachability.rs:156-170), so the report never makes a workspace live. Test numeric_leaves_and_inactive_candidates_do_not_retain (570-584) asserts both directions, and freed_interval_boundaries_... (1072-1133) asserts no retention for in-hole values and explicit re-referencing afterwards.