Repository navigation
heliopause, helios: parallelize Engram plane assembly in core export - #586
FujitsuPolycom wants to merge 1 commit into
Conversation
voipmonitor
left a comment
There was a problem hiding this comment.
Draft Review & Test Report (commit e43b2563)
Verdict: Approve once out of draft (minor items below) — thread-safe, deterministic, bounded in heap memory, and clean pre-worker validation.
Automated Test Results
cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib core::— 482 passed (1 pre-existinguid=0chmod test skipped/failed only as root).cargo test --locked --release --manifest-path heliopause/Cargo.toml --lib(default parallel threads) — 210 passed, 0 failed.
Audit Notes
run_payload_workers(helios/src/core/export.rs:1047-1141) usesstd::thread::scope, atomic cursor,catch_unwindparity, and clean stop propagation; single-file planes use statelesspread, multi-file planes use independent FDs, and concurrentRoot::payload()hits use per-OFD shared locks. Outputs assemble sequentially in declared order, and staged files unlink cleanly on error (handle closed beforeremove_file).- Heap is bounded to ≤512 MiB for 8 single-file digest workers (via
READ_AHEAD_SLOTS) and ≤64 MiB for multi-file workers.
Minor Items Before Ready/Merge
- [Minor] Replace internal fork PR reference
(Disposable cubin/graph span extraction is split into #35.)in the PR description with#587, and mention thatmaterialize_payload_spans/materialize_spanwere also migrated tomaterialize_pieces. - [Minor] Use
checked_addfortotal += piece.nbytesinmaterialize_payload_spans(heliopause/src/export/core.rs:2192). - [Minor] Eagerly
.take()openedfromresolvedwhen moving intoleases(heliopause/src/export/core.rs:1596-1613) instead of cloning and retaining duplicatePayloadObjectFDs untilcore_engramreturns. - [Minor] When moving out of draft, please include real export timing + RSS/page-cache numbers on a large Engram model (e.g., 188.8 GiB) to confirm 8 workers × 4 read-ahead threads (40 threads) doesn't regress single-NVMe contention or 128 GiB Spark page cache.
- [Nit] Move
engram_and_span_materialization_clean_up_staged_files_on_flush_enospc_and_sibling_failurefrommod packing_metadata_teststomod payload_export_tests.
Note: Directly conflicts with #587 in docs/runtime-core-design.md:323 and heliopause/src/export/core.rs (materialize_span + test module); coordinate rebase when landing both.
Why: Resolving host-resident Engram weight and scale planes serially leaves host I/O idle during core export, and single-worker execution in `run_payload_workers` lacked panic-catching parity with threaded workers. What: Before: `core_engram` resolved each table and shard plane sequentially, `materialize` / `materialize_payload_spans` / `materialize_span` wrote unbuffered staged files without unlinking failed flushes or checking multi-span byte-total overflow, `estimated_export_fds` omitted concurrent Engram worker descriptors, and `install_phase_payloads` / `install_cache_phase_payloads` duplicated worker loops. After: `helios::core::export::run_payload_workers` schedules up to eight workers largest-first with `catch_unwind` parity across both single-worker (`workers == 1`) and multi-worker paths. `core_engram` resolves planes concurrently—sharing the bounded read-ahead digest pool for single-file ranges, stream-hashing multi-file planes through 4 MiB buffers, and eagerly taking newly opened cache objects into `leases` by digest in declaration order without retaining duplicate descriptors—while cleaning up staged sibling files on failure and accounting for worker FDs in `estimated_export_fds`. `materialize_payload_spans` (with checked `u64` byte-total accumulation) and `materialize_span` delegate to `materialize_pieces`, replacing `fn materialize`. Existing signed runtime cores and wire schemas remain unchanged. Result: Engram payload resolution overlaps host reads and hashing across up to eight workers while preserving deterministic manifest order, deduplicated cache leases, and staging cleanup on error or panic. Live multi-host GPU export and 188.8 GiB Engram timing and RSS/page-cache measurements have not yet been run on this revision. Evidence: - `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib core::`: 484 passed, 11 ignored, 0 failed. - `cargo test --locked --release --manifest-path heliopause/Cargo.toml --lib`: 211 passed, 5 ignored, 0 failed. - `pytest -q -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py`: 22 passed. - Multi-host Spark TP4 188.8 GiB Engram export timing, RSS/page-cache headroom, and Windows native export remain unverified on this revision. Discord: Dooner Design-Signed-Off-By: Antigravity (Gemini 4); design-review=c3a9 Signed-off-by: FujitsuPolycom <[email protected]>
e43b256 to
daba5bf
Compare
|
@voipmonitor Addressed at
Could you take another look at |
Why
Core export must resolve every host-resident Engram weight and scale plane declared by a prepared model. Resolving independent planes in sequence leaves host storage idle during assembly, and single-worker fallback in payload worker scheduling lacked the
catch_unwindcleanup guarantee used by threaded workers.What changed
helios/src/core/export.rs:install_phase_payloadsandinstall_cache_phase_payloadsmaintained separate worker loops, and single-worker execution did not share threadedcatch_unwindhandling.run_payload_workersschedules up to eight workers (MAX_PAYLOAD_INSTALL_WORKERS) largest-first withcatch_unwindparity across both single-worker (workers == 1) and multi-worker paths, halting new items on the first error, panic, or thread-spawn failure and returning results in declared order.heliopause/src/export/core.rs&docs/runtime-core-design.md:core_engramresolved each shared or partitioned plane sequentially;materialize,materialize_payload_spans, andmaterialize_spanwrote unbuffered staged files without unlinking failed flushes or checking multi-spanu64byte-total overflow; andestimated_export_fdsomitted concurrent Engram assembly descriptors.core_engramresolves planes concurrently across up to eight workers: single-file planes pin their checkpoint range and share the process-wide read-ahead digest pool (bounded to sixteen concurrent digests / 1 GiB across workers), multi-file planes stream-hash pieces through 4 MiB buffers (ring::digest::SHA256) to reuse verified cache objects or materialize uncached planes, and newly openedPayloadObjecthandles are eagerly.take()n intoleasesby digest in declaration order so duplicate cache descriptors close immediately rather than surviving untilcore_engramreturns. Worker failures or panics unlink staged sibling.payloadfiles, andestimated_export_fdsbudgets concurrent worker descriptors.materialize_payload_spans(with checkedu64byte-total accumulation returning an explicit overflow error) andmaterialize_spanalso migrate tomaterialize_pieces(4 MiBBufWriter,sync_all(), and staged-file removal on error), replacingfn materialize. Skipping standalone digests andfsyncon disposable cubin and graph spans is split into heliopause: skip digest and fsync on disposable export spans #587.Claimed benefit and result
Supporting evidence and limitations
Tested at candidate commit
daba5bfc92576bbaff8bb9468f3b29dc590287a7onmain(ba3afb13a7e9836080c23eadf8e1c17ee96e6e7a) in non-root Linux (uid=1000):cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib core::: 484 passed, 11 ignored, 0 failed.cargo test --locked --release --manifest-path heliopause/Cargo.toml --lib: 211 passed, 5 ignored, 0 failed (0 compiler warnings). Covers fragmented-cache reuse, digest-coalesced leases without retained duplicate descriptors,u64byte-total overflow rejection before staging inmaterialize_payload_spans, descriptor preflight accounting, single-worker panic conversion, and/dev/fullENOSPCsibling cleanup inmod payload_export_tests.pytest -q -rs tests/preparation/test_core_boundary.py tests/test_design_review_hook.py: 22 passed.ba3afb13a7e9836080c23eadf8e1c17ee96e6e7a.docs/runtime-core-design.mdandmod payload_export_testsmerge without conflict; whichever PR lands second resolves a single hunk infn materialize_span(heliopause/src/export/core.rs) by retaining heliopause: skip digest and fsync on disposable export spans #587's no-digest/no-fsyncBufWritercopy alongside heliopause, helios: parallelize Engram plane assembly in core export #586'smaterialize_piecesandfn materializeremoval (verified together at 484 passed inhelioscore::and 212 passed, 0 warnings inheliopause).Discord: Dooner