I am looking at the performace of my FS, and noticed that I get “mainthread limited” while my CPU and GPU sits in low utilisation and all of the CPU cores are sitting well below 100%.
The screen refresh rate is limited to 72Hz, but not hitting that.
CPU is not throttling, and has a lot of TDP headroom (100W actual vs 250W limit), temps are low/medium
GPU sitting around ~50%
DX12 enabled (but it is the same/worse with DX11)
12900k with 3080Ti
Anyone has any idea about why this is and what is bottlenecking the performance and/or how to find it (and mitigate) it?
Thank you for your post! Your topic has been moved to a subcategory of General Discussion & Community Support. The General Discussion category is meant for discussions that fall outside our other sub-categories.
Please check out these other categories for your future posts:
Aircraft
is where you discuss current or future planes coming to MSFS as well as assistance with liveries.
World
is where you discuss scenery, airports, and weather.
Tech Talk
is where you discuss installation, graphics, drivers, performance, CTDs, and hardware.
Menus & Activities
is where you discuss activities (landing challenges, bush trips, etc), plus anything accessed by the menus including the Marketplace, settings, logbook, cameras, etc.
They’re supposed to optimize this in MSFS2024, but generally being limited by the main thread doesn’t require the CPU thread to be 100%.
Theoretically it can be close to 0% and still blocked. For example waiting to read a large file synchronously. Generally waiting for something else to finish before it can continue execution. Not saying that’s what is happening here, but just that there is no correlation between being limited by the main thread and CPU utilization.
Thank you, that sounds like a sensible explanation!
So improving things around IO (eg. RAM/SSD speed) could (theoretically) help to improve speed and use more of the potential in the CPU, do I interpret this correctly?
Is there any way to figure what exactly limiting MainThread?
Possibly. Hard to say without knowing exactly how it works. Which would require access to source code and deep knowledge.
In general you’ll always be limited by something. But if you’re mostly limited by the main thread then you should be able to bump the quality settings without loosing FPS.
Personally I play in 4k or VR and “only” have a 3090, so I’m mostly limited by the GPU.
Limited by mainthread just means the CPU is working harder than the GPU. It does not mean there is something holding back your CPU from getting to 100%.
Those performance pics look great.
“Limited by main thread” only means the game thread latency is higher than the latency your GPU can achieve. This means your GPU is able to achieve higer FPS but the game is not finishing the main thread loop in time to achieve the same equivalent latency. Simplifying your example, what you have is the following:
Resulting render runs at 17.95 ms → 55.71 fps, which is equivalent to ((1 / 17.95) * 1000)
Main thread can run at 16.6 ms → it could only achieve 60.24 fps
GPU can run at 8.8 ms → it could even achieve 113.36 fps
Even if HW is obviously relevant, indeed this has nothing to do with HW utilization but with how fast the tasks inside the game main thread can be processed. For instance your CPU could be running at 100% and that may not be enough for the game thread to complete all tasks if too many are queued because basically all are handled by a single game thread which is split among all CPU cores in your system. But´s it´s still one single game thread running all pending tasks. That´s the problem!
On CPUs with so many cores as yours it´s normal to see CPU loads even below 10% on high demanding scenarios. CPU really works at it´s max capacity only during initial flight loading. Obviously a fast CPU helps and a multicore one will run cooler but the problem is that main game thread is just one single thread. If you keep the same settings and increase rendering scale alone for instance you will see how GPU latency increases (FPS are therefore reduced) and GPU utilization increases as well. But most likely main thread latency will remain at similar figures (see my examples below).
I have a similar HW setup. I use a 12900ks + 3080Ti but run game at 3840x1600 with scaling of 125% and still get similar figures as you get in terms of FPS at Barajas apron for instance, while in my case GPU runs almost at full power due to my higher rendering resolution + scale. You will see higher GPU latency but CPU usage after flight loading (so under regular usage) runs as low as 22% max per core and as low as 2% overall, similar to your case.
The figures above were taken for max settings, TLOD 200 and 10% offline AI (58 airplanes). If I set 100% traffic (303 airplanes) I get a dramatic performance decrease and mainthread latency increase, while GPU latency is basically the same as before. In this case CPU core load increases a bit to 31% but overall it´s still around 3%. However I have forced a bottleneck in my system as GPU usage is now reduced a lot compared to previous scenario. That´s why I said before that this had nothing to do with HW utilization as artificial delays can be generated at main thread. But you can see a 90% CPU core usage that happens when the traffic setting is changed and all AIs start to be spawned, however overall CPU usage is still 6% in that case.
If under that max AI traffic scenario I reduce TLOD for instance then I´m able to remove the bottleneck and increase FPS and GPU usage again to figures close to the original ones.
The problem is not your HW as your achieved a 55 fps figure which is very good indeed. Your CPU is not running at higher load because it does not need to do it to achieve the required workload. The GPU is not running at higher load either for the same reason. It can handle the required resolution and graphical settings and that´s why it´s running at 50% only.
Game is using all your existing cores. But using 8 cores does not mean CPU can work 8 times faster in the current implementation, only that it can split the assigned workload more efficiently, so that extra room is available for other tasks including the game and your CPU will run cooler.
From the game perspective almost everything which is relevant is stacked in a single set of tasks, so to speak. That´s the main thread. This thread is supported by the other secondary game threads but the relevant one is the main thread. If you put more AI planes for instance then more tasks are stacked and the code loop will take longer to complete all of them for a given time interval and CPU speed.
Your PC will receive that set of tasks and CPU can only process them as a long list because that´s how they were originally created by game. If the tasks were originally split in batches by game itself (having several main threads instead of one) and game had a true multicore implementation, some of your CPU cores could work with the AI traffic while others are working on the scenery for instance. That could allow that same original amount of tasks are completed faster for the same CPU because CPU cores would be really working in parallel in different tasks at the same time.
This is a very simplistic explanation but it´s the main reason why almost everytime you are limited by main thread even if you are having high FPS figures. Basically game itself can´t run faster, even if your HW could allow it to do it.
FWIW MSFS doesn’t really know what kind of CPU and the number of cores a system has (except to insure minimum CPU/GPU requirements are met). It probably could query the Windows Device Manager and then customize its code “on the fly” to “load balance”. What would happen then if Netflix or YouTube or Photoshop is running? This is where Windows manages the resources dynamically for all the running programs. It dispatches running threads to the CPU core best available. The main thread issue is a difficult one because MSFS does a LOT of file accessing and network i/o. Windows has to insure that files aren’t corrupted and network i/o for all running programs is processed correctly.
There are differences in hardware configurations that might impact MSFS at different times in-flight. For example, each CPU has its own on-board memory caches that are much faster than RAM. They are used by the CPU for faster repetitive processing. Your CPU has 512 KB, 2.0 MB, 12 MB caches. My CPU has 768 KB, 6.0 MB, 64 MB. This doesn’t mean my CPU is better or worse, faster or slower. All it means is that there may be some parts of MSFS that might run better for you than me. Or the same parts of MSFS you might have a higher CPU usage than I do.
Given the huge number of CPU/RAM/GPU/disk combinations it is impossible for MSFS to do “load balancing”. Windows separates MSFS (and all other programs) from the hardware and does the “load balancing” and other things for MSFS. MSFS can and does update its code where it can to improve performance generally.
Your CPU is not running at higher load because it does not need to do it to achieve the required workload. The GPU is not running at higher load either for the same reason. It can handle the required resolution and graphical settings and that´s why it´s running at 50% only.
I get this - probably cranking up the settings I would see higher loads. What made me somewhat perplexed is that for some reason I am still not getting the desired ~72 FPS (which I guess would be the max as VSync @ Refresh rate 50% is enabled, and yet the GPU and CPU are not sweating enough.
Don’t get me wrong, in this scenario, I don’t fuss about the ~50fps it is more than enough, however I still get the occasional drops when swithching to VR or getting into a more demanding scenario (eg. more complex aircraft, airport or traffic).
My 2 cents is that at this point probably wouldn’t worth to throw money on upgrading the CPU or the GPU, as these don’t seem to bottleneck the current use. Curious to see what FS2024 brings to us
Seems like it is only using the P cores, but also none of the P cores are at 100%. Based on @lkowgli and @geloxo I suspect in my case I/O is the most likely bottleneck. Or something around that area, but we can’t know for sure.