Emulator Issues #11173
closedRounding differences in SM64 (VC) (JIT bug)
0%
Description
Game Name?
Super Mario 64
Game ID? (right click the game in the game list, properties, info tab)
NAAE01
MD5 Hash? (right click the game in the game list, properties, info tab, MD5 Hash: Compute)
e3de41e7768b4bdafd1b4ed32729f52f
What's the problem? Describe what went wrong.
On actual Wii Virtual Console, a rounding error causes the rising platforms in BitfS to slowly rise up. (https://clips.twitch.tv/ImpossibleLittleSmoothieRedCoat). This is not present in Dolphin. This glitch is really useful as it could help us get past the pole with 0 A presses, however we can't TAS this because it isn't present in Dolphin.
What steps will reproduce the problem?
Wait for a while and the platforms will slowly rise up
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
Yes, it is present in the latest dev build (5.0-7826)
Is the issue present in the latest stable version?
Yes this is present in the latest stable version
If the issue isn't present in the latest stable version, which is the first broken version? (You can find the first broken version by bisecting. Windows users can use the tool https://forums.dolphin-emu.org/Thread-green-notice-development-thread-unofficial-dolphin-bisection-tool-for-finding-broken-builds and anyone who is building Dolphin on their own can use git bisect.)
N/A
If your issue is a graphical issue, please attach screenshots and record a three frame fifolog of the issue if possible. Screenshots showing what it is supposed to look like from either console or older builds of Dolphin will help too. For more information on how to use the fifoplayer, please check here: https://wiki.dolphin-emu.org/index.php?title=FifoPlayer
N/A
What are your PC specifications? (CPU, GPU, Operating System, more)
N/A
Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)
State in the spot
https://drive.google.com/open?id=1TPekMygZd-EQ9OXD9OShD7shpOX2M3xF
Files
Updated by JMC4789 over 6 years ago
- Subject changed from Rounding difference in SM64 to Rounding differences in SM64 (VC)
- Status changed from New to Accepted
I can confirm it doesn't really rise up, but, it'd be nice if we could narrow down what's changing on console. If we figure out what rounding is the problem, it becomes much, much, much easier to implement said behavior in Dolphin. It'd also be nice (albeit not very realistic) to see if it happens in interpreter.
Updated by JMC4789 over 6 years ago
- Subject changed from Rounding differences in SM64 (VC) to Rounding differences in SM64 (VC) (JIT bug)
If you use Dolphin's debug menu and fallback the Floating Point instructions the rise begins to function as it does on Wii.
Updated by JMC4789 over 6 years ago
- File NAAE01-1.png NAAE01-1.png added
After about 30 minutes (running at 150 - 200% speed) with this setting this is as low as it goes.
Updated by Thestickman391 over 6 years ago
Hi, thank you for replying. I've launched Dolphin in debug mode, however I can't seem to find anything relating to Floating Point instructions. Could you tell me where in the menus that option is located?
Updated by JMC4789 over 6 years ago
Go into Options/Configuration/Interface and turn on the debug GUI.
Then pause the game and click the JIT dropdown on the menu bar. I turned off Jit Loadstore floating and FloatingPoint.
If we figure out which instruction is the problem we could probably fix this in the JIT as well without needing this.
Updated by Thestickman391 over 6 years ago
Thanks, the correct one is JT Loadstore floating. On a semi-unreleated note, is there anyway to speed up dolphin faster than 200%? It would make TASing this a lot easier.
Updated by degasus over 6 years ago
the correct one is JT Loadstore floating
This one was highly unlikely. Maybe the quantizied load/store operations?
is there anyway to speed up dolphin faster than 200%?
There is an unlimited option at the top. Else, you need a faster CPU...
Updated by Thestickman391 over 6 years ago
Well, it started rising when I selected JT Loadstore floating, so I was just saying which one I thought it was. And thank you for pointing the unlimited setting out.
Updated by degasus over 6 years ago
I just wanted to highlight that this was unexpected and that it reduced the amound of possible issues a lot. As our JIT does some optimization based on loaded registers, may you try to test the opposite as well: Does it start to raise as well if you only select the FloatingPoint fallbacks?
Updated by Thestickman391 over 6 years ago
Sure, I will test that tomorrow as I am going to go to bed now.
Updated by Thestickman391 over 6 years ago
Okay, so I restarted Dolphin and tried to get the platform to raise and for some odd reason, now I can't get it to raise with any setting!
Updated by JMC4789 over 6 years ago
I can still get it to rise by pausing the game and disabling JIT FFloatingPoint or FloatingPoint Loadstore, so, not sure what changed for you.
Updated by Thestickman391 over 6 years ago
I've spent the last ~2 hours trying to raise the platform again. I've uninstalled and reinstalled dolphin multiple times, installed several different versions of Dolphin and with no luck! I can't for the life of me figure out why it won't work again. Any help you could give would be very much appreciated.
Updated by JMC4789 over 6 years ago
Are you activating the Debug Menu in Configuration/Interface, booting the game, pausing, and disabling JIT Floating Point or JIT FloatingPoint Loadstore?
Updated by JMC4789 over 6 years ago
I'll double check to make sure it's still happening for me in latest master.
Updated by JMC4789 over 6 years ago
The GUI is broken - none of the fallbacks are activating for some reason.
Updated by JMC4789 over 6 years ago
Try starting the game, Disabling JIT FloatingPoint and then closing the game and restarting it. That seems to have fixed it.
Updated by JMC4789 over 6 years ago
Is it hurting your performance at least? Your performance should go down if the option is working.
Updated by Thestickman391 over 6 years ago
Nope, doesn't seem to make a difference. If it makes a difference I am running the game at 200% speed and loading a save sate, but that shouldn't really affect anything.
Updated by JMC4789 over 6 years ago
Can you try running it unlimited and seeing what happens? On my i7-6700K, I go from 90 fps to ~83 fps when using JIT FloatingPoint. FloatingPoint Loadstore knocks me down even further.
Updated by Thestickman391 over 6 years ago
I tried running it unlimited and I still couldn't see any difference and my FPS sits at around the same point.
Updated by JMC4789 over 6 years ago
That means it's probably not activating.
Been testing more - I think it's Loadstore Floating that actually fixes it. Can you try running the game, activating the disable on that, closing the game, and reopening it and seeing if it starts rising?
Updated by Thestickman391 over 6 years ago
I'll do that in the morning, but for now I have to go as it's 11:35pm for me and I have to wake up early tomorrow.
Updated by JMC4789 over 6 years ago
Alright, I'll try to sort this out. Sorry for the inconvenience :(
Updated by JMC4789 over 6 years ago
Likely the ConvertDoubleToSingle function here: https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp#L115
This may be the cause of the problem.
Updated by JMC4789 over 6 years ago
I made a build that should fix it for you, but, it's just a fallback to interpreter, not a full fix.
Updated by JMC4789 over 6 years ago
The modification in that build if you want to do it yourself is to add the following at line 104 of JITLoadstoreFloating.cpp
FALLBACK_IF(single);
The chunk looks like this after the modification.
int accessSize = single ? 32 : 64;
FALLBACK_IF(single);
FALLBACK_IF(update && jo.memcheck && a == b);
if (single)
Updated by Thestickman391 over 6 years ago
Unbelievably this still doesn't work for me! At this point I feel like it's something on my computer because I've done seemingly everything to get it working.
Updated by JMC4789 over 6 years ago
Are you testing in the right area? I know this glitch doesn't occur in Lethal Lava Land, for instance. I can try making a more aggressive hack if you want.
Updated by JMC4789 over 6 years ago
Have you tried not using a savestate? The area is so close by I've been just running there myself. It's possible the bug got embedded into the savestate.
Updated by JMC4789 over 6 years ago
- Status changed from Accepted to Work started
By enabling a more accurate rounding feature (fixed, but not enabled in this PR https://github.com/dolphin-emu/dolphin/pull/7013) I can get Mario 64 working without requiring fallbacks. I did not use a savestate and instead walked to Bowser in the Fire Sea.
Updated by Thestickman391 over 6 years ago
I can confirm that I am testing in the right area and I didn't use a savestate this time but that platforms still wouldn't raise.
Updated by JMC4789 over 6 years ago
- Status changed from Work started to Fix pending
Can you try this pull request - https://buildbot.dolphin-emu.org/#builders/20/builds/2059
Updated by Craftyawesome over 6 years ago
The platforms definitely rise using that build
https://youtu.be/lfNfR9ktlEc (didn't process correctly?)
I don't know if it matches console exactly though.
Updated by JMC4789 over 6 years ago
Can you explain what you mean by it not matching console exactly?
Updated by Craftyawesome over 6 years ago
I don't know if it rises faster or slower than console
I also don't know if it is at all likely for dolphin to still be slightly wrong though.
Updated by JMC4789 over 6 years ago
Dolphin is very, very unlikely to be wrong on the timing of it. The formula I changed it to was hardware verified by phire. The old formula just didn't handle it because we thought no game would ever rely on the behavior.
If there are more bugs regarding this behavior, we'll happily look into it though, as edge-cases like these often expose unknown behaviors.
Updated by JMC4789 over 6 years ago
- Status changed from Fix pending to Fixed
- Fixed in set to 5.0-8009
Thanks for the report, the bug now works in Dolphin. Bring us home that 0x A Button run!
Fixed in https://dolphin-emu.org/download/dev/9b431807315028ca646cae70084466ae8ad5b022/ - 5.0-8009