Skip to content

cpu/drcbex64.cpp: Directly dispatch memory accesses to specific handlers #13325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

cuavas
Copy link
Member

@cuavas cuavas commented Feb 3, 2025

At the urging of @galibert, this makes the x86-64 recompiler back-end dispatch memory accesses to specific handlers directly, avoiding one level of out-of-line function calls. From my testing on an Intel 8th generation i7, the performance improvement is measurable, but less than 5% at best.

I’d like people to test this with other x86-64 CPUs (e.g. AMD or different generations of Intel CPUs) to see what kind of difference it makes (if any).

If it does seem to produce a useful improvement, I can follow up by adding code to directly dispatch reads smaller than native width, and add scaffolding for carrying over the same optimisations to AArch64. If it doesn’t seem to be a worthwhile improvement, I’ll just move across the removal of the static address space accessors and ditch the recompiler changes.

@cuavas
Copy link
Member Author

cuavas commented Feb 3, 2025

@MooglyGuy if you could see if this yields improvements on your AMD CPU, I’d appreciate it.

@cuavas
Copy link
Member Author

cuavas commented Feb 3, 2025

I’ve updated this pull request to also inline reads smaller than native width. However, in my testing this actually hurts performance for pmac6100.

If/when people try this out, please test and benchmark the two commits separately. Only the first commit requires an emu.h rebuild – If you can check out the first commit, build, copy the binary, check out the second commit, and build again, the second build will only need to recompile src/devices/cpu/drcbex64.cpp.

@MooglyGuy
Copy link
Contributor

I'll have a look this coming weekend, just remind me.

emu/emumem_aspace.cpp: Got rid of static accessors structure, added a
helper for obtaining info for dispatching specific accessors.

cpu/drcbex64.cpp: Directly dispatch specific memory accessors for native
width reads and writes no larger than native width.
@cuavas
Copy link
Member Author

cuavas commented Feb 4, 2025

I sorted out the performance issues with my initial implementation of reads smaller than the native width. I’m pretty confident this is a modest but useful improvement now.

@cuavas cuavas marked this pull request as ready for review February 4, 2025 23:17
@cuavas cuavas merged commit b7a80b1 into mamedev:master Feb 4, 2025
5 checks passed
@cuavas cuavas deleted the drcspecific branch February 5, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants