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

x64 JIT recompiler #490

Merged
merged 22 commits into from Aug 10, 2019

Conversation

@RSDuck
Copy link
Collaborator

commented Jul 14, 2019

feel free to request any changes.

@MojoJojoDojo

This comment has been minimized.

Copy link

commented Jul 15, 2019

Tried this on Linux.
I got crashes in a couple of games (Pokemon BW2 and Mega Man Star Force 3) that I dont get without JIT.
I hope i compiled it correctly - I have enabled JIT recompiler and the number was 10.

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 15, 2019

I tried Pokemon White 2 myself (though admitedly only early game) and I didn't experience a crash.
Can you try compiling a debug build, there might be an assertion which failed. A save state would also be great and a log.

@MojoJojoDojo

This comment has been minimized.

Copy link

commented Jul 15, 2019

Hmm it does not crash while in debug.
Here is a save state and a save that i created in release :
saves.zip

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 15, 2019

can you reproduce the crash using the save state?

EDIT: I couldn't reproduce using your save state neither on Windows nor on Linux both debug and release build

@MojoJojoDojo

This comment has been minimized.

Copy link

commented Jul 15, 2019

I guess i compiled it wrong?
I added -DJIT_ENABLED=ON after cmake.
Sorry if i did.

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 15, 2019

I guess i compiled it wrong?
I added -DJIT_ENABLED=ON after cmake.
Sorry if i did.

You did everything right if the JIT can be enabled in the emulator settings. The pity thing about those dynarecs is that they're quite nondeterministic, which can make reproducing bug quite challenging. Anyway, keep reporting those issues, one fix somewhere else might also fix this. I'm currently hunting down a bug in how wants to be a millionaire.

@MojoJojoDojo

This comment has been minimized.

Copy link

commented Jul 15, 2019

Forgot to tell you how to reproduce the crashes.
On Star Force 3 it happens after i get into battle.
On Pokemon its when I exit/enter between places - from a small place like a pokemon center to a big one for example.
I will report here if i got more issues.
Thanks.

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 15, 2019

now I got it reproduced, thanks

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 15, 2019

I think, Pokemon is fixed now. It was quite a severe bug, hopefully this fixes Mega Man too.

@MojoJojoDojo

This comment has been minimized.

Copy link

commented Jul 15, 2019

Thanks now everything works correctly.
BTW I dont know if it's related or not but even with JIT Mortal Kombat is still very slow (half speed - 30 fps).
It's even kinda slowish on other emulators.
I wonder if this game was just badly programmed or something.

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 15, 2019

BTW I dont know if it's related or not but even with JIT Mortal Kombat is still very slow (half speed - 30 fps).
It's even kinda slowish on other emulators.
I wonder if this game was just badly programmed or something.

yes, that game is known to cause problems.

@cascardian

This comment has been minimized.

Copy link

commented Jul 15, 2019

Awesome work!

I have a question: Is there a reliable way to make the JIT detect the best block size automatically and continuously?

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 15, 2019

I have a question: Is there a reliable way to make the JIT detect the best block size automatically and continuously?

Unfortunately only by having some kind of database, so no. Guessing from experience with the JIT of Desmume the best performance/compatibility comes at around 8-12 instructions per block.

@MojoJojoDojo

This comment has been minimized.

Copy link

commented Jul 16, 2019

If you boot a game non-directly (from the menu) the game would crash the second time onward.
The game was Star Force 3.

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 16, 2019

the last commit should fix the bios menu. There's a weird thing where it takes a bit longer to load the menu when the block size is high(somewhere about >16), there's probably nothing which can be done. Afaik Desmume even automatically reduces the block size to 12 or something while executing the bios, though in this case the bios eventually even boots, so we're still better off.

@MojoJojoDojo

This comment has been minimized.

Copy link

commented Jul 17, 2019

Now I need to see how this affects online play with console players using Altwfc/Wiimmfi.
I assume this being non-deterministic will cause desync issues when playing online.
Thank you for your fixes.

@MojoJojoDojo

This comment has been minimized.

Copy link

commented Jul 18, 2019

Well I played online with someone so far so good no desyncs or bugs or anything.
I hope this gonna get merged soon because i still use 0.8.1 with the branch lol.

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 18, 2019

I'm glad to hear that. It'll be likely included in the next release, together with some other things which are still being worked on.

@RSDuck RSDuck force-pushed the RSDuck:jit-redo branch from 35329ad to 3025314 Jul 21, 2019

@poudink

This comment has been minimized.

Copy link

commented Jul 26, 2019

very excited to try this out. my PC is trash and since my graphic card is AMD the hardware renderer didn't give me quite the boost I'd hoped for. maybe this will finally give me a more consistent framerate.

@RSDuck

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 28, 2019

just for documentary purposes, this:

the last commit should fix the bios menu. There's a weird thing where it takes a bit longer to load the menu when the block size is high(somewhere about >16), there's probably nothing which can be done. Afaik Desmume even automatically reduces the block size to 12 or something while executing the bios, though in this case the bios eventually even boots, so we're still better off.

turned out to be wrong. Instead it was a tiny bug sitting much deeper inside melonDS, which previously didn't come into effect, and also explains why the weird bug only happened the first time the bios is booted. It was fixed with this commit: 657e8a1

@RSDuck RSDuck changed the base branch from master to generic_jit Aug 10, 2019

@Arisotura Arisotura merged commit b7bf59f into Arisotura:generic_jit Aug 10, 2019

@RSDuck RSDuck deleted the RSDuck:jit-redo branch Aug 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.