• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 2 3 4 5 ... 116 Next »

Make Dolphin disable some cores for more performance
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Make Dolphin disable some cores for more performance
04-29-2022, 03:21 PM (This post was last modified: 04-29-2022, 03:41 PM by Leseratte10.)
#1
Leseratte10 Offline
Wiimmfi-Team
***
Posts: 55
Threads: 10
Joined: Apr 2019
I've seen a video that someone linked to on Reddit while playing Super Mario Galaxy (?) on the SteamDeck through Dolphin.

In the first part of the video he played with the default settings, and MangoHud displayed that each of the CPU cores was only using 20% of it's power (not too surprising, because Dolphin can only utilize like two cores properly). The CPU clock while doing so was around ~1950 MHz while he was doing that, and the game was stuttering.

Then he disabled a bunch of these CPU cores so the device only used 3 out of the 8 available ones, and that instantly made the CPU boost to ~3400 MHz, and the stuttering in the game was gone immediately.

The video can be found here: https://www.reddit.com/r/SteamDeck/comments/ue2vvt/this_plugin_makes_emulation_so_much_better/

Now I do not really know that much about CPU and cores and multithreading and whatever - does anyone have an explaination as to why this works, and if this could be built into Dolphin so it automatically does whatever this script does while a game is running? While it looks nice and easy in the GUI where he disables the additional cores this is actually a mod / hack for SteamOS that would need to be installed manually before it can be used.

Is this even useful / a good way what he's doing in the video, or would that have other disadvantages?

I'd assume that by default the OS tries to have each core doing about the same work, moving threads around on the available cores all the time? And if you manually disable a bunch of cores they'll be doing nothing, and the remaining cores (that actually run Dolphin) can boost to a higher frequency.

Can stuff like this be done per application? Could Dolphin communicate to the OS "Hey, only put my threads on CPUs 0, 1 and 2 so these can boost higher and I have more performance"? Or would Dolphin need to set these things for the whole system?

For standalone computers where you have a bunch of stuff other than Dolphin that's running, disabling a bunch of cores might not be ideal, but on a SteamDeck in gaming mode where in 99.9% of all cases you only have one single game running and nothing else - why not take that extra performance?
Find
Reply
04-29-2022, 09:15 PM (This post was last modified: 04-30-2022, 12:18 AM by MayImilae.)
#2
MayImilae Offline
Chronically Distracted
**********
Administrators
Posts: 4,599
Threads: 120
Joined: Mar 2011
So I'm a dolphin dev and Steam Deck owner. I've had the chance to get to know the little console a bit.

First of all, do not blindly trust that video. It is anecdotal. We don't know their Dolphin settings or their Steam Deck settings at all, and the only information present is what little we can gleam from a blown out screen and some audio. They could have used Dolphin's GPU Clock Override to radically change how Dolphin behaves. They even could have mapped Dolphin hotkeys to the backgrips or to a separate bluetooth controller to change Dolphin settings on command. We don't even know their Dolphin version, so they could have edited Dolphin itself for all we know! Just saying, perceive with caution.

Quote:In the first part of the video he played with the default settings, and MangoHud displayed that each of the CPU cores was only using 20% of it's power (not too surprising, because Dolphin can only utilize like two cores properly)

Ok so, this is way more complicated than you are thinking.

If the Steam Deck is showing 20% on all cores, you're not CPU bottlenecked. At least, probably. There is some weirdness is how mangohud displays data right now so you will never get consistent data from it. For example, even if I set up a workload that is exclusively a CPU load and is guaranteed to max out a CPU core, it doesn't reliably show 100% pegged anywhere. To be fair to mangohud, this is a very challenging system to monitor, as the Steam Deck is changing both CPU and GPU dynamically to maximize power to any workload thrown at it, and the mangohud devs have done an amazing job improving it to match this challenge. They're just not quite done yet. So for now, mangohud needs a bit of interpretation and shouldn't be taken absolutely. To properly interpret it, we need to first establish what CPU bound and GPU bound look like.

So what does CPU limited look like in Dolphin on a Steam Deck? Well, we can test that pretty easily. At 1x native, launch Rebel Strike and let the disco vader intro play. This scene is an absolute monster and eats CPUs for breakfast. Trying it on my Steam Deck just now, I saw 100% immediately on one thread, but then it wavered to 80%, migrated around, showing 60% here, 100% there, on and on. Mangohud never gives that satisfactory one core locked at 100% visual, even though that is exactly the workload I put it under and can guarantee it is single thread performance bound. However, it does show 100% CPU utilization on a thread, periodically and not consistently and it moves around a lot, but it does show it constantly. Also, the CPU clocks ramp up to 3400mhz and stays high. Again it isn't consistent, mangohud or CPU management I can't be sure, but it's always within the range of 3000-3400mhz.

As for the GPU, the Steam Deck will keep its GPU clocks down as much as possible, only going up to maintain the target framerate. 1040mhz is what it likes to sit on in Dolphin, and will only raise it up to the max of 1600 if frames are dropping badly or if the user directly tells the console to do so. GPU usage however will basically always be in the 90-100% range, and the console will adjust clocks to keep the clockrate down as low as possible while utilizing it fully. That's how the Steam Deck manages its GPU. What does GPU boundness look like with Dolphin on the Steam Deck? Sonic Colours title screen at 8x Native is a good test for this, as this is a very GPU heavy screen but very light on the CPU. It shows 95-100% GPU usage, and has frequencies that bounce between 1200-1600mhz. Again it's not consistent, but importantly, you can see 1600mhz show up constantly. That's kind of the key to interpreting this. ...also play Sonic Colours it's a really good game.

So now that I've covered that, let's compare it to the video. Before they engaged the plugin, the CPU in that video never has a thread pass 50%, but in a CPU limited case there would definitely be a bunch of 100%s in there. The CPU is also running at a very low clockspeed (1900-2000ish mhz) when they should be in the range of 3000-3400mhz if they are CPU bound. However, they don't appear to be GPU bound either. They are running at 1040mhz and are at 90% utilization, which is very normal for the Steam Deck and it's holding back because it can. So it doesn't seem to be bound by the GPU either.

After they engage the mod that reduces their CPU thread count, their GPU usage stays about the same but their CPU clocks go way up. However, even with fewer CPU cores, we never see a CPU thread go up to 100%, or even near it. It's always around 50%. They are not CPU bound!

So what's happening here? Well, there's always the possibility they pushed a button to change a Dolphin setting, or any of the other possibilities I said above. But if we take what little we are presented with at face value... My best guess is that Steam Deck is just not recognizing the load effectively and it isn't raising the CPU clocks as it should. This is something we've encountered a lot on GPUs. In GPUs, they will downlock to save power and upclock under load, much like the Steam Deck. However, lots of GPUs in the past have seen Dolphin's workload and been like "eh, that's nothing" and not clocked up even as Dolphin chokes at well below fullspeed. That isn't as common now that GPU driver vendors are more familiar with Dolphin, but that is something we've seen a lot of. CPUs also do this now, so this isn't that weird, but the Steam Deck is much more aggressive since it's sharing so little power between the CPU and GPU. It's possible it's favouring the GPU in some way? I don't know. Without knowing their Dolphin settings I can't guess beyond this. But yea, the act of someone doing some random thing and suddenly Dolphin is faster is very common on the GPU side, and this reminds me of that. Assuming this isn't all a prank anyway, again, this is a random internet video with basically no information. Take it with a heaping tablespoon of iodized sea salt.

Alternatively we could be witnessing some sort of weird power limitation. Not sure, especially since I don't trust the watt measurements in mangohud. That may be fixed by now but, I'm not going to trust it yet.

If the above hypothesis is true, unfortunately as an application there isn't anything we can do about it. There is no way for us to tell a Steam Deck what our workload is or where to put it (that I'm aware of anyway); the hardware, OS, and drivers have to figure out the workload based on how we use the hardware and adapt according. It's up to Valve. From what I've experienced, they are very responsive to feedback (also they are AMAZING) so hopefully they can see the demand from the plugin and will add CPU clock controls just like the ones they have for the GPU. Or it could be as simple as something is broken and they fix it, who knows. We'll see!
[Image: RPvlSEt.png]
AMD Threadripper Pro 5975WX PBO+200 | Asrock WRX80 Creator | NVIDIA GeForce RTX 4090 FE | 64GB DDR4-3600 Octo-Channel | Windows 11 22H2
MacBook Pro 14in | M1 Max (32 GPU Cores) | 64GB LPDDR5 6400 | macOS 12
Find
Reply
04-29-2022, 10:44 PM
#3
Leseratte10 Offline
Wiimmfi-Team
***
Posts: 55
Threads: 10
Joined: Apr 2019
Wow, thanks for the detailed response.

I'm going to try and install that plugin on my own Steam Deck to rule out any possibility of a fake video or a patched Dolphin build or whatever and see what kind of results I will get. I guess this topic is way more complex than I assumed it was.
Find
Reply
04-30-2022, 01:48 AM
#4
JosJuice Offline
Developer
**********
Developers (Some Administrators and Super Moderators)
Posts: 8,877
Threads: 7
Joined: Oct 2014
(04-29-2022, 09:15 PM)MayImilae Wrote: So what's happening here? Well, there's always the possibility they pushed a button to change a Dolphin setting, or any of the other possibilities I said above. But if we take what little we are presented with at face value... My best guess is that Steam Deck is just not recognizing the load effectively and it isn't raising the CPU clocks as it should. This is something we've encountered a lot on GPUs. In GPUs, they will downlock to save power and upclock under load, much like the Steam Deck. However, lots of GPUs in the past have seen Dolphin's workload and been like "eh, that's nothing" and not clocked up even as Dolphin chokes at well below fullspeed. That isn't as common now that GPU driver vendors are more familiar with Dolphin, but that is something we've seen a lot of. CPUs also do this now, so this isn't that weird, but the Steam Deck is much more aggressive since it's sharing so little power between the CPU and GPU. It's possible it's favouring the GPU in some way? I don't know. Without knowing their Dolphin settings I can't guess beyond this. But yea, the act of someone doing some random thing and suddenly Dolphin is faster is very common on the GPU side, and this reminds me of that. Assuming this isn't all a prank anyway, again, this is a random internet video with basically no information. Take it with a heaping tablespoon of iodized sea salt.

Considering that the video is of Super Mario Galaxy, a game that uses GPU readback, I think this interpretation is likely. Power saving mechanisms have a tendency to get weirded out by Dolphin sometimes making the CPU wait for the GPU and then sometimes wanting to run the CPU at full throttle.
Find
Reply
04-30-2022, 09:05 AM
#5
TellowKrinkle Offline
Junior Member
**
Posts: 1
Threads: 0
Joined: Apr 2022
Yeah readbacks really break the OS's idea of how much CPU/GPU your application needs. So probably less of a "disabling other cores allows the CPU to boost higher" and more of a "disabling other cores puts enough tasks onto the remaining ones that they have to boost higher to keep up with all the work, which ends up benefitting Dolphin". (And if that is the case, closing background processes may actually reduce Dolphin's performance, fun!) Have you tried setting the cpu governor to performance to see if that works just as well?
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode