Skip to content
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

Mitigate performance impact of respecting FP bit #136

Merged
merged 1 commit into from
Jan 26, 2025

Conversation

mihaip
Copy link
Contributor

@mihaip mihaip commented Jan 22, 2025

In #135 we switched from a static OpcodeGrabber table to a curOpcodeGrabber pointer in ppc_main_opcode. This results in an extra indirection (as far as generated assembly having an additional load), which reduces execution speed.

Switch to making the opcode grabber into a parameter to ppc_main_opcode, and make ppc_exec_inner keep it up to date (via an EXEF_OPCODE exception flag).

Also fixes FPU instructions in ppctests - we now need to set the FP MSR bit when initializing the CPU.

Copy link
Collaborator

@maximumspatium maximumspatium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial MSR state is CPU dependent. We need to account for that.

@mihaip mihaip force-pushed the upstream-nofpu-perf branch from 41d2344 to 30258b6 Compare January 26, 2025 01:57
In dingusdev#135 we switched from a static OpcodeGrabber table to a
curOpcodeGrabber pointer in ppc_main_opcode. This results in an extra
indirection (as far as generated assembly having an additional load),
which reduces execution speed.

Switch to making the opcode grabber into a parameter to
ppc_main_opcode, and make ppc_exec_inner keep it up to date (via an
EXEF_OPCODE exception flag).

Also fixes FPU instructions in ppctests - we now need to set the FP
MSR bit when initializing the CPU.
@mihaip mihaip force-pushed the upstream-nofpu-perf branch from 30258b6 to 134339a Compare January 26, 2025 01:59
@mihaip
Copy link
Contributor Author

mihaip commented Jan 26, 2025

@maximumspatium OK, redid this to not make any assumptions about the initial state of the MSR field. Also fixed ppctests.

@dingusdev dingusdev merged commit 1a7ccce into dingusdev:master Jan 26, 2025
5 checks passed
mihaip added a commit to mihaip/pearpc that referenced this pull request Jan 27, 2025
To make them throw NO_FPU exceptions when the MSR FP bit is not set,
we switch between two different opcode tables (using the same approach
as dingusdev/dingusppc#135 and dingusdev/dingusppc#136)

Should be a no-op to a slight regression in the benchmark (since it has
no FPU instructions and there's the slight overhead of checking for
MSR changes), but instead it goes from ~442.5 to 460 MiB/s. ¯\_(ツ)_/¯
@mihaip mihaip deleted the upstream-nofpu-perf branch January 28, 2025 06:40
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.

3 participants