Skip to content

Report unresolved kernel argument address candidates during export - #332

Open
mark-yong wants to merge 1 commit into
NVIDIA:mainfrom
mark-yong:fix/reject-unrecorded-graph-args
Open

mark-yong wants to merge 1 commit into
NVIDIA:mainfrom
mark-yong:fix/reject-unrecorded-graph-args

Conversation

@mark-yong

@mark-yong mark-yong commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Refs #266.

Request

A captured CUDA graph can retain a kernel argument pointer to a workspace allocation no longer owned by the exported model (for example, cuBLASLt split-K arguments identified in #266). Export reachability scanning previously discarded address-shaped kernel-argument values inside the recorded address envelope that resolved to no active allocation without reporting them. Untyped kernel parameters, such as W4A8 MoE arguments, can also hold address-shaped numeric constants, so failing an export on every unresolved value would reject valid models.

Change

heliopause/src/export/reachability.rs replaces Reachability::pointer with Reachability::candidate as the single rule for live allocations versus gaps and inactive ranges: candidate retains only live allocations and returns false without retaining storage for both gaps and inactive ranges. Reachability::scan keeps stepping byte-by-byte for conservative retention, while unresolved candidate collection filters to argument-relative 8-byte-aligned offsets ((base + offset).is_multiple_of(8)) so 8-byte windows straddling adjacent parameters are not reported. Reachability::record_unresolved deduplicates cache-hit and cache-miss recording so Reachability::blob avoids cloning per-blob miss vectors. Reachability::graph supplies each call site so Reachability::unresolved_report records each distinct address's first graph, node, recorded function index, parameter, byte offset, encounter order, and occurrence count, selecting up to ten examples per rank with one first-encountered address per distinct recorded kernel symbol before backfilling remaining slots in encounter order.

From heliopause/src/export/capture.rs, each rank writes reach.unresolved_report(&output.index.ranks[0].functions) directly to stderr (unresolved_report returns an empty vector when no unresolved candidates exist): a summary line stating that candidates resolve to no active recorded allocation (gap or inactive range), up to ten distinct addresses with per-address occurrence counts, and a trailing line giving the exact omitted distinct-address and occurrence counts when more than ten distinct addresses occur. Declared numeric exclusions and allocation-content scanning keep their existing behavior. docs/runtime-core-design.md documents the non-blocking per-rank stderr diagnostic, and docs/TODO.txt tracks the pending four-GPU DeepSeek V4.1 (#266) and eight-GPU W4A8 MoE export measurements.

Model export now surfaces 8-byte-aligned unresolved kernel-argument address candidates per rank as a non-blocking diagnostic without changing allocation retention, excluding 8-byte windows that straddle adjacent parameters, spreading up to ten printed examples across distinct kernel symbols before backfilling in encounter order, and reporting exact per-address and omitted counts.

Validation

On a Linux x86_64 host without CUDA against commit 38805ba3, cargo test --locked --manifest-path heliopause/Cargo.toml --lib completed (exit 0) with 231 passed, 0 failed, and 6 ignored (all 6 ignored tests require a CUDA device), including all 28 tests in export::reachability::tests. Covered cases include aligned stale pointers versus straddling windows, argument-relative alignment after a four-byte numeric exclusion prefix, inactive-range boundaries at aligned and unaligned offsets without retaining inactive storage, first-site and recorded-symbol lookup, prioritization across distinct kernel symbols with encounter-order backfill, per-address occurrence counts, omission of the trailing line at or below 10 distinct addresses, and exact omitted distinct-address and occurrence sums above 10.

Separately, an earlier two-GPU SM120 export of local-inference-lab/DeepSeek-V4-Flash-Vision-Exp-lossless-CSF (45fd9976, two RTX PRO 6000 Blackwell Max-Q GPUs, driver 615.71.09, PyTorch 2.14.1+cu132, FlashInfer 0.7.3 at 5d2a7107, hyperflare-recipes at d1376bb, --gpus 0,1 --max-concurrency 1 --image-concurrency 1 --no-mtp --prefill-chunk-size 4096 --autotune-effort off --compile-workers 4) exercised the identical Reachability::scan and Reachability::candidate alignment filtering prior to adding per-symbol prioritization in unresolved_report, completing (exit 0) with 22,618 occurrences / 762 distinct aligned addresses on rank 0 and 19,417 occurrences / 832 distinct aligned addresses on rank 1. Per-symbol example selection in unresolved_report was verified afterward by the CPU unit suite.

Limitations

Unaligned unresolved kernel-argument values (including non-8-byte-aligned struct fields), values outside the recorded address envelope, and stale values that alias live storage are not reported by this scan. The ten-line stderr sample with per-symbol example prioritization has not been re-captured on GPU, and four-GPU DeepSeek V4.1 (#266) and eight-GPU W4A8 MoE exports remain unrun on four-GPU and eight-GPU hardware.

Discord: myong_acct

@mark-yong
mark-yong marked this pull request as draft November 18, 2026 11:13
@mark-yong mark-yong changed the title Reject kernel arguments that point outside recorded allocations Report unresolved kernel argument address candidates during export Nov 18, 2026
@mark-yong
mark-yong force-pushed the fix/reject-unrecorded-graph-args branch 3 times, most recently from 435e6a8 to f065ef1 Compare November 18, 2026 18:29
@mark-yong
mark-yong marked this pull request as ready for review November 18, 2026 18:30

@yatesdr yatesdr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This report would have flagged the stale pointer in #266, but as printed it is hard to act on and can show only noise. It needs these changes before it can merge.

Blocking

  1. It prints a handle, not a kernel. capture.rs:3150 prints candidate.function, the run-specific CUfunction handle. The symbol is resolved with cuFuncGetName in the same scope (capture.rs:2961-2972). Print the symbol.
  2. It prints once per rank. The block at capture.rs:3137 runs on every rank with no rank label, while progress output is rank-0 only (capture.rs:2774-2778). Print on rank 0, or label the rank.
  3. The examples can all be noise. The ten examples are the first ten hits (reachability.rs:176, take(remaining)), not representative ones as the doc comment says. #266's audit found W4A8 constants that also fall in recorded-envelope gaps; if they come first, they fill every slot. Keep one example per unique address and correct the comment.
  4. Measure the noise. The description says noise on real exports is unmeasured. Run one W4A8 export and post the occurrence count and unique-address count.
  5. CONTRIBUTING.md requires Signed-off-by on every commit; f065ef1 has none.

Should fix

  1. Tests: unresolved_unique_addresses is checked with one address only, so deduplication is untested; the print block in capture.rs has no test; repeated_argument_bytes_report_every_call_site (reachability.rs:728) repeats what unresolved_examples_are_capped_while_occurrences_are_counted (line 690) already proves, except the graph name.
  2. The commit message and the PR description differ (formatting result, issue references). Keep one text.

@mark-yong
mark-yong force-pushed the fix/reject-unrecorded-graph-args branch from f065ef1 to 499710e Compare November 19, 2026 15:36

@yatesdr yatesdr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked 499710e against the last round. The kernel symbol, the rank label, one example per address, the sign-off and the matching commit and PR text are fixed. On x86-64 Linux, CPU only, cargo test --manifest-path heliopause/Cargo.toml --lib passes at this head and with the head merged into main d8fd143 (206 passed, 4 ignored, both). We did not run clippy or an export.

One item from the last round is still open, and there are three new points:

  1. Noise on a real export (blocking, from the last round). No export has run. The examples are the first ten distinct addresses in graph and node order (reachability.rs:174-180), so ten distinct numeric constants that come earlier fill every slot and the stale address shows up only in the hidden count. Please post the printed summary from one W4A8 export with this build: the occurrence and distinct-address counts on each rank, and any example that is not a W4A8 MoE constant.
  2. The cuBLASLt example contradicts #266. The description and commit message say CUDA-library kernels such as cuBLASLt carry address-shaped numeric constants. In #266 the cuBLASLt split-K arguments (nvjet_..._splitK_TNNN, cublasLt::splitKreduce_kernel) are the stale pointers, and the only other hits are constants in the W4A8 MoE kernels. Name the kernels that actually produce the false positives.
  3. Inactive ranges. A value inside an inactive range (a free block of a live segment) is still dropped with no report, and #266 says a pointer into a free block is just as unsafe at replay. Report those values too, or state in the description why they are excluded, so that an export with no summary line is not read as free of unowned pointers.
  4. Bookkeeping (should-fix). Each candidate stores the CUfunction handle, and kernel_symbols (capture.rs:2709-2719) rebuilds a handle-to-symbol map that depends on two lists sharing an order. Reachability::graph already has the kernel's index into functions (node.function, reachability.rs:285, written at capture.rs:889); storing that index removes kernel_symbols, its test and the module copies. The miss lists, unresolved_count, the example list with example_addresses, and unresolved_unique_addresses (reachability.rs:84-86, :196) also track one fact; one map from address to its first site and occurrence count would replace them.

@mark-yong
mark-yong force-pushed the fix/reject-unrecorded-graph-args branch 2 times, most recently from 6869905 to 11f2c1c Compare November 19, 2026 15:59
@mark-yong
mark-yong marked this pull request as draft November 19, 2026 16:04
@mark-yong
mark-yong force-pushed the fix/reject-unrecorded-graph-args branch from 11f2c1c to c3cc87e Compare November 19, 2026 20:38
@mark-yong

Copy link
Copy Markdown
Contributor Author

The proposed diagnostic now reports kernel-argument candidates in inactive parts of recorded allocation segments without retaining those allocations. The build-host Heliopause tests passed (205 passed, 4 ignored), including inactive-range boundaries and non-retention. Issue #266 identifies cuBLASLt split-K arguments as the stale-workspace-pointer case; the W4A8 MoE constants are a separate source of address-shaped numeric values. The updated PR description distinguishes them.

An SM120 two-GPU export of the recipe-pinned local-inference-lab/DeepSeek-V4-Flash-Vision-Exp-lossless-CSF checkpoint completed with the diagnostic enabled. 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. The printed rank-wide summary is:

Rank Occurrences Distinct addresses Example outside a W4A8 MoE kernel
0 175,329 2,646 prefill4096, node 34, b12x MHCPostPrePartialKernel (module-13), argument 0, offset 4: 0x100000000800
1 170,544 2,637 prefill4096, node 34, b12x MHCPostPrePartialKernel (module-6), argument 0, offset 4: 0x100000000900

All ten printed examples per rank were from mHC Cutlass kernels, rather than W4A8 MoE kernels. These totals include the whole graph scan; they do not establish W4A8 MoE kernel behavior or whether the mHC values are constants or stale pointers. The run does not reproduce #266's four-GPU DeepSeek V4.1 failure. I have only three RTX PRO 6000 GPUs and cannot export deepseek-ai/DeepSeek-V4.1-Flash-1017 on them. Someone with the required Sparks or RTX PRO 6000 GPUs would need to verify that export. I checked the other recipes: MiMo V2.6 Pro MOPD also uses MXFP4/A8 experts, but its documented export uses eight GPUs. I have not identified another W4A8 MoE export I can validate on my three GPUs.

@mark-yong
mark-yong marked this pull request as ready for review November 20, 2026 04:25

@yatesdr yatesdr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the export numbers; they answer the first item of the last round. At c3cc87e:

  • inactive ranges are reported without being retained;
  • one map now holds each address's first site and count;
  • symbols come from the recorded function index;
  • the description's account of #266 is fixed.

One change before this can merge, and three smaller ones:

  1. Report only offsets that can hold a pointer (blocking).

    • scan steps data.windows(8) one byte at a time (reachability.rs:259), so the report records a value at every byte offset of an argument.
    • Argument bytes are encoded per parameter (encode_kernel). CUDA places a pointer at an 8-byte-aligned offset within its parameter, so a value at offset 4 spans two fields and is not a pointer. Your first example is one: argument 0, offset 4, 0x100000000800.
    • #266's stale arguments sit at offset 256 of a 384-byte parameter and at offset 0 of argument 1.
    • With about 2,640 distinct candidates per rank, the ten printed examples fill with these windows before a stale pointer can appear.

    Keep retention as it is, report only argument-relative offsets divisible by 8, and post the counts from the same export again. If thousands remain, one example per kernel symbol would show which kernels produce them.

  2. One rule, one place. candidate already treats an inactive range as a hit, and scan repeats the inactive lookup (in_free_block, reachability.rs:262-265) to report it. State that rule once.

  3. A test for item 1. Put an 8-byte pointer to a live allocation, then a small integer, in one argument. Assert that the window straddling them is not reported, and that a stale pointer at an aligned offset is.

  4. Commit message.

    • Its first paragraph says values "outside live recorded allocations", which no longer covers inactive ranges.
    • The description reports an export with MXFP4/A8 experts, while the commit message still lists W4A8 as untested. Make the two agree.

@flare-autobot

Copy link
Copy Markdown
Collaborator

A case file has been opened for 332.
Case File Intake Report

Future reviews will auto-run 90 minutes after code updates are pushed.

  • Re-review sooner: Call @flare-autobot after push.
  • Opt-out: Include #autobot:ignore in the PR or any comment.

@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review for Agents.

Recommendation: Changes Requested

Blockers:

  • Report counts byte windows, not argument values — scan slides data.windows(8) one byte at a time (reachability.rs:259) and pushes at :269 with no alignment filter; the PR's own first example is a straddling window (argument 0, offset 4: 0x100000000800). Add (base + offset) % 8 == 0 to the reporting push only — retention depends on unaligned scanning (unaligned_pointer_across_chunks_retains_target, :480-489), so do not narrow the loop. Then rerun the export and post before/after counts per rank. First captured graph keeps a transient cuBLAS split-K workspace: Xid 31 on DeepSeek V4.1 TP4 with --prefill-chunk-size 8192 at 7f534bb6 #266's real cases (offset 256, offset 0) are aligned and survive the filter.
  • Inactive ranges are raw while live intervals are granule-trimmed, so the report can state something false — Reachability::new gets raw request.inactive (capture.rs:3074) but the intervals come from allocations already trimmed inward by live_pieces (:1196-1240, applied :1408-1423); bytes in the retained edge are reported and then described as "outside every live recorded allocation" (reachability.rs:211-214). Pass the trimmed geometry (or granule) and add a non-granule-aligned test.
  • No regression test for the straddling window (maintainer item 3): pointer to a live allocation + small integer in one argument; assert the straddle is not reported and an aligned stale pointer is. Land with the alignment fix.

Should fix:

  • State the inactive rule once (maintainer item 2): one classifier Retained/Inactive/Unallocated replacing candidate()'s bool + scan's duplicate in_free_block. ⚠️ The second lookup is not dead code — candidate returns Ok(true) for inactive values, so deleting in_free_block alone silently stops inactive reporting (:902-916).
  • Fix the printed summary line and the hidden-count units: :211-214 claims "outside every live recorded allocation" though inactive ranges are also reported; :238 subtracts a distinct-address count from an occurrence total (prints "14" where 4 occurrences are hidden, and prints a hidden count when nothing is hidden).
  • Scope the posted evidence, repair one sentence, reconcile the commit message: say which scan rule produced the 175,329/170,544 totals; the "no W4A8 MoE kernel among the examples" line is self-undermining (load_mxfp4_experts → format="mxfp4", activation_mode="a8", ignition/components/weights.py:1574-1588).
  • Document the new per-rank stderr line (capture.rs:3137-3141; missing from docs/runtime-core-design.md:310-313) and add the pending four-GPU/W4A8 verification to docs/TODO.txt (AGENTS.md:53).

Nits:

8 nits

To opt out, include #autobot:ignore in your post or comment.

@mark-yong
mark-yong force-pushed the fix/reject-unrecorded-graph-args branch from c3cc87e to 1ac7073 Compare November 28, 2026 19:09
@mark-yong

Copy link
Copy Markdown
Contributor Author

Rebased onto nvidia/main (c9935887, commit 1ac7073d) and addressed the remaining review items:

  1. Aligned unresolved reporting (heliopause/src/export/reachability.rs:283-306): Reachability::scan continues byte-by-byte scanning for conservative retention, while unresolved candidate collection records only argument-relative offsets divisible by 8 ((base + offset).is_multiple_of(8)), filtering out straddling 8-byte windows across adjacent parameters.
  2. Single live/inactive/gap rule (heliopause/src/export/reachability.rs:156-170): Reachability::candidate replaces Reachability::pointer, retaining only live allocations and returning false without retaining storage for both gaps and inactive ranges.
  3. Alignment and boundary tests (heliopause/src/export/reachability.rs:1046-1133): Added unaligned_straddling_window_is_not_reported_while_aligned_stale_pointer_is and covered aligned and unaligned offsets in freed_interval_boundaries_report_kernel_candidates_without_retaining_storage.
  4. Report formatting and summary wording (heliopause/src/export/reachability.rs:230-281, :842-987):
    • Updated the summary line and doc comments to state that candidates "resolve to no active recorded allocation (gap or inactive range)".
    • Added per-address occurrence counts ((<N> occurrence[s])) to each example line, omitted the trailing line when at most ten distinct addresses exist, and replaced the mismatched occurrences - shown_distinct subtraction with exact omitted distinct-address and occurrence counts (… <N> more distinct addresses (<M> occurrences) not shown), covered by four unit tests.
  5. Keeping raw request.inactive (heliopause/src/export/capture.rs:3164): Kept &request.inactive untrimmed rather than passing granule-trimmed ranges from live_pieces (capture.rs:1259-1303). Trimming inactive inward to granule boundaries would allow pointers into freed sub-granule blocks inside a retained segment to retain the segment and drop out of the unresolved report; updating the summary wording resolves the contradiction without weakening detection.
  6. Documentation and follow-up (docs/runtime-core-design.md, docs/TODO.txt): Documented the per-rank stderr diagnostic in docs/runtime-core-design.md and recorded the pending four-GPU DeepSeek V4.1 (First captured graph keeps a transient cuBLAS split-K workspace: Xid 31 on DeepSeek V4.1 TP4 with --prefill-chunk-size 8192 at 7f534bb6 #266) and eight-GPU W4A8 MoE export measurements in docs/TODO.txt.
  7. Commit message and PR description: Reconciled both to match commit 1ac7073d, replaced the superseded unaligned counts and contradictory MXFP4/A8 phrasing with the aligned run below, and added Signed-off-by and Discord: myong_acct.

Aligned 2-GPU export rerun

Re-ran the two-GPU SM120 export of local-inference-lab/DeepSeek-V4-Flash-Vision-Exp-lossless-CSF (45fd9976, two RTX PRO 6000 Blackwell Max-Q GPUs, driver 615.71.09, PyTorch 2.14.1+cu132, FlashInfer 0.7.3 at 5d2a7107, hyperflare-recipes at d1376bb, --gpus 0,1 --max-concurrency 1 --image-concurrency 1 --no-mtp --prefill-chunk-size 4096 --autotune-effort off --compile-workers 4) against commit 1ac7073d:

Rank Prior unaligned (c3cc87ea) occurrences / distinct Aligned (1ac7073d) occurrences / distinct Omitted (distinct / occurrences)
0 175,329 / 2,646 22,618 / 762 752 / 14,776
1 170,544 / 2,637 19,417 / 832 822 / 13,614

Verbatim stderr diagnostic output:

export: rank 0: kernel argument scan: 22618 occurrences and 762 distinct addresses fall inside the recorded address envelope but resolve to no active recorded allocation (gap or inactive range), so each may be a stale pointer or a numeric constant
export: rank 0:   graph "prefill4096" node 35 kernel kernel_cutlass_kernel_b12xnormmhc_kernelsMHCFinalizeGramKernel_object_at__tensorptrbf16gmemalign16oi64i641_tensorptrf32gmemoi64i641_tensorptrf32gmemo31_tensorptrf32gmemo241_tensorptrbf16g_0 (module-15), argument 4, offset 8: 0x100000001000 (4 occurrences)
export: rank 0:   graph "prefill4096" node 35 kernel kernel_cutlass_kernel_b12xnormmhc_kernelsMHCFinalizeGramKernel_object_at__tensorptrbf16gmemalign16oi64i641_tensorptrf32gmemoi64i641_tensorptrf32gmemo31_tensorptrf32gmemo241_tensorptrbf16g_0 (module-15), argument 6, offset 16: 0x7cb800000004 (1286 occurrences)
export: rank 0:   graph "prefill4096" node 40 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc11638401_TVLayoutDst11638401_Valuetypef8E4M3FN_tensor00o4096111100_tensorptrf8E4M3FNgm_0 (module-34), argument 0, offset 32: 0xfff00000fff (1395 occurrences)
export: rank 0:   graph "prefill4096" node 40 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc11638401_TVLayoutDst11638401_Valuetypef8E4M3FN_tensor00o4096111100_tensorptrf8E4M3FNgm_0 (module-34), argument 13, offset 32: 0xfff000005ff (43 occurrences)
export: rank 0:   graph "prefill4096" node 44 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc1819201_TVLayoutDst1819201_Valuetypef8E4M3FN_tensor00o1024111100_tensorptrf8E4M3FNgmem_0 (module-36), argument 0, offset 32: 0xfff000003ff (1440 occurrences)
export: rank 0:   graph "prefill4096" node 44 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc1819201_TVLayoutDst1819201_Valuetypef8E4M3FN_tensor00o1024111100_tensorptrf8E4M3FNgmem_0 (module-36), argument 6, offset 32: 0x3fff000003ff (860 occurrences)
export: rank 0:   graph "prefill4096" node 44 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc1819201_TVLayoutDst1819201_Valuetypef8E4M3FN_tensor00o1024111100_tensorptrf8E4M3FNgmem_0 (module-36), argument 14, offset 32: 0xfff00003fff (43 occurrences)
export: rank 0:   graph "prefill4096" node 53 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc11638401_TVLayoutDst11638401_Valuetypef8E4M3FN_tensor000o40964111012_tensorptrf8E4M3FN_0 (module-74), argument 11, offset 16: 0x200000000020 (559 occurrences)
export: rank 0:   graph "prefill4096" node 74 kernel kernel_cutlass_kernel_b12xnormmhc_kernelsMHCPostPrePrefillGramKernel_object_at__tensorptrbf16gmemalign16oi641_tensorptrbf16gmemalign16oi64i641_tensorptrf32gmemoi641_tensorptrf32gmemoi64i6_0 (module-27), argument 0, offset 8: 0x100000000800 (1022 occurrences)
export: rank 0:   graph "prefill4096" node 74 kernel kernel_cutlass_kernel_b12xnormmhc_kernelsMHCPostPrePrefillGramKernel_object_at__tensorptrbf16gmemalign16oi641_tensorptrbf16gmemalign16oi64i641_tensorptrf32gmemoi641_tensorptrf32gmemoi64i6_0 (module-27), argument 5, offset 16: 0x7cb800001000 (1190 occurrences)
export: rank 0:   … 752 more distinct addresses (14776 occurrences) not shown
export: rank 1: kernel argument scan: 19417 occurrences and 832 distinct addresses fall inside the recorded address envelope but resolve to no active recorded allocation (gap or inactive range), so each may be a stale pointer or a numeric constant
export: rank 1:   graph "prefill4096" node 35 kernel kernel_cutlass_kernel_b12xnormmhc_kernelsMHCFinalizeGramKernel_object_at__tensorptrbf16gmemalign16oi64i641_tensorptrf32gmemoi64i641_tensorptrf32gmemo31_tensorptrf32gmemo241_tensorptrbf16g_0 (module-67), argument 4, offset 8: 0x100000001000 (4 occurrences)
export: rank 1:   graph "prefill4096" node 40 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc11638401_TVLayoutDst11638401_Valuetypef8E4M3FN_tensor00o4096111100_tensorptrf8E4M3FNgm_0 (module-35), argument 0, offset 32: 0xfff00000fff (1352 occurrences)
export: rank 1:   graph "prefill4096" node 40 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc11638401_TVLayoutDst11638401_Valuetypef8E4M3FN_tensor00o4096111100_tensorptrf8E4M3FNgm_0 (module-35), argument 8, offset 88: 0x100000000004 (1 occurrence)
export: rank 1:   graph "prefill4096" node 40 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc11638401_TVLayoutDst11638401_Valuetypef8E4M3FN_tensor00o4096111100_tensorptrf8E4M3FNgm_0 (module-35), argument 13, offset 32: 0xfff000005ff (43 occurrences)
export: rank 1:   graph "prefill4096" node 44 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc1819201_TVLayoutDst1819201_Valuetypef8E4M3FN_tensor00o1024111100_tensorptrf8E4M3FNgmem_0 (module-20), argument 0, offset 32: 0xfff000003ff (1683 occurrences)
export: rank 1:   graph "prefill4096" node 44 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc1819201_TVLayoutDst1819201_Valuetypef8E4M3FN_tensor00o1024111100_tensorptrf8E4M3FNgmem_0 (module-20), argument 2, offset 8: 0x798900001000 (64 occurrences)
export: rank 1:   graph "prefill4096" node 44 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc1819201_TVLayoutDst1819201_Valuetypef8E4M3FN_tensor00o1024111100_tensorptrf8E4M3FNgmem_0 (module-20), argument 6, offset 32: 0x3fff000003ff (860 occurrences)
export: rank 1:   graph "prefill4096" node 44 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc1819201_TVLayoutDst1819201_Valuetypef8E4M3FN_tensor00o1024111100_tensorptrf8E4M3FNgmem_0 (module-20), argument 14, offset 32: 0xfff00003fff (43 occurrences)
export: rank 1:   graph "prefill4096" node 53 kernel kernel_cutlass_kernel_b12x_libdense_gemmkernelDenseGemmKernel_object_at__CopyAtom_ThrID10_TVLayoutSrc11638401_TVLayoutDst11638401_Valuetypef8E4M3FN_tensor000o40964111012_tensorptrf8E4M3FN_0 (module-21), argument 11, offset 16: 0x200000000020 (731 occurrences)
export: rank 1:   graph "prefill4096" node 74 kernel kernel_cutlass_kernel_b12xnormmhc_kernelsMHCPostPrePrefillGramKernel_object_at__tensorptrbf16gmemalign16oi641_tensorptrbf16gmemalign16oi64i641_tensorptrf32gmemoi641_tensorptrf32gmemoi64i6_0 (module-32), argument 0, offset 8: 0x100000000800 (1022 occurrences)
export: rank 1:   … 822 more distinct addresses (13614 occurrences) not shown

On a Linux x86_64 host without CUDA against commit 1ac7073d, cargo test --locked --manifest-path heliopause/Cargo.toml --lib passed (221 passed, 0 failed, 5 CUDA tests ignored; 26/26 in export::reachability::tests). Distinct aligned counts fell below a thousand per rank (762 and 832); let me know if you also want one example per kernel symbol rather than first-encountered order across kernels.

@mark-yong
mark-yong requested a review from yatesdr November 28, 2026 19:09
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

Core implementation at 1ac7073d is sound, but the PR description still posts superseded c3cc87ea measurements and omits the alignment restriction, plus two small targeted improvements should land before merge.

  • Blockers: 1
  • Should fix: 2
  • Subtractive suggestions: 1
  • Nits: 2

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

@flare-autobot flare-autobot added area:preparation Ignition checkpoint loading, tuning, compilation, capture, and export. enhancement New feature or request triage:review Proposed change needs code review; this does not imply merge readiness. labels Nov 29, 2026
Captured CUDA graph kernel arguments can retain stale workspace addresses
that fall in gaps between live allocations or in inactive parts of recorded
segments, as seen in cuBLASLt split-K arguments for issue NVIDIA#266. Before this
change, export reachability discarded address-shaped kernel-argument values
inside the recorded address envelope that resolved to no active allocation
without reporting them. Untyped parameters such as W4A8 MoE kernel arguments
can also hold address-shaped numeric constants, so failing an export on
every unresolved value would reject valid models.

Replace `Reachability::pointer` with `Reachability::candidate` as the single
check for live storage versus inactive ranges and gaps in
`heliopause/src/export/reachability.rs`, retaining only live allocations and
returning `false` without retaining storage for both gaps and inactive
ranges. Keep `Reachability::scan` stepping byte-by-byte for conservative
retention while collecting unresolved candidates only at argument-relative
offsets divisible by 8 (`(base + offset).is_multiple_of(8)`), filtering out
8-byte windows that straddle adjacent parameters. Extract
`Reachability::record_unresolved` so `Reachability::blob` records unresolved
sites without cloning cached miss vectors, and record each distinct
unresolved address's first graph, node, recorded function index, parameter,
byte offset, encounter order, and occurrence count. Update
`Reachability::unresolved_report` to select up to ten distinct addresses,
prioritizing one first-encountered address per distinct recorded kernel
symbol before backfilling remaining slots in encounter order, with
per-address occurrence counts and exact omitted distinct-address and
occurrence counts. From `heliopause/src/export/capture.rs`, write
`reach.unresolved_report(&output.index.ranks[0].functions)` directly to
stderr per rank (returning an empty vector when no unresolved candidates
exist). Keep declared numeric exclusions and allocation-content scanning
unchanged, and document the stderr diagnostic in
`docs/runtime-core-design.md` and pending multi-GPU measurements in
`docs/TODO.txt`.

Model export now surfaces 8-byte-aligned unresolved kernel-argument address
candidates per rank as a non-blocking diagnostic without changing allocation
retention, excludes 8-byte windows that straddle adjacent parameters,
spreads up to ten printed examples across distinct kernel symbols before
backfilling in encounter order, and reports exact per-address and omitted
counts.

On this commit's tree on Linux x86_64 without CUDA, `cargo test --locked
--manifest-path heliopause/Cargo.toml --lib` completed (`exit 0`) with 231
passed, 0 failed, and 6 ignored (all 6 ignored tests require a CUDA device),
including all 28 tests in `export::reachability::tests` covering aligned
stale pointers versus straddling windows, argument-relative alignment
after an unaligned numeric prefix, aligned and unaligned inactive-range
boundaries without retaining inactive storage, per-symbol example
prioritization and encounter-order backfill, omission of the trailing line
at or below 10 distinct addresses, and exact omitted distinct-address and
occurrence sums above 10. A prior two-GPU SM120 export of
`local-inference-lab/DeepSeek-V4-Flash-Vision-Exp-lossless-CSF` (`45fd9976`,
two RTX PRO 6000 Blackwell Max-Q GPUs, driver 615.71.09, PyTorch
2.14.1+cu132, FlashInfer 0.7.3 at `5d2a7107`, `hyperflare-recipes` at
`d1376bb`, `--gpus 0,1 --max-concurrency 1 --image-concurrency 1 --no-mtp
--prefill-chunk-size 4096 --autotune-effort off --compile-workers 4`)
exercised the same `Reachability::scan` and `Reachability::candidate`
alignment filtering prior to adding per-symbol example prioritization in
`unresolved_report`, completing (`exit 0`) with 22,618 occurrences / 762
distinct aligned addresses on rank 0 and 19,417 occurrences / 832 distinct
aligned addresses on rank 1. Per-symbol example selection in
`unresolved_report` was added afterward and verified by CPU unit tests; the
ten-line stderr sample has not been re-captured on GPU. Limitations:
unaligned unresolved values (including non-8-byte-aligned struct fields),
values outside the recorded address envelope, and stale values aliasing live
storage are not reported; four-GPU DeepSeek V4.1 exports (NVIDIA#266) and
eight-GPU W4A8 MoE exports remain unrun.

Refs NVIDIA#266.

Signed-off-by: Mark Yong <mark-yong@users.noreply.github.com>
Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
@mark-yong
mark-yong force-pushed the fix/reject-unrecorded-graph-args branch from 1ac7073 to 38805ba Compare November 30, 2026 08:55
@mark-yong

Copy link
Copy Markdown
Contributor Author

@flare-autobot @yatesdr Rebased onto nvidia/main (0a8c20f4, commit 38805ba3), resolved the docs/TODO.txt conflict, and addressed the review items:

  1. Updated live PR body and unaligned limitation: Reconciled the PR description with 38805ba3 and documented in ## Limitations that unaligned unresolved kernel-argument values are not reported.
  2. Per-symbol example prioritization (heliopause/src/export/reachability.rs:256-282): Reachability::unresolved_report now selects up to ten distinct addresses by taking one first-encountered example per distinct recorded kernel symbol before backfilling remaining slots in encounter order, verified by unresolved_report_prioritizes_distinct_kernel_symbols_before_backfilling. Updated the docs/TODO.txt closing condition to match.
  3. Unaligned base prefix test (heliopause/src/export/reachability.rs:1219-1235): Added aligned_reporting_checks_argument_relative_offset_after_unaligned_numeric_prefix covering a (0, 4) numeric exclusion followed by a straddling window at offset 4 (excluded) and an aligned candidate at argument offset 8 (reported).
  4. Simplified unresolved recording and report call site: Extracted Reachability::record_unresolved (heliopause/src/export/reachability.rs:172-218) to remove both misses.clone() allocations in Reachability::blob, removed the redundant if reach.unresolved_count() > 0 wrapper in heliopause/src/export/capture.rs:3294-3296, and renamed the encounter-order test to unresolved_records_every_distinct_address_in_encounter_order.

Validation: Against commit 38805ba3 on Linux x86_64 without CUDA, cargo test --locked --manifest-path heliopause/Cargo.toml --lib passed (231 passed, 0 failed, 6 ignored; all 6 ignored tests require a CUDA device), including all 28 tests in export::reachability::tests. Note that the previously reported 2-GPU SM120 scan totals (22,618 occurrences / 762 distinct aligned addresses on rank 0; 19,417 / 832 on rank 1) were measured on the same Reachability::scan/candidate alignment filtering before per-symbol example prioritization was added to unresolved_report; the per-symbol 10-line GPU stderr sample has not been re-captured on GPU.

@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Ready To Merge

All prior blockers from yatesdr and the previous Autobot pass are resolved at 38805ba; the implementation is correct, bounded, and isolated to export-time diagnostics with retention semantics unchanged from main.

  • Blockers: 0 · Should fix: 0 · Subtract/Simplify: 2 · Nits: 2
Walkthrough
  • heliopause/src/export/reachability.rs:45-88,153-230: Replaces Reachability::pointer with Reachability::candidate as the single live-vs-gap/inactive rule, adds UnresolvedCandidate/UnresolvedEntry/Site, extracts record_unresolved, and caches per-blob aligned unresolved misses in blobs so shared argument bytes still tally exact occurrence counts without cloning miss vectors.
  • heliopause/src/export/reachability.rs:232-340: Adds unresolved_report (summary line, up to 10 examples prioritizing one first-encountered address per distinct recorded kernel symbol before backfilling in encounter order, plus exact omitted distinct-address/occurrence counts) and filters reporting in scan to argument-relative 8-byte-aligned offsets ((base + offset).is_multiple_of(8)) while keeping byte-by-byte retention scanning unchanged.
  • heliopause/src/export/reachability.rs:764-1300: Adds unit tests covering first-site tracking, encounter order, argument-relative offsets after unaligned numeric prefixes, straddling-window suppression, inactive-range boundaries without retention, per-symbol prioritization and backfill, and exact hidden-count formatting.
  • heliopause/src/export/capture.rs:3259,3294-3296: Passes &graph.name to reach.graph and prints each line of reach.unresolved_report(&output.index.ranks[0].functions) prefixed with export: rank <rank>: to stderr after graph_phase.finish.
  • docs/runtime-core-design.md:154-158,351-354 & docs/TODO.txt:357-361: Documents the non-blocking per-rank stderr diagnostic and tracks follow-up measurements on 4-GPU DeepSeek V4.1 (First captured graph keeps a transient cuBLAS split-K workspace: Xid 31 on DeepSeek V4.1 TP4 with --prefill-chunk-size 8192 at 7f534bb6 #266) and 8-GPU W4A8 MoE hardware.
Merge Risk: Low · up to 38805ba
  • No serving or retention blast radius: Changes are confined to heliopause/src/export/reachability.rs plus a 4-line call site (capture.rs:3259,3294-3296). Reachability::candidate preserves main's live-allocation retention logic (reachability.rs:156-170), contents/opaque_contents scans still pass None as the miss sink (:436-445), and no wire format, core artifact, or Helios serving path is modified.
  • No concurrency or failure-propagation hazard: Reachability is single-threaded per rank and dropped at the end of capture_rank; unresolved_report is purely diagnostic (eprintln! after graph_phase.finish) and never fails an export.
  • Bounded memory/CPU overhead: Reuses the existing blobs cache map (reachability.rs:85) to avoid rescanning repeated argument blobs; unresolved holds one entry per distinct aligned unresolved value in [floor, ceiling) (measured at 762 / 832 entries on a 2-GPU Vision-Exp export, dropped with Reachability).
Pre-merge checks: ✅ 4 passed · ⚠️ 1 warning

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

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

Labels

area:preparation Ignition checkpoint loading, tuning, compilation, capture, and export. enhancement New feature or request triage:review Proposed change needs code review; this does not imply merge readiness.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants