Repository navigation
Description
Current status (after PR #108)
PR #108 merged as 92436c0; retained Phase A fresh ext4/XFS mmap fallocate; hosted Phase A vs Wild +6.3660% CI95 +5.2598..+7.1209; resolver cache rejected on four-core evidence (-1.4822% point) and is not in main; hard >=10% lower-CI gate remains unmet, so issue stays open; historical proposal/evidence below is retained for audit.
Context
The pinned Linux competition deletes the output path before every timed replay (ci/linux_linker_competition.py), so the frozen Clang final-link workload takes reld's fresh-file UnlinkAndReplace path rather than update-in-place. The locked LLVM llvmorg-22.1.8 corpus output is about 138 MiB on ext4 and currently takes the mmap path: crates/reld-core/src/fs.rs calls set_len and then MmapOptions::map_mut, with no preallocation or huge-page advice. The existing buffered-ext4 policy applies only at 256–512 MiB and must remain unchanged.
At origin/main 3dfc8fb1, five compilation-excluded, locked-corpus --no-fork --time diagnostic replays had these median spans:
| Span | Median |
|---|---|
| Link | 170.56 ms |
| Shutdown | 25.96 ms |
| Write output file | 77.87 ms |
| Write data to file | 61.68 ms |
Shutdown is not comparable to the default fork-mode competition wall because the child signals completion before destruction. Excluding it leaves an approximately 144.60 ms active diagnostic transaction, of which output writing is material. Separate CPU/allocator investigation confirms allocator work is not a top hotspot, so changing allocators is not the next optimization target.
Published v2 evidence is reld 249.555 ms versus pinned Wild 262.095 ms. Reaching a 10.0% lead requires reld at or below 235.886 ms: a 13.670 ms / 5.48% reduction from the published reld result.
Relevant upstream prior art is wild-linker/wild#2468, head e822b94a3a36a89015b634ef332a757fb13392a0, merged as 2efdc81847a3cc9d9a9f0d4f4afa3ab4d698edac. Its author reports prior-art ext4 fresh-output results of roughly 23% wall reduction from fallocate, roughly 8% from hugepage advice, and roughly 36% combined. Those are upstream results, not reld measurements.
Measured scope correction
The first local isolation run rejected automatic THP: on this fresh-ext4 workload, fallocate-only was beneficial while automatic MADV_HUGEPAGE regressed. The longer independent diagnostic used default fork mode, fresh absent output before every trial, corpus cwd, LANG=C/LC_ALL=C, no compilation, three warmup rounds, and 24 measured samples per contender in a seeded randomized balanced Williams order. The candidate was cd5a30 with explicit --no-madvise-huge-pages, so it exercises auto-fallocate only; no reld-only flag was passed to Wild.
| Variant | Median wall time |
|---|---|
| origin/main baseline | 134.004 ms |
| candidate, fallocate-only | 125.170 ms |
| pinned Wild 0.9.0 | 128.569 ms |
Candidate versus baseline improved by 6.592% (paired-bootstrap 95% CI 4.648%–8.651%). Candidate versus Wild improved only 2.643% (paired-bootstrap 95% CI 0.675%–3.986%); this does not meet the 10% target. Raw artifacts are /tmp/reld-107-wall-20260901T044304-1927309/ in the diagnostic environment. Baseline and candidate were two-run self-deterministic and raw-byte-identical (3a2654c7…353ff9e5); every timed output passed the exact native stdout/stderr/exit-code oracle. Wild was self-deterministic but has its own expected artifact hash.
The cgroup hierarchy was not delegated in that environment, so this diagnostic has no process-tree RSS conclusion. The supplied baseline/candidate source copies had no .git metadata; cd5a30 is the supplied candidate identity. This evidence evolves scope; it is not acceptance success.
Proposal
Two constrained, complementary changes are needed.
A. Fresh-output preallocation; THP opt-in only
- Add explicit enable/disable controls for output preallocation and huge-page advice.
- On Linux ext4/XFS fresh (
UnlinkAndReplace) effective mmap outputs, auto-enablefallocateonly. Keep automatic THP false. - Keep
--madvise-huge-pagesas explicit opt-in. It must fail clearly when mmap/setup/advice is unavailable or buffered mode was explicitly selected;--no-madvise-huge-pagesremains an explicit disable. - Automatic
fallocateis best-effort; explicit preallocation failure is clear. Keep update-in-place conservative, retain Btrfs/VFAT behavior and the 256–512 MiB buffered ext4 policy unchanged. - Carry settings through
CommonArgs,file_writer::OutputConfig, andfs::OutputOptions, with syscall/advice implementation Linux-gated. Reuse existingnixandmemmap2; add no dependencies.
B. Small, safe object-scoped relocation-resolution cache
- Add only if required to clear the remaining gap; the fallocate-only evidence shows it is required.
- Cache only successful, immutable
Resolutionvalues, keyed by the object-localSymbolIndexwhile relocating that object. Do not cache failures, and preserve failure diagnostics exactly. - No cache sharing across objects, debug emission, ordered table emission, or unrelated resolution consumers. Do not alter relocation ordering or output-writing semantics.
- Bound the cache's memory by the current object's symbol index domain/lifetime; measure entries, capacity/bytes, and peak memory/RSS in final evidence rather than assuming a memory win.
Acceptance criteria
- RED -> GREEN before implementation: parser/default/filesystem tests for both enable/disable controls; ext4/XFS fresh-mmap automatic policy
(fallocate=true, THP=false); explicit THP override; Btrfs/VFAT and 256–512 MiB buffered behavior; update-in-place suppression; invalid hugepage-plus-buffered behavior; and explicit-versus-automatic failure handling. - RED -> GREEN cache tests: repeated relocations of one object/local
SymbolIndexreuse the same successful immutable resolution; object boundaries cannot share entries; resolution errors are never cached and retain the unchanged diagnostic; debug/table paths are unaffected; cache memory is bounded and reported. - This is performance-only: no intended artifact change. Verify two-run self-determinism for both baseline and candidate, raw-byte identity to the pinned reld baseline and inherited Wild baseline where applicable, and the exact native stdout/stderr/exit-code oracle.
- Use default hook-free release builds; compilation excluded; the locked corpus and pinned linker revisions/toolchain; fresh missing output on ext4; default fork mode; process-tree RSS; and the same-run Williams design with at least 2 warmups and 12 measured samples.
- The final paired-bootstrap 95% CI lower bound must show reld at least 10.0% faster than pinned Wild, and there must be no statistically supported RSS regression. Do not weaken this gate.
- Read and follow the Linux, Windows, and macOS platform guides before changing shared
crates/reld-core, even though the new behavior is Linux-gated.
Decisions
- Priority remains P0: fallocate-only captures a credible 4.648%–8.651% baseline improvement, but cannot by itself close the Wild gap.
- THP is an opt-in diagnostic control, not an automatic default, because local fresh-ext4 evidence is negative.
- Scope remains intentionally narrow: preallocation affects only fresh mmap output setup; caching is object-local successful relocation resolution only. perf(elf): parallelize full-LTO section population #80's ordered relocation/table emission remains intact.
- No dependency change is in scope; use the repository's approved graph.
Activity
[-]perf(fs): preallocate fresh ext4/XFS mmap outputs and request THP[/-][+]perf(fs): preallocate fresh ext4/XFS mmap outputs; opt-in THP[/+]zackees commentedon Sep 1, 2026
Scope correction: automatic THP is rejected locally
The initial upstream-port scope auto-enabled both
fallocateandMADV_HUGEPAGEfor fresh ext4/XFS mmap outputs. Exact non-git baseline/candidate artifact and native-oracle gates passed, but preliminary fresh-ext4 default-fork isolation is negative for automatic THP.Interleaved diagnostic wall-time medians on the locked Clang final-link corpus were:
--no-fallocate-output-file)--no-madvise-huge-pages)This is diagnostic only: it has no cgroup process-tree RSS and is not the required 12-sample Williams/pinned-Wild acceptance run. It is nevertheless sufficient to reject making THP an automatic default on this host.
Revised implementation decision:
fallocatefor fresh ext4/XFS effective mmap outputs;--madvise-huge-pagesas an explicit opt-in with strict buffered/non-Linux/setup/advice errors;--no-madvise-huge-pages, explicit fallocate controls, Btrfs/VFAT behavior, and buffered-output policy unchanged.The focused RED-to-GREEN policy test now requires automatic ext4/XFS setup
(fallocate=true, THP=false)and proves explicit--madvise-huge-pagesoverrides that default.[-]perf(fs): preallocate fresh ext4/XFS mmap outputs; opt-in THP[/-][+]perf(elf): preallocate fresh outputs and cache relocation resolutions[/+]zackees commentedon Sep 1, 2026
The longer independent fallocate-only diagnostic changes the scope, not the acceptance bar.
With default fork mode, fresh absent output, frozen corpus cwd, no compilation, three warmup rounds, and 24 balanced/interleaved samples each, the candidate (
cd5a30 --no-madvise-huge-pages) measured 125.170 ms median versus 134.004 ms baseline and 128.569 ms pinned Wild. That is +6.592% versus baseline (paired-bootstrap 95% CI +4.648% to +8.651%), but only +2.643% versus Wild (95% CI +0.675% to +3.986%). It therefore does not approach the required 10% lower-bound gate.Baseline/candidate artifacts were two-run self-deterministic and raw-byte-identical; every timed result passed the native oracle. The cgroup hierarchy was not delegated, so this run makes no RSS claim. Raw evidence:
/tmp/reld-107-wall-20260901T044304-1927309/.Accordingly, automatic THP remains rejected locally: auto-enable only fresh ext4/XFS mmap
fallocate, keep THP explicit opt-in, and add the smallest safe object-local successful-relocation-resolution cache needed to close the remaining gap. The issue now explicitly requires cache isolation/error/diagnostic/memory tests and retains the final paired-bootstrap >=10%-faster-than-Wild lower-bound and no-RSS-regression gates unchanged.zackees commentedon Sep 1, 2026
Phase-B status update (all results are local diagnostics; the hosted acceptance gate remains unchanged).
13d4161465e65e635b01b54d6f9c8a5631fdf5b6is atop4743b9b0b09715271bd466e49cdcb6206429dfea. Frozen-Clang raw artifact identity and exact native oracle passed.The issue remains open. Its paired-bootstrap >=10% lower-CI versus Wild requirement and no statistically supported RSS regression requirement are unchanged. Next investigation is a bounded scheduling/group sweep.
zackees commentedon Sep 1, 2026
Authoritative hosted failure evidence from Linux linker competition run.
4ee5d137aa2405e66cd37a7bd8a564ee681b74e8; hosted merge-ref evidence:f6c424f8587bc5fee4715fcc1954f543630cc51d.Evidence SHA-256:
report.json:38b81167c92c5e22614097b7177f5e012eb1f83e65102f4f0c0a9f25c531f18fraw-samples.jsonl:e4a4f4d1f62b4812496a2c21229dd3f59f3fa2ca5db655d89f760698e86c180aprovenance.json:38cc1c868fc84c8e8bbb0580e80f05dfa25c356313524b32841f693dc646ddf7render/competition.png:f43f7fad7401bec1db99c0f462dd62e5f537ab98cf2cd9f580e99f8163501ce0The PR remains draft. Do not merge; do not close #107.
zackees commentedon Sep 1, 2026
Authoritative Phase-A-only hosted evidence: Linux linker competition run 33523506586, head
4743b9b0b09715271bd466e49cdcb6206429dfeaversus baseline3dfc8fb1c614485c82e8e59c17238b8c2411b0b8.The frozen LLVM/Clang final link ran on ext4 with 4 CPUs, default fork behavior, 12 balanced samples per contender, and cgroup-v2 process-tree RSS. Raw reld artifact identity and the native oracle passed.
Decision: fresh ext4/XFS mmap
fallocatepreallocation is retained and supported. The 512-slot resolver cache is rejected: the dedicated four-core 24-sample ablation was counterproductive by point estimate (Phase B vs Phase A -1.4822%, CI -4.7020%..+2.5056%). The hard >=10% Wild lower-CI gate still fails (Phase A lower bound: +5.2598%).The PR remains draft; do not merge or close #107.
[-]perf(elf): preallocate fresh outputs and cache relocation resolutions[/-][+]perf(elf): preallocate fresh outputs and close the Wild performance gap[/+]