Repository navigation
perf(relinker): single-pass CFG instruction decoding and zero-copy text span - #2304
Conversation
|
Could you give before/after conversion times for a real title's executable (title ID, |
|
@oneandonlydean these are the before/after conversion timings on a real commercial PS5 title using Test Environment & Workload
In-Title Benchmark Results (
|
| Metric | Baseline (main) |
This PR | Delta / Improvement |
|---|---|---|---|
| Wall-Clock Time (Cold) | 95.61 s (1m 35s) | 34.38 s | -61.23 s saved (2.78x faster) |
| Wall-Clock Time (Warm) | 91.45 s (1m 31s) | 23.19 s | -68.26 s saved (3.94x faster) |
| CPU User Time | 90.24 s | 30.39 s | -59.85 s CPU time eliminated |
| Output SHA256 | 1529b661... |
1529b661... |
100% Bit-for-Bit Identical |
Full Windows SHA256: 1529b661933beef7aa3fbb7c7c71f9e0faa038c34f4df224ff6b38fdf4de79df
2. Linux Conversion Target (unused-filter=2)
| Metric | Baseline (main) |
This PR | Delta / Improvement |
|---|---|---|---|
| Wall-Clock Time (Cold) | 30.91 s | 8.03 s | -22.88 s saved (3.85x faster) |
| Wall-Clock Time (Warm) | 30.22 s | 8.12 s | -22.10 s saved (3.72x faster) |
| CPU User Time | 28.83 s | 6.54 s | -22.29 s CPU time eliminated |
| Output SHA256 | e5033cf9... |
e5033cf9... |
100% Bit-for-Bit Identical |
Full Linux SHA256: e5033cf9904edc48b9ef45f09ca7ac14cbf6dfe6656c921681dd2
Summary
Because commercial game engines have deep vtable structures and address-taken indirect branches, unused-filter=2 runs multiple root discovery passes.
- Single-pass decoding and zero-copy spans drop conversion time from over 1.5 minutes down to ~23 seconds on Windows (-68 seconds saved per conversion).
- The resulting
.exeand.elffiles match the baseline byte-for-byte (sha256sum).
tell me if you would like me to update the PR description with these metrics
|
The PPSA15552 numbers answer the perf question. It now conflicts with main in |
4defe2c to
41856ea
Compare
|
Rebased onto current main as Dean asked: the conflict in |
What
Optimizes the CFG discovery fixed-point loop and PLT compaction in
core/relinker:std::vectordeep-copying of the.textsegment inCodeInstructionCollector::Collectwith a zero-copystd::span<const uint8_t>. Eliminates copying the full code segment into newly allocated vectors on every root-discovery iteration.decodedInstructionsandsectionReachable). Instructions are now decoded exactly once across the entire binary instead of re-disassembling previously visited blocks from scratch on every iteration (PltCompactor::CompactPlt, validates all 4 structural bytes of the canonical 16-byte PLT thunk (0xFF 0x25 ... 0x68 ... 0xE9) before querying slots, skipping non-PLT indirect jumps immediately. Switched slot tracking fromstd::maptostd::unordered_map.Tested
ctest --output-on-failure:strict_nid_filter(Passed)rela_bounds(Passed)to_intel_linux_stubs(Passed)guest_intel_trampolines(Passed)amd64_only_converter(Passed)tls_function_coverage(Passed)python3 tools/check_conventions.pypasses with zero warnings.sha256sumon multi-pass test binaries and a 40,000-function image; hashes matched 100% identically down to the byte:SHA256: e6a211ff0fb6c99933368b98910135f5617f6f4defdcbc78657ad43dd67de571Benchmark (Measured with
/usr/bin/time -v):Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)