Project

General

Profile

Emulator Issues #11173

Rounding differences in SM64 (VC) (JIT bug)

Added by Thestickman391 over 1 year ago. Updated over 1 year ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:
5.0-8009

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

NAAE01-1.png (154 KB) NAAE01-1.png JMC4789, 05/28/2018 08:53 AM
DolphinWx_FallbackIFSinglestfXXX.7z (4.23 MB) DolphinWx_FallbackIFSinglestfXXX.7z JMC4789, 05/29/2018 12:25 PM
6804

History

#1 Updated by JMC4789 over 1 year ago

  • Status changed from New to Accepted
  • Subject changed from Rounding difference in SM64 to Rounding differences in SM64 (VC)

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.

#2 Updated by JMC4789 over 1 year 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.

#3 Updated by JMC4789 over 1 year ago

6804

After about 30 minutes (running at 150 - 200% speed) with this setting this is as low as it goes.

#4 Updated by Thestickman391 over 1 year 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?

#5 Updated by JMC4789 over 1 year 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.

#6 Updated by Thestickman391 over 1 year 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.

#7 Updated by degasus over 1 year 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...

#8 Updated by Thestickman391 over 1 year 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.

#9 Updated by degasus over 1 year 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?

#10 Updated by Thestickman391 over 1 year ago

Sure, I will test that tomorrow as I am going to go to bed now.

#11 Updated by Thestickman391 over 1 year 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!

#12 Updated by JMC4789 over 1 year 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.

#13 Updated by Thestickman391 over 1 year 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.

#14 Updated by JMC4789 over 1 year ago

Are you activating the Debug Menu in Configuration/Interface, booting the game, pausing, and disabling JIT Floating Point or JIT FloatingPoint Loadstore?

#15 Updated by Thestickman391 over 1 year ago

Yep, thats what I've been doing.

#16 Updated by JMC4789 over 1 year ago

I'll double check to make sure it's still happening for me in latest master.

#17 Updated by JMC4789 over 1 year ago

The GUI is broken - none of the fallbacks are activating for some reason.

#18 Updated by Thestickman391 over 1 year ago

I'm glad it's not just me!

#19 Updated by JMC4789 over 1 year ago

Try starting the game, Disabling JIT FloatingPoint and then closing the game and restarting it. That seems to have fixed it.

#20 Updated by Thestickman391 over 1 year ago

Still doesn't work for me

#21 Updated by JMC4789 over 1 year ago

Is it hurting your performance at least? Your performance should go down if the option is working.

#22 Updated by Thestickman391 over 1 year 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.

#23 Updated by JMC4789 over 1 year 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.

#24 Updated by Thestickman391 over 1 year ago

I tried running it unlimited and I still couldn't see any difference and my FPS sits at around the same point.

#25 Updated by JMC4789 over 1 year 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?

#26 Updated by Thestickman391 over 1 year 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.

#27 Updated by JMC4789 over 1 year ago

Alright, I'll try to sort this out. Sorry for the inconvenience :(

#28 Updated by JMC4789 over 1 year 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.

#29 Updated by JMC4789 over 1 year ago

I made a build that should fix it for you, but, it's just a fallback to interpreter, not a full fix.

#30 Updated by JMC4789 over 1 year 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)

#31 Updated by Thestickman391 over 1 year 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.

#32 Updated by JMC4789 over 1 year 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.

#33 Updated by JMC4789 over 1 year 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.

#34 Updated by JMC4789 over 1 year 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.

#35 Updated by Thestickman391 over 1 year 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.

#36 Updated by JMC4789 over 1 year ago

  • Status changed from Work started to Fix pending

#37 Updated by Craftyawesome over 1 year 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.

#38 Updated by JMC4789 over 1 year ago

Can you explain what you mean by it not matching console exactly?

#39 Updated by Craftyawesome over 1 year 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.

#40 Updated by JMC4789 over 1 year 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.

#41 Updated by JMC4789 over 1 year ago

  • Fixed in set to 5.0-8009
  • Status changed from Fix pending to Fixed

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

Also available in: Atom PDF