[1.1.74] Factorio uses efficiency cores instead of performace cores
[1.1.74] Factorio uses efficiency cores instead of performace cores
Factorio defaults to using the efficiency cores (e-cores) instead of the performance cores (p-cores), even when running at between 5 and 20 UPS and while macOS is not in Low Power Mode. This can result in artificially lowered performance in very large and demanding worlds, especially late-game modded worlds. As Apple Silicon and even modern Intel chips begin to incorporate asymmetrical e-and-p-cores, this issue will only become more prominent.
Apple Developer articles on how to optimize for asymmetrical cores: overview and more technical.
It looks to me (though I may be wrong) that, at least for macOS, it should require setting higher QoS settings for each non-background process
(note: while I noticed and recorded this problem in a modded game, it would also be an issue in a vanilla game with a large enough factory)
Log file: https://pastebin.com/fLEAYsuj
Apple Developer articles on how to optimize for asymmetrical cores: overview and more technical.
It looks to me (though I may be wrong) that, at least for macOS, it should require setting higher QoS settings for each non-background process
(note: while I noticed and recorded this problem in a modded game, it would also be an issue in a vanilla game with a large enough factory)
Log file: https://pastebin.com/fLEAYsuj
- Attachments
-
- Activity Monitor screenshot. Note that both e-cores are near-constantly at full use, while 4 p-cores are nearly idle
- Screenshot 2022-12-09 at 14.57.43.png (1.03 MiB) Viewed 3710 times
-
- starting anew_.zip
- World save
- (54.46 MiB) Downloaded 129 times
-
- Screenshot of debug menu
- Screenshot 2022-12-09 at 19.11.26.png (2.04 MiB) Viewed 3710 times
-
- Filter Inserter
- Posts: 502
- Joined: Tue Jun 26, 2018 10:14 am
- Contact:
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
AFAIK the bottleneck is RAM bandwidth, not a CPU power.
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
Additionally, I'm not sure this constitutes a "bug", but rather a suggestion.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
Would factorio get assigned to performance cores, if memory bandwidth is not the bottleneck?coppercoil wrote: ↑Sat Dec 10, 2022 12:46 pm AFAIK the bottleneck is RAM bandwidth, not a CPU power.
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
I should have more than enough RAM and bandwidth - I have 64GB of RAM (factorio seems to use 8 at most) and the M1 Max claims to have 400GB/S of memory bandwidthcoppercoil wrote: ↑Sat Dec 10, 2022 12:46 pm AFAIK the bottleneck is RAM bandwidth, not a CPU power.
It was suggested to me on the subreddit to report itFuryoftheStars wrote: ↑Sat Dec 10, 2022 4:34 pm Additionally, I'm not sure this constitutes a "bug", but rather a suggestion.
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
I had this same problem on windows 10 with visual studio compilation and the intel E-core vs P-core.. it feels far more like an operating system flaw than software flaw. The operating system should see that a process is using 100% of a given E-core and move it over to the P-core. Last I looked into it, windows 11 does this far better than windows 10. In the end I just disabled the E-cores in my BIOS and it gave a total system overall performance boost.
Requiring every piece of software tell the operating system (windows or mac) which cores it wants to use is a recipe for disaster... the E-core and P-core combo just seems flawed from the start. Software will never perfectly tell the OS what it should be doing since there are millions of programs out there that will never be updated to include these hints for the OS: it's always going to rely on the OS to do it smartly.
If nothing else; I would report this to Apple as well.
Requiring every piece of software tell the operating system (windows or mac) which cores it wants to use is a recipe for disaster... the E-core and P-core combo just seems flawed from the start. Software will never perfectly tell the OS what it should be doing since there are millions of programs out there that will never be updated to include these hints for the OS: it's always going to rely on the OS to do it smartly.
If nothing else; I would report this to Apple as well.
If you want to get ahold of me I'm almost always on Discord.
-
- Filter Inserter
- Posts: 502
- Joined: Tue Jun 26, 2018 10:14 am
- Contact:
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
Does macOS officially support the new 12th-13th generation Intel processors? Apple switched to their own processors??coppercoil wrote: ↑Mon Dec 12, 2022 7:19 pm I run small factory (assume no bandwidth issues) at x64 speed on Win10, and got two P-cores working. Not sure about macOS.
Would you be so kind as to check out a small map with a vanilla base, which is not enough for 8GB of memory? Actually, 64GB is also not enough, preferably 128, but I think it will start from 64, albeit with difficulty and with a huge swap file)
Interested in UPS.
To not quite unfounded and for non-believers:
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
There are unofficial hackintoshes running on 12th and 13th gen Intel chips, but all new Macs use Apple's own ARM-based processors.
I don't know what's wrong with your Factorio, but here's the memory info for my highly-modded late-game base (compared to Firefox with 8 tabs) Firefox has *more* virtual memory used, and Factorio is only using 7.15 GB of "real" memory.azesmbog wrote: ↑Mon Dec 12, 2022 8:29 pm Would you be so kind as to check out a small map with a vanilla base, which is not enough for 8GB of memory? Actually, 64GB is also not enough, preferably 128, but I think it will start from 64, albeit with difficulty and with a huge swap file)
Interested in UPS.
Memory is clearly not the bottleneck here, either Factorio is incorrectly not calling for a high QoS (probably 33, as it should request highest priority for p-cores), or macOS is incorrectly not allocating p-core usage for Factorio. Without looking the process calls, it's hard to tell where the fault lies.
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
The suggested bottleneck is memory bandwidth, ie the rate at which data is transferred between memory and the processor. This is likely to be the case for code that repeatedly reads and writes data greatly exceeding processor cache size, when most accesses are sequential and/or only a small fraction of data transferred is being processed/changed. A related bottleneck is memory latency, which is likely in a similar case but when most accesses are non-sequential.
Factorio must read and update the state of many entities each step of the simulation, so the "active" data will greatly exceed processor cache size, but the updates for each entity are often relatively computationally simple. This combination tends to make memory bandwidth and/or latency a more significant performance factor.
The relevance of this is that if performance is dominated or limited by a system's memory performance rather than its computational performance, a P-core may provide less or no benefit over an E-core, because they share the same memory performance. There are lots of factors so I'm far from certain but I this is unlikely for Factorio on an M1/M1 Pro.
The implication from Rseding is that Factorio does not set QoS. The OS decides when and on which core to schedule each thread in all cases, but in this case it does not have "high QoS" to influence its decisions. But QoS is only a factor, a hint; the OS will also use other factors including historic observation, such as feedback provided by the CPU (if any exists) or that a thread previously run on an E-core usually uses its entire time slice.either Factorio is incorrectly not calling for a high QoS (probably 33, as it should request highest priority for p-cores), or macOS is incorrectly not allocating p-core usage for Factorio. Without looking the process calls, it's hard to tell where the fault lies.
To call this non-trivial is unquestionably a massive understatement, and cases where the OS "gets it wrong" are unavoidable. For example, at some particular moment, if there are more threads that are ready to run than the number of available P-cores, will performance be better if some particular thread is scheduled on an E-core, or if the OS doesn't schedule the thread because a P-core may become available very soon? There is no way to know for sure, with or without QoS.
It could be that Factorio is architecturally predisposed to "problems" in a system with cores of unequal performance, and the specific scheduling heuristics implemented in macOS for such a system are highlighting this. Marking game update-related threads with high QoS may cause the OS to schedule them only on P-cores (at least if power saving is not a priority), and perhaps result in better performance (at least sometimes). Equally, doing so may mean everything that matters now has high QoS so the OS's scheduling decisions will be the same as without QoS set and there is essentially no performance difference at all. The result could change if the OS's implementation does.
Hopefully the above shows that it is not as simple as either Factorio or macOS being "incorrect" but a much more nuanced matter. Also, I agree with FuryoftheStars that this is more a suggestion than a bug, although I would add that it is probably worth investigating.
-
- Smart Inserter
- Posts: 2768
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
I just happened to think to look this up, but this article says the memory is connected to a 200 GB/s controller: https://www.notebookcheck.net/Apple-M1- ... 971.0.html
Still, either way, these are theoretical under ideal condition numbers. In practice, you'd probably rarely actually see that.The unified memory (32 or 64 GB LPDDR5-6400) next to the chip is connected by a 512 bit memory controller (200 GB/s bandwidth)
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
-
- Fast Inserter
- Posts: 234
- Joined: Mon Aug 22, 2022 5:27 am
- Contact:
Re: [1.1.74] Factorio uses Efficiency Cores instead of Performace Cores
One thing tho that makes me kinda wonder if the game is indeed only using the small cores, how come it loads so much slower on my M1 Macbook than on my Steam Deck or Linux laptop (with same ingame settings). Especially the 'Loading sprites' part, I would kinda expect the M1 to load faster because it simply is a much faster system.
Re: [1.1.74] Factorio uses efficiency cores instead of performace cores
I'm going to make an executive decision and say the operating system(s) are responsible for scheduling things to run on cores and not software (us). You'll need to report the issue(s) to whoever makes your operating system if it schedules things incorrectly. Or disable e-cores.
If you want to get ahold of me I'm almost always on Discord.