Skip to content

test(relinker): convert all valid guest_none_relocations modules in one run per system - #15751

Open
savvaniss wants to merge 2 commits into
boykopovar:mainfrom
savvaniss:test/guest-none-relocations-cost
Open

savvaniss wants to merge 2 commits into
boykopovar:mainfrom
savvaniss:test/guest-none-relocations-cost

Conversation

@savvaniss

@savvaniss savvaniss commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What

This builds on #15526 by oneandonlydean, now on main, which split guest_none_relocations into plain and sce halves (guest_none_relocations and guest_none_relocations_sce, each with TIMEOUT 20). Before the split, the test timed out in 6 of 25 runs of the relinker (macos-latest, clang++, x86_64) job (median 18.89 s) and failed that job on pull requests that do not touch the relinker (#9889 in run 41793009302, #15712, #15715). The split stopped those timeouts. In the 17 latest runs of that job, the halves took a median 9.08 s and 9.19 s, and at most 13.02 s and 13.75 s (65% and 69% of the limit).

This PR keeps the split and cuts the work inside each half by three quarters. The time goes into starting processes: each half started the relinker 108 times. On that job the relinker is x86_64 under Rosetta while Python stays native, about 87 ms per start, and the conversions themselves take a few milliseconds.

Within each mode, the 28 valid modules are written into one sce_module directory as <case>.prx, and each output system converts them in one run (convert_modules). That is 27 relinker starts per half instead of 108. Each module's artifact then gets the same check_output, the same --load run on Linux x86_64 and the same dynamic-tag check as before. The invalid modules still convert one at a time through the unchanged convert, since each must fail with its own diagnostic and leave no output. A failing valid check now names its SCE variant, case and system. The test also checks that case names are unique, so two cases cannot share one module file.

Batching does not change what is checked:

  • For each system and SCE variant I converted every valid module both ways, alone and in the batch, under the same file name. All 168 guest artifacts are byte-identical, on both Linux and Windows. The modules export the same symbol but import nothing from each other, and GuestImageReader reads each image on its own.
  • I recorded every check of main's test and of this one, in each mode, as its system and expected values. The two sets are identical: 84 check_output calls, 30 dynamic-tag reads and 2 --load runs per half.

Other open PRs on this file:

The other TIMEOUT 20 relinker tests are not close in the same job. On 4 Nov, over 25 runs, the highest maxima were autorun_exit_status (8.41 s) and mulx_lowering (8.12 s), and every other one stayed under 6.2 s. They are not changed.

Tested

Relinker-only Release builds (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON) of this branch, which merges main 4180951e90. The machine is an Intel Core i7-14700K. In each pair, main's test and this one ran back to back against the same relinker binary:

Host, half main (108 relinker starts) This PR (27 starts)
Windows 11, WinLibs GCC 15.2, Python 3.15, plain 5.88, 6.28, 5.88, 5.90, 7.69 s 1.78, 2.03, 1.77, 1.82, 6.46 s
Same, sce 5.71, 6.07, 6.43, 15.23, 19.88 s 1.81, 1.95, 1.80, 2.06, 2.44 s
WSL Ubuntu x86_64, GCC 15.2, Python 3.14, plain 0.18 to 0.20 s (5 runs) 0.09 to 0.10 s
Same, sce 0.18 to 0.19 s (5 runs) 0.10 s

Other sessions loaded the Windows machine during the later pairs, which is where the 15.23 s, 19.88 s and 6.46 s runs come from.

  • On WSL Ubuntu the plain, sce and all modes pass, including the --load runs that dlopen the converted mixed and plt-mixed modules and call them. Those runs execute only on Linux x86_64.
  • On Windows, ctest -R passes guest_none_relocations in 2.50 s and guest_none_relocations_sce in 2.33 s. It also passes the tests that import helpers from this file: guest_relative_section_symbols, overlapping_relocations, duplicate_relocations, guest_own_tls_relocations, game_patches, annotate_guest_module and the six restricted_undefined_symbols_* tests.
  • Negative controls, each run on both halves of main's test and of this one, then restored:
    • Removing the Io::WriteU64(output, earlier->second + 16, addend) replacement from GuestImageReader.cpp fails all four runs on relative-repeated-1100. This PR reports (False, 'relative-repeated-1100', 'linux', ([(9472, 8, 4096)], [(9472, 8, 4352)])), and True for sce.
    • Making LinuxGuestModuleWriter.cpp emit DT_INIT_ARRAY for an empty init array fails all four runs with AssertionError: unsized-lifecycle.
  • Not run on macOS. On the x86_64 job, about 87 ms per start puts each half near 2.5 s, but this PR's own CI run will give the real time.
  • python3 tools/check_conventions.py --base origin/main passes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

…ne run per system

guest_none_relocations started the relinker 216 times, and on the macOS
x86_64 job each start under Rosetta costs about 80 ms, so the test ran
for 10.6 to 20.07 s against its 20 s limit and timed out in 6 of the
last 25 runs. The 28 valid modules of each SCE variant now share one
sce_module directory and one conversion per output system; the invalid
modules still convert one at a time. Every guest artifact is
byte-identical to the one a single-module conversion writes, and the
same checks run on each, so the test starts the relinker 54 times.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep main's plain and sce modes from boykopovar#15526 and batch the valid modules
within each mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant