Repository navigation
helios: parallelize engram loading and report startup progress - #696
malventano wants to merge 1 commit into
Conversation
Why: Engram preparation on the four-rank test system took 37.7s, including serial rank loading and a second page-table population pass after remapping the sealed memfd. This change brings the engram path closer to the existing weight-loading throughput. What: - Load the independent engram rank shards concurrently and join them in group order so the resulting bindings are deterministic. - Keep the populated read-only memfd mapping, seal it with F_SEAL_FUTURE_WRITE, and avoid the remap and MADV_POPULATE_READ pass. - Request MADV_HUGEPAGE on the writable shmem mapping. The hint is optional and hosts with shmem THP disabled retain 4 KiB backing. - Report resident bytes and x / y GiB on each 10s engram progress tick, then report the resident size on completion. - Print a final wall-clock Startup complete line after the server is ready. Result: On the test system, engram preparation fell from 37.7s to 9.6s in the clean state, a 28.1s and 3.9x improvement. Total startup fell from 66.7s to 38.4s, a 28.3s and 1.74x improvement. A fragmented first THP boot measured 13.7s while the kernel compacted; subsequent clean starts reached 9.6s. Evidence: - 18 engram reader tests passed. - 3 startup observation tests passed. - cargo check passed for helios, flare, and flare-cli. - The full test suite was not run. - Performance was measured on a four-SM120 system with a three-drive Gen4 NVMe RAID0 XFS volume. The results are sequential build measurements, not an isolated A/B for every stage. Limits: - THP depends on system shmem THP policy; advise is required for the hint to take effect. - F_SEAL_FUTURE_WRITE requires Linux 5.1+. The resident shared-mapping path already uses MADV_POPULATE_READ on Linux 5.14, so this does not raise the existing minimum. - No DiskReader, io_uring, row-cache, or NVMe read-path changes. Design-Signed-Off-By: DSV4.1-Flash-1017; design-review=2e5b Signed-off-by: malventano <malventano@users.noreply.github.com>
|
A case file has been opened for 696. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe core optimizations—loading independent Engram shard groups concurrently and retaining the populated Linux memfd via
Walkthrough
Merge Risk: Medium · up to
|
Scope: RAM Engram startup loading and startup logging.
Why
Achieve SSD bandwidth parity between engram loads and the already fast weight loading. The weight path loads 293.9 GiB in 15.3s; Engram loads 188.8 GiB serially in 37.7s.
What
mprotect(PROT_READ), and seal it withF_SEAL_FUTURE_WRITE. This avoids the remap and second page-table population pass.MADV_HUGEPAGEbefore filling. This reduces page-table and allocation work when shmem THP is available. Withshmem_enabled=neverit is a no-op and the tables remain 4 KiB-backed.Startup complete. 38.4sline after the server is ready.Results
Measured on a system with four SM120 GPUs and a three-drive Gen4 NVMe RAID0 XFS volume.
Total startup:
The 9.6s result is the clean/defragmented state. A clean boot or freshly defragmented system should see 9.6s on its first THP load. A fragmented system may first land at 13.7s while the kernel compacts, then reach 9.6s on the next start.
Both phases report size on each 10s progress tick:
A load shorter than 10s has no intermediate tick and reports only its final line.
Logging
These are small quality-of-life changes:
x / y GiBon each 10s tick.Evidence
Code paths:
helios/src/runtime_core/model.rshelios/src/engram.rshelios/src/engram/reader.rshelios/src/startup.rsflare-cli/src/main.rsflare/src/controller.rsDocumentation:
docs/FLARE_START.mddocs/FLARE_PATCH_SERIES.mdTests:
cargo checkpassed.Future work
The resident reader uses synchronous 4 MiB
preadcalls. io_uring could reduce host submission overhead further, but this path is large sequential reads with low SSD IOPS, so this PR keeps the minimal change.Limits
adviseis required for the hint to take effect.F_SEAL_FUTURE_WRITErequires Linux 5.1+. The resident shared-mapping path already usesMADV_POPULATE_READon Linux 5.14, so this does not raise the existing minimum.DiskReader, io_uring, row-cache, or NVMe read-path changes.Preflight
mainatcc0a49d2.Discord: malventano