-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] SystemInfo doesn't report correct cache sizes and cpu frequency on M1 Macs #1310
Comments
i agree it's too much to ask the benchmarks to be run with it's worth thinking about how it would be output in the JSON formatter as this is the most flexible. i don't think anyone is parsing the console output (ob https://hyrumslaw.com). |
Thanks. I'll think how it would look in json and based on that would adjust the text output. Just not to promise anything, but I'll try to come up with some PoC PR in upcoming weeks. As about frequency - I'm thinking about actually trying to execute the powermetrics, but if it fails - then just use some default value/ And as about json - maybe for compatibility reasons I would keep current representation but I'd add extra filed "details" or something like that that would have proper structure. |
Are there any updates on this? |
I thought to work on this as I had some ideas on what can be done here, but I haven't done anything. On ARM-based MACs current measures of cache and frequency are NOT accurate, however that's important only in some cases. It seems, that because OSX for compatibility reasons(?) reports static value that have nothing to do with real frequency and same goes for Cache as legacy sysctls (common for x86 and ARM based macos) on ARM report static value as well that have nothing to do with real cache sizes. |
Yeah that's what I thought. That's too bad. I don't have a good idea for how to solve this |
that's not true. the benchmark measurements don't rely on cycles per second, and they merely report it in the metadata for informational purposes (comparison across machines, for example). the benchmarks themselves measure time based on hardware clocks or software clocks. in the case of OSX (arm or not) we use pthread's timing info for thread time and |
@dominichamon I might wrote my thoughts wrong - as by "measures" I've meant whatever goes to the report in cache size, CPU Frequency, etc. Sorry for the confusion. As far as I understand that would make it less useful if you want later on to get idea of performance per MHz for example, but that's another story. |
👍🏻 makes sense. Thanks for clarifying. Maybe one could remove the warning and unreliable information until this issue is fixed and just report that these numbers can't be retrieved right now? |
) * Clarify that the cpu frequency is not used for benchmark timings. Fixes #1310 * fix format (clang-format missed this...) * oops
Describe the bug
For ARM-based macs old sysctls no longer report correct values (or no longer exist). For example on M1 Max mac you'll get following output:
System
Which OS, compiler, and compiler version are you using:
To reproduce
Steps to reproduce the behavior:
Expected behavior
So the problems here are:
sudo
to runhw.perflevel[0-9]+
sysctls. Correct representation should look like:There is also L3 cache but it's size doesn't seems to be exported via sysctls (M1 Max should have 48 MB of L3)
Additional context
Relevant sysctls:
For L2 cache formula is
{hw.perflevel1.l2cachesize} X {hw.perflevel1.physicalcpu/hw.perflevel1.cpusperl2}
and can be repeated for each perf level (perflevel0 currently corresponds to performance cores)As about CPU Frequency, here's example output from powermetrics (irrelevent information about power consumption was redacted):
Here the max available frequency can be get from
E-Cluster HW active residency
andP0-Cluster HW active residency
, same information is also provided for P1 cluster.Actually similar logic should be implemented on Linux as it is possible to run benchmarks on Linux@ARM where CPU Cores are not equal. But I think that worth opening another bug.
I can try to implement a fix for MacOS, however I think it needs to be agreed on how to obtain the data. For example it might be too harsh to ask people to run benchmarks via sudo to get CPU Frequency, so in that case it might be worth to output a meaningful error message if that is the case. Also it might be worth splitting the logic for ARM and x86 based Macs and use
hw.cpufrequency
to determine what we are running on.Output format is also important as I don't want to break things for people, but still think that it's worth to output both CPU clusters correctly. So my example output above is my vision of how to represent that information.
The text was updated successfully, but these errors were encountered: