Project

General

Profile

Emulator Issues #11717

Frequent JIT cache flushing in some games on AArch64

Added by Techjar over 1 year ago. Updated 4 months ago.

Status:
Accepted
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:

Description

Game Name?

All Metroid Prime games
Donkey Kong Country Returns
True Crime: New York
Various other titles I don't remember

What's the problem? Describe what went wrong.

I'm making this issue as a way to encompass all the issue reports of game stuttering that are due to this, as well as have it properly documented for prospective devs.

Some games invalidate icache a lot which causes the JIT cache to fill up very quickly, resulting in frequent flushes which manifest as a very noticeable hitch in gameplay. This is due to our naive block allocator that simply places new blocks at the end of the buffer, and never reuses space from invalidated blocks until the cache is completely cleared. True Crime: New York is a particularly egregious offender, invalidating icache so much that the JIT cache is cleared every 2 seconds, making the game nearly unplayable. Even throwing that out as an outlier, many other titles experience stutters every few minutes that, while not making the game unplayable, are rather annoying and detract from the enjoyment.

What steps will reproduce the problem?

Play any of the listed games for some amount of time.

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, 5.0-10151

Is the issue present in the latest stable version?

Presumably yes. The JIT cache has not changed in years, though it's slightly worse in dev builds due to some JIT changes generating more code.

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, been an issue since the dawn of time.

What are your PC specifications? (CPU, GPU, Operating System, more)

4.5GHz CPU Processor
24-bit Accelerated Video Graphics
Modern Operating System

Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)

Nope, but I will say that fixing this issue won't be easy. It's most likely going to require some pretty big changes to the whole JIT.


Related issues

Has duplicate Emulator - Emulator Issues #11998: Virtual Console Zelda OOT and MM StutterDuplicate

Has duplicate Emulator - Emulator Issues #11716: Donkey Kong Country Returns major stuttersDuplicate

Has duplicate Emulator - Emulator Issues #10014: Harry Potter: PoA freeze completely for several secondsDuplicate

History

#1 Updated by markwest76 over 1 year ago

Do you think this issue could be a duplicate of issue #11693 ?

#2 Updated by Techjar over 1 year ago

Yeah that's another game that experiences JIT flushing. Though, it would be an duplicate of this one, as this is meant to be the single place to document all the JIT flushing cases.

#3 Updated by markwest76 over 1 year ago

So you can confirm that 5-0-8007 is stutter-free with all the mentioned games?

#4 Updated by Techjar over 1 year ago

No, as stated older builds just stutter a bit less frequently. Why you experience "no" stuttering on that build we cannot explain, nor reproduce.

#5 Updated by markwest76 about 1 year ago

Another game massively affected by this stuttering plague is Prince of Persia Forgotten Sands...

#6 Updated by markwest76 12 months ago

I suggest to check if 5.0-11318 has fixed this issue...

#7 Updated by Techjar 12 months ago

It has not, only made the interval between flushes a bit longer depending on the game.

#8 Updated by flacs 12 months ago

Try 5.0-11590 (the PDEP issue fix, just in case someone has a Zen CPU) and compare it with 5.0-11537 (last build before double-to-float conversions were de-inlined).

#9 Updated by Techjar 12 months ago

That one probably also helps increase the interval further, but we still don't have a proper solution to more or less eliminate the flushing.

#10 Updated by JosJuice 5 months ago

#11 Updated by JosJuice 5 months ago

#12 Updated by JosJuice 5 months ago

#13 Updated by Techjar 5 months ago

5.0-12575 has significantly improved this issue. There are still problematic outliers, such as True Crime: New York, but for many games this issue is now practically non-existent. I wouldn't called it "fixed" yet, but it's a huge step forward.

https://dolphin-emu.org/download/dev/a31c204ca8784397928e75624e89e0ae6b733cc9/

#14 Updated by JMC4789 4 months ago

  • Status changed from New to Fixed

I think we make an issue that details what is left to do down the line.

#15 Updated by JosJuice 4 months ago

  • Status changed from Fixed to Accepted
  • Subject changed from Frequent JIT cache flushing in some games to Frequent JIT cache flushing in some games on AArch64

5.0-12575 only applies to x64. Let's keep this open until we have the same fix on all platforms.

Also available in: Atom PDF