Skip to content

feat(relinker): lower MCOMMIT and RDPRU for Intel with execution tests - #2780

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
SuarezPM:ai/relinker-hardening
Oct 20, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
SuarezPM:ai/relinker-hardening

Conversation

@SuarezPM

@SuarezPM SuarezPM commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

What

Narrowed per 19 Oct review: only the Intel lowering with its execution tests, rebased onto current main (eaa5c9238). The symbol-index and fuzz parts from the previous head are dropped: main already covers the hashed export provider map, and the matcher has been restructured since.

  • MCOMMIT lowers in place to STC plus NOP padding via _inPlace, preserving instruction length. RDPRU lowers through an out-of-line stub that frames the red zone with the existing LeaRspBelowRedZone/LeaRspRestore spills and dispatches ECX: selectors 0/1 (AMD APM Vol. 3 MPERF/APERF, unreadable on Intel hosts) return the host TSC as a disclosed monotonic-counter approximation (ratio always 1.0); other selectors yield zero EDX:EAX. LOCK-prefixed MCOMMIT/RDPRU stay Unsupported. Sequences containing either instruction lower through _emitOutOfLine with the same wait-state check.
  • docs/dev/debt/relinker.md replaces the does not lower RDPRU/MCOMMIT entry with the lowering description and its unverified assumptions (TSC-for-MPERF/APERF substitution, non-zero selectors, any console path reporting MCOMMIT CF=0).

Tested

$ cmake -S . -B build-relinker -G Ninja -DCMAKE_BUILD_TYPE=Release -DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON
-- Configuring done -- Generating done

$ cmake --build build-relinker --parallel
[250/250] Linking CXX executable tests/amd64_only_converter_tests

$ ctest --test-dir build-relinker --output-on-failure
100% tests passed out of 218 (amd64_only_converter passed, incl. rdpruExecution/mcommitExecution)

$ python3 tools/check_conventions.py --base origin/main
All conventions checks passed.

Host: Linux x86-64 (CachyOS), Ryzen 5 3600, RTX 2060 Super. Execution tests ran on this host. Full Linux/Windows builds need the maintainer manual build.yml run for PR 2780.

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 (relinker-only change, no AGC/shader recompiler/VideoOut)
  • AI-assisted: yes

@github-actions github-actions Bot added the intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main label Oct 10, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

@github-actions github-actions Bot closed this Oct 10, 2026
@oneandonlydean oneandonlydean removed the intake paused Closed while PR intake is limited to authors with at least 10 PRs merged into main label Oct 17, 2026
@oneandonlydean oneandonlydean self-assigned this Oct 17, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 7918 core/relinker/codegen/tests/Amd64OnlyConverterTests.cpp L1809-1810

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/relinker.md
PR 6977 docs/dev/debt/relinker.md
PR 7822 docs/dev/debt/relinker.md

@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks for reopening this. It no longer merges cleanly into current main. Could you rebase onto current main? The MCOMMIT/RDPRU lowering part overlaps #2771, which is open for the same instructions, so it would help to split this into separate PRs (symbol index, fuzz test, Intel lowering) and leave the lowering to whichever of the two lands first. We'll review and run full CI on the new heads.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@SuarezPM A correction to our 17 Oct comment: #2771 isn't open. It was closed without merging, so main still returns unsupported for MCOMMIT/RDPRU, and the lowering in this PR is still wanted.

Since then, main has also covered most of the symbol-index part (GuestModuleBuilder keeps the export type in its hashed provider map), and Amd64OnlyInstructionMatcher has been restructured. So the request is narrower now: could you rebase just the Intel lowering, with its execution tests, onto current main? We'll check MCOMMIT's flag result against the APM in review (this PR sets CF, #2771 cleared it), then run full CI.

MCOMMIT becomes STC plus NOP padding and RDPRU goes through a
runtime-checked stub returning the host TSC for MPERF/APERF while
other selectors yield zero, with converter and execution tests.

docs/dev/debt/relinker.md records the new lowering and its unverified
assumptions.
@SuarezPM
SuarezPM force-pushed the ai/relinker-hardening branch from fcf38be to bf47697 Compare October 19, 2026 22:20
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 19, 2026
@SuarezPM SuarezPM changed the title feat(relinker): symbol index, throw-not-crash fuzz, Intel lowering with execution tests feat(relinker): lower MCOMMIT and RDPRU for Intel with execution tests Oct 19, 2026
@SuarezPM

Copy link
Copy Markdown
Contributor Author

Rebased to current main as requested 19 Oct, narrowed to just the Intel lowering with its execution tests.

@oneandonlydean
oneandonlydean merged commit d85b7c7 into boykopovar:main Oct 20, 2026
6 checks passed
@SuarezPM
SuarezPM deleted the ai/relinker-hardening branch October 23, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants