loader: patch AMD-only instructions the host CPU lacks #1196
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1196
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1196/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@akar995 on GitHub · 2026-10-08 09:15 UTC · original
akar995:perf/patch-missing-amd-instructions→main· +41 −19 · 4 files · 2 commits · closed without mergingSummary
Without
--amd-cpu, AMD-only guest instructions run unpatched, and on an Intel host each execution raises #UD. Astro Bot runs SSE4a EXTRQ in hot loops: about 810,000 traps per second in Sky Garden. All of them go through the process-wide vectored exception handler lock, so the game's worker threads serialize behind it.--amd-cpu, and the patch is logged asHost CPU compatibility.--amd-cpuis unchanged.Results
Host CPU compatibility: eboot.bin patched (... EXTRQ: native=97, trapped=0, skipped=0 ...).Testing
Hardware and software:
5a880808Tests:
ctest -j 1on this branch against unmodified main5a880808on the same machine. main fails 12 of 53 tests here. They were compared one by one, and each fails with the same output on this branch (listed below).Game: Astro Bot (PPSA21567). On this machine, main renders at about 250 ms per frame and stays on the boot logos. So the stage-level effects described above were measured with this change as part of my larger local branch, not on main alone.
Tests that fail on both main and each branch, with the same output: kernel_file_system, save_data_memory, shader_recompiler_compute, graphics_pipeline_rasterization, texture_cache_layered_image, texture_cache_image_views, texture_cache_storage_sampled, compute_meta_clear_classification, texture_cache_image_overlap, texture_cache_htile_clear, buffer_cache_ranges (plus gpu_tiler, which the tiler shader PR "graphics: avoid vector spec-constant selects in tiler shaders" fixes).
AI use
I used Claude Code (Anthropic) to investigate, write and test these changes. I reviewed the diff and ran the tests above before submitting.
🤖 Generated with Claude Code
@coderabbitai[bot] on GitHub · 2026-10-08 09:17 UTC · original · edited 2026-10-08 10:01 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
4e765553-f5db-430c-8292-9b2c0bbc1708📥 Commits
Reviewing files that changed from the base of the PR and between
1b72db28f3and46b25d9040.📒 Files selected for processing (1)
src/loader/runtimeLinker.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.
📝 Walkthrough
Walkthrough
The instruction patcher adds a host-missing-only mode for AMD instruction selection and trap handling. The runtime linker enables AMD instruction patching when emulation is configured or when the host lacks SSE4A, RDPID, or CLWB. It passes host feature information and the missing-feature mode to the patcher. Patch totals and report labels now account for host-feature-driven patching. The
--amd-cpuhelp text describes this behavior.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
46b25Host-missing instructions are patched selectively, while sites that cannot be safely patched retain their trap behavior. No identified issue blocks merging.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@coderabbitai[bot] on GitHub · 2026-10-08 09:17 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
2b68f2eb-f2dc-4f35-9832-969d0efd98c4📥 Commits
Reviewing files that changed from the base of the PR and between
5a8808086aand1b72db28f3.📒 Files selected for processing (4)
src/loader/guestInstructionPatcher.cppsrc/loader/guestInstructionPatcher.hsrc/loader/runtimeLinker.cppsrc/main.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
@coderabbitai[bot] on GitHub · 2026-10-08 09:17 UTC · original · edited 2026-10-08 09:54 UTC
On
src/loader/runtimeLinker.cppline 1800 (outdated):🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Report unavailable function boundaries in host-missing mode.
When
patch_host_missingis true and function boundaries are unavailable,PatchGuestInstructionsreturns without patching. This condition suppresses the warning, and no later patch report appears. Includepatch_host_missingin the condition and label the warningHost CPU compatibility.✅ Addressed in commit
46b25d9@Nmzik on GitHub · 2026-10-08 15:40 UTC · original
thats why we need --amd-cpu patch. Otherwise we will patch each game even if it doesnt use any of these instructions (it takes some boot time)
Pull request closed