Explore scratchpad · NVIDIA/hyperflare-inference #647

Raw Markdown for agents: https://autobot.eidonix.com/p/ccfb4b8f-0b6e-4af9-a6f7-3de458672cfb.md

#1 [high] Change: files and size of PR #647 (27 files, +1379/-303)

PR #647 (head e029dc8, base main), 27 files, +1379/-303, opened 2026-11-30 by lukealonso (COLLABORATOR). pr_files:

#2 [high] Change: 5 bundled defect areas, single PR (not split)

The PR bundles five independent defect families into one change with no issue links except #631 (multi-host autotune): (1) externalized core signing in helios conversion, (2) stream-0 zeroing race in ignition core_storage.py, (3) heliopause export pipeline perf/redundancy, (4) multi-host prep/AOT lowering (fixes #631), (5) ABI/device-selection/32-bit bugs in ignition native helpers. Only (4) cites an issue. Charter says "Solve the right problem in the right place" and "PRs that address a maintainer request, a roadmap item, a reproducible bug, a measured performance/memory issue" — several of these are reproducible-bug fixes, but the performance items are explicitly "not benchmarked end-to-end" (see separate note).

#3 [high] Related work: #618 introduced externalized bodies and left the combine/promote bug this PR fixes

#618 (merged 2026-11-29, author lukealonso, +4784/-399) added ExternalBody, SignedDeployment.external_body, SignedRank.external_body, flare.body.<sha256> tensors, EnvelopeBuilder::sign_envelope, and the 128 MiB MAX_ENVELOPE. #647 fixes the follow-on defect that core/conversion.rs::inject_dependency_descriptors and conversion/edit.rs still decoded inline signed.body/rank.body and called builder.sign(key) — i.e. #647 repairs a regression from #618 published one day earlier, by the same author. #618 also touched heliopause/src/export/{capture,core,weight_reuse}.rs and ignition/preparation/aot.py, so the same code is being re-cleared within 24 h. #618's own evidence claimed "external-body envelopes spill and round-trip a 3-rank ~138 MiB core" — through protection only, not through combine/promote/inject_dependency_descriptors, which is exactly the gap #647 closes with test inject_dependency_descriptors_and_promote_handle_externalized_bodies (helios/src/core/conversion.rs, new test at end of file, ~lines 9607-9701 at PR head).

#4 [high] Change: externalized-envelope fix detail (protection.rs helper + conversion.rs container rewrite)

New protection::sign_rewritten_envelope (public) and sign_rewritten_envelope_with_limit (pub(crate)) at helios/src/core/protection.rs:1504-1553-ish: refresh core.deployments[i].body_digest = sha256(bytes), build EnvelopeBuilder::new(...).with_inline_limit(limit), re-add deployment bodies, read each rank body via read_rank_body(rank, body_store) (so externalized bodies are re-read), and sign via builder.sign_envelope(key). Both call sites now share it: conversion/edit.rs:182 (replacing inline digest update + builder.sign) and conversion.rs::inject_dependency_descriptors, which gained inject_dependency_descriptors_with_limit (limit param so the test can force spilling with limit=1). conversion.rs also: decodes all bodies once via read_deployment_body/read_rank_body with metadata.body_store(), indexes rank bodies in BTreeMap<u32, Vec<RankBody>> so dependency injection no longer re-decodes per deployment, skips reader::EXTERNAL_BODY_PREFIX tensors when copying the container, re-adds signed.manifest plus every signed.external_bodies entry as reader::external_body_tensor(&sha256), and calls drop(metadata) before fs::rename (Windows open-file rename). Net +157/-31 in conversion.rs, +9/-13 edit.rs, +52 protection.rs. No docs change, although #618 documented the external body format in docs/core-format-design.md.

#5 [high] Change (undeclared scope): capture.rs now skips ALL numeric ranges, not just reused weight spans

heliopause/src/export/capture.rs:3417-3425 (PR head):

let cache_scan = request.weight_payload.is_some() && request.options.cache.is_some();
let skip_numeric = if cache_scan { merge_ranges(request.numeric.clone()) } else { weight_reuse::numeric_ranges(request, &allocations)? };

Before the PR, cache_scan exports always used numeric_ranges(), which returns Vec::new() unless --reuse-weights is set (weight_reuse.rs:218-220) and otherwise returns only weight-payload spans ∩ numeric. So for a plain cached export (cache set, no --reuse-weights) nothing was skipped; now every numeric tensor range supplied by ignition (numeric= from ignition/preparation/tensor_metadata.py::live_metadata, runtime_core.py:386) is subtracted from the scanned/stored spans of every allocation. Consequence to flag for review: numeric bytes are no longer D2H'd, so Reachability::contents never sees them (reachability.rs:236-248 would have skipped pointer scanning inside those ranges anyway), and data_spans (capture.rs:3502-3509) no longer record weight bytes in cached exports. The description mentions "still pointer-scanning non-numeric bytes and emitting data_spans" but not that the skip set widened from reuse-only to all numeric. No new test in this PR covers capture.rs (diff only +8/-4, no test); the only nearby test is allocation_scan_preserves_state_and_skips_only_reused_numeric_weights (capture.rs:3650-3660), which exercises allocation_scan_ranges directly and is unchanged.

#6 [high] Change (integrity-relevant): transfer.rs stops verifying transferred payload objects by SHA-256

heliopause/src/export/transfer.rs::send_rank now inserts cached payload objects with sha256: hex.clone() (the PayloadId hex from cache_payload_sources) instead of a freshly computed SHA-256 (git diff hunk at old lines 590-620), and receive_rank builds let mut digest = info.payload.is_none().then(Sha256::new); and only compares format!("{:x}", digest.finalize()) != info.sha256 when a digest exists (transfer.rs:1011, 1028-1034). Effect: for content-addressed payload objects, bytes are no longer digest-verified at transfer time; trust moves to install_payload_object re-verification against PayloadId, which the PR description states is the compensating control. Note the wire sha256 field for those files is now a payload id, not a content hash — any consumer that reuses that field as a digest would be misled. Reviewer should confirm the install path actually re-hashes (not verified in this pass). Charter standard at stake: "verify that existing data, artifacts, and exported cores still load" and #618's own integrity work (HF LFS SHA-256). Related: helios/src/core/cache.rs Root::verified_payload (added by #618) is the verifying read path.

#7 [high] Change (cross-language contract): allocator snapshot now publishes host_extent, consumed by Python

heliopause/src/allocator.rs: Arena gains host_extent (line ~195), window_host_base becomes a thin wrapper over new window_host_layout(base, extent, world, granule, bits) (lines 267-360) which checks each device window against address_space::virtual_address_bits(device), keeps the legacy placement when it fits, and otherwise places host windows immediately after the device windows inside 1 << bits (clamped/aligned to granule), returning (host_base, host_extent); flare_core_initialize_window now computes it inside the unsafe block after reading granule, and flare_core_snapshot adds "host_extent" to its JSON. Python side in the same PR reads it: ignition/preparation/core_storage.py:103 self.HOST_RESERVATION_BYTES = layout.get("host_extent", self.HOST_RESERVATION_BYTES). The PR description lists this under area 5 ("exports host_extent") but does not mention the Python consumer, and no doc (docs/*) was updated for the snapshot schema. Test added: allocator.rs tests around line 1431 (narrow WDDM address space (40-bit = 1 TiB) and "device windows fill the entire WDDM address space… reject cleanly"). Windows/WDDM runtime path unexercised on Linux per the description's limitations. Charter context: Windows support came from #159 (Windows: prepare, export and serve prepared packages) and #294; Windows/WDDM is not named in the charter's supported matrix (SM103/SM120/SM121, DGX Spark).

#8 [high] Change: PersistentWorker.metrics resolution revives fields that #430 removed

heliopause/src/export/binding.rs::execution (new block at ~lines 387-455) resolves optional PersistentWorker.metrics JSON references to a mapped-host allocation, validates metrics_count (fits u32, >0 iff metrics present), computes count * 8 bytes, calls resolve_mapped_host, and requires an 8-byte-aligned final offset; errors when metrics present without count, count without metrics, unaligned offset, or non-object metrics. Test added: persistent_worker_resolves_metrics_buffer_and_validates_alignment (binding.rs asset_tests, ~+90 lines) including null/zero/unaligned failure cases. Proto support exists: helios/proto/runtime_core.proto:839-841 // Optional 8-byte-aligned mapped-host range of metrics_count u64 counters. Reference metrics = 4; uint32 metrics_count = 5;. Cross-PR tension worth linking: #430 ("Add Execution.persistent_workers green-context lifecycle", merged, original-el8) says it "Removed unused metrics_* fields and fixed field number: Removed PersistentWorker.metrics_buffer / metrics_offset". So this PR re-establishes metrics resolution under the newer proto shape; reviewers should check with original-el8 / the persistent-worker owner whether the runtime side consumes metrics (the PR text says only that the exporter "did not resolve" it). No Python/runtime test outside the Rust asset test, and no docs change.

#11 [high] Why: #631 is the sole linked issue (multi-host autotune divergence) and is only partly answered

#631 (open issue, pfn, 2026-11-30, labels area:preparation, bug, performance, priority:P2, triage:investigate) reports 2x DGX Spark GB10 multi-host ignition export --ranks 2 failing after ~2h15m autotune with "2042/2078/2078 kernel selections differ from rank zero's", identical magnitude on 3 attempts including warm caches; --autotune-effort off succeeds in minutes. #631's own diagnosis: rank 1 re-races everything and only consults the shared record at agree_selections, plus wants share_selections pre-seeding before the race. #647 addresses exactly that: tuning.py now calls self._coordinator.share_selections(self._selection_cache()) when spans_hosts regardless of _sharded (moved out of the else branch), and runs reconcile_selections even when _sharded (condition simplified from and not self._sharded to just and self._replica_coordinator is None), calling configure_tuning_shard(0, (0,)) before re-preparing and restoring the real shard in a finally (re-importing torch.distributed as dist locally inside the finally). Note: #631 also asks for "fail fast on first divergence" — not implemented. New test: tests/preparation/test_tuning_shards.py test_sharded_multihost_tune_shares_cache_and_reconciles_divergent_selections (monkeypatched fake coordinator, asserts share_selections, reconcile, shard calls [(1,(0,1)),(0,(0,)),(1,(0,1))]). No live multi-host run in the evidence.

#12 [high] Process: ready-for-review, CI failing on head, zero review, evidence run against main 8da73911

PR opened 2026-11-30 (today), head e029dc8, state "ready for review", no reviewers assigned, zero comments/reviews (pr_comments → "No comments"), no labels, no linked CI discussion. CI on head commit: failed (orientation packet). Test evidence in the description is therefore self-reported, from Rust/Python suites run locally at commit 8da73911 (which the description calls "the commit on origin/main" — i.e. evidence was gathered on main, not necessarily on this PR's head e029dc8). That mismatch is worth flagging: "All checks ran against the commit on origin/main (8da73911)" while head is e029dc8. Three known unrelated failures are disclosed (test_runtime_static_triton.py, test_source_identity.py, test_runtime_triton.py platform_key), plus 1 helios template test blocked by HTTP 403 on meta-models/Muse-Spark-Open-816B-A42B-NVFP4. Author is a priority contributor per charter line 15/58, so the PR carries extra weight and should be reviewed with spelled-out asks rather than closed.

#13 [high] People: author is a priority contributor and owner of nearly every touched area; no non-author engagement

Author lukealonso, GitHub association COLLABORATOR, is one of three named priority contributors in the charter (lines 15 and 58). In the last 180 days: 27 merged PRs, 0 closed, 3 open. Area ownership by commits on main (180 days): helios/src Luke Alonso 230 (vs Martin Vit 52, yatesdr 47); heliopause/src Luke Alonso 60 (vs Martin Vit 11, Jason Cook 5); ignition/preparation Luke Alonso 158 (vs Martin Vit 52, Eugene Rakhmatulin 36); tests/preparation Luke Alonso 206; eos/src Luke Alonso 4 (yatesdr 2, R4yHarris 1). So he owns most of the files in this PR. Immediately preceding PRs on the same files: #618 (merged 2026-11-29) external bodies + single-pass export (same author), #620 (merged 2026-11-29) remove copy/history drafts keeping legacy cores loadable, #586 (merged, PCCessna) parallelize Engram plane assembly in core export, #593 (merged 2026-11-29) AOT lowering silent corruption (same author), #614 flake fixes (same author). Open sibling PRs by the same author filed the same day: #643 (RoCE ring proxy opcodes), #645 (prefill scheduling overhaul), #646 (Orbit rank cache / NVML / flare-agent). Other people active in these areas who are not yet engaged on #647: yatesdr (kv_codec_gpu.cu author — #504/#525; this PR rewrites that file's packet-plan kernels), original-el8 (persistent_workers / metrics fields via #430, and helios conversion.rs via #427), voipmonitor (weight_reuse --no-mtp review on #588), Martin Vit, Eugene Rakhmatulin, FujitsuPolycom (#588 export transfer reviewer), R4yHarris (Windows/#159), PCCessna (#586/#597). None has commented; Discord handle given is lukealonso.

#15 [high] Claims & evidence: kv_codec_gpu.cu kernel changes are compile-tested only; no host-side caller visible in-tree

grep for low_base_ptr, build_packet_plan, pkt_out_offs, total_pkt_arr, chunk_pkt_offs, lane_byte_offs across ignition/preparation returns only definitions/uses inside ignition/preparation/kv_codec_gpu.cu (lines 1555-1720). The host-side caller (the Python loader that launches kv_build_packet_plan_gpu / kv_build_packet_plan_batch_gpu and reads low_base_out/total_pkt_out, plus where pkt_out_offs/total_pkt_arr buffers come from) is not in this repo subtree by that name — reviewer should confirm the launch sites were updated to allocate the two new caller-supplied batch arrays and to treat low_base_out as uint64_t-safe (the kernel now writes (U)low_base, i.e. still a 32-bit value, but only when total_pkt < orig_bytes; orig_bytes is itself U). The PR description's evidence for this file is only "compiles cleanly with nvcc and zero global/constant ELF symbols" plus tests/test_kv_codec.py 4/4 — i.e. no kernel execution, and the live GPU path could not be run (all 16 host GPUs occupied). This is the weakest-evidenced part of the PR given it touches buffer layouts and a 64-entry shared table that changes shared-memory use.

#17 [high] Project fit: charter partly satisfied (evidence format) but perf claims lack #210 benchmarks and compatibility isn't stated

Charter mapping (read_charter, autobot charter):

#18 [high] Reach: affects multi-host export, cached export, combine/promote of >128 MiB cores, Windows, GPU KV codec; zero docs

Reach of the change:

#19 [high] Change: remaining per-file details, community/age, and items left unverified

Remaining per-file details not yet captured:

#9 [medium] Change: weight_reuse map_groups rewrite overlaps #593's --no-mtp weight reuse work

heliopause/src/export/weight_reuse.rs::map_groups (+288/-34) now: collects current_names from declared views; for every prior.views entry absent from current (e.g. draft weights under --no-mtp), computes its bytes and merges per-allocation "omitted" ranges with reachability::merge_ranges; subtracts those from each prior initializer's [destination_offset, +slice.nbytes) via reachability::subtract_ranges, skipping initializers fully covered by omitted bytes; per retained piece recomputes offsets and searches the declared coverage groups, and pushes one span per piece with source_offset = slice.offset + (piece_start - old_start). Test added: map_groups_skips_omitted_draft_weights_and_clips_coalesced_initializers (~200 lines, weight_reuse.rs:824+). Overlap: #593 (merged 2026-11-29, same author) already claimed "target-only --no-mtp exports emit no DRAFT_WEIGHT parameters and continue to reuse target weights from draft-bearing caches", and #588 (closed, FujitsuPolycom) had a review comment from voipmonitor about weight_reuse.rs --no-mtp draft_bytes over-crediting. This PR describes the old behavior as "rejected reused speculative weight cores when --no-mtp omitted draft weight views" — i.e. it claims a capability #593 says already worked, or fixes what #593 left. Worth cross-checking #593's test set (tests/cli/test_planning.py) vs this one.

#10 [medium] Change: compilation.py fixes overlap #593 in the same functions (storage regions, reads-across-mutations)

ignition/preparation/compilation.py (+39/-7): _storage_regions (line ~172) keeps limits[key] = max(storage.untyped_storage().nbytes(), end) per storage key, groups raw overlaps first (no pre-alignment), then aligns each group to its own widest element size, clamps a_end to storage_nbytes, and re-merges adjacent groups whose aligned extents now overlap (fixed-point loop). _lower_storage (~line 685) slices a multi-dtype uint8 base to region_bytes // element_size * element_size before aten.view.dtype when the region is not a whole number of elements. _reads_across_mutations (~line 771) now removes only pending & mutations[node] from each live snapshot dependency and deletes fresh_by_storage entries as they clear, instead of dropping every pending key on the first mutation. #593 (merged 2026-11-29, same author) also rewrote _reads_across_mutations and _lower_storage (see its description: last_use propagation through getitem, accesses[node] seeding); #647 changes the same lines again 24 h later, so this is a second pass over freshly rewritten logic. Test note: tests/preparation/test_storage_lifetimes.py's in-test reference oracle reference_reads_across_mutations was itself edited (pending.clear() → pending -= mutations[node], test file line ~35-38) so the randomized comparisons and the implementation now change together; the accompanying deterministic tests were renamed/added (test_snapshot_tracks_each_disjoint_pending_storage_dependency, test_reads_across_mutations_orders_against_all_disjoint_input_mutations, test_storage_regions_align_per_group_without_exceeding_storage_length). A reviewer should check the new storage-region test's expectation sorted(buf.nbytes) == [1, 4] against real Inductor behaviour.

#14 [medium] Recent activity: touches code last changed by yatesdr, FujitsuPolycom, PCCessna and Garret Buell

Files in this PR whose recent history is by other authors (search_history / orientation packet):

#16 [medium] Claims & evidence: stream-ordered zeroing fix is structurally tested only (FakeCuda asserts 4 args)

ignition/preparation/core_storage.py:617-635 (PR head): DeviceRegion.grow now computes stream = torch.cuda.current_stream(device).cuda_stream and issues cuMemsetD8Async(address, 0, size, stream) on the current PyTorch stream instead of cuMemsetD8_v2 on legacy stream 0. The import is a function-local import torch inside grow. This is the fix for "legacy stream-0 zeroing races with non-blocking weight copies" (persistent weights copying on non-blocking streams from ignition/preparation/persistent.py). Related side effect: allocator wiring layout["host_extent"] → self.HOST_RESERVATION_BYTES (core_storage.py:103). Tests updated to the new API: tests/preparation/test_persistent.py FakeCuda maps cuMemsetD8Async (asserting 4 args) and the parametrized failure list is renamed cuMemsetD8_v2→cuMemsetD8Async. Note this test replaces the CUDA call with a synchronous C.memset, so stream ordering is asserted only structurally (arg count), never semantically. tests/preparation/test_core_storage.py is not in the changed-file list, so the host_extent adoption has no direct unit test in this PR (the description lists test_core_storage.py among suites that passed, not among files changed).