-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
testing: add CPU name to standard benchmark labels #39214
Comments
Should we also print information about the memory and disk models/speeds? I imagine this will greatly depend on what the bottleneck for a benchmark is. |
I would leave it at CPU information for now as this is a common factor for many microbenchmarks. For me this also identifies the system I was benchmarking on, which is helpful when examining logs of benchmarks later. |
I agree; I was thinking outloud more than anything. There could be many other factors at play too, such as what kernel version and if any special boot options were used (such as intel mitigations which could slow down syscalls). |
Change https://golang.org/cl/234977 mentions this issue: |
@mvdan agreed. This could potentially be expanded in the future with a flag for printing even more information (ram, caches, kernel, ...) but I would leave that to a future extra and separate proposal. The same information could then be easily added to e.g. go env or other commands with information for bug reporting if considered helpful. |
Having gathered benchmarks from multiple machines with different CPUs again lately for comparison and the reactions posted/emojis are all seem to be positive. Does anyone object to adding this for go1.16? |
Seems OK. Do we know how to procure this information for a wide enough variety of architectures and operating systems? |
Linux: |
On all operating systems for 386 and amd64 we can use the CPUID instruction (see http://golang.org/cl/234977) to get the CPU name. Generally for linux on other architectures For ARM on all operating systems another (more indirect) but not as universal approach can be to read the model and vendor IDs with CPU instructions and then map those to common architecture names for the most common CPUs (e.g. Cortex-A55, Cortex-A77 ...). |
For ppc64x, you have to rely on the OS. Currently, there is no exposed hardware CPU ID to userspace. On Linux, you can get that from |
@ceseo thanks for pointing this out. I will work on to ammend my protoype patch for Linux on all CPU architectures to use AT_PLATFORM from the aux vector. We already use the same mechanism to get HWCAP bits from AT_HWCAP in the auxillary vector. It seems this could also work on BSDs. |
@martisch please bear in mind that, if you want to add the processor capabilities in the future (VSX, etc), you will have to read both |
@ceseo both are already used on ppc64x to identify processor capabilities: go/src/runtime/os_linux_ppc64x.go Line 14 in 8174f7f
go/src/internal/cpu/cpu_ppc64x.go Line 39 in 8174f7f
|
I tested a bit around and AT_PLATFORM is mostly not useful as it will only print along the lines of Parsing On *BSDs it seems we can get information using sysctl calls that are already implemented in the runtime. I have however not tested how differ across architectures and some *BSDs we may need to implement a sysctlbyname call first if the MIBs are not static. So in a first iteration it seems we could cover all of x86, amd64 and Linux leaving these not supported initially:
|
It sounds like between the commands and auxv we have getting the info covered. |
No change in consensus, so accepted. |
Change https://golang.org/cl/263804 mentions this issue: |
Currently only
goarch
andgoos
are printed as bechmark labels.This proposal suggests to add the CPU name after a
cpu
label to the labels printed once at the top of benchmark output.This will only happen when
internal/cpu
is able to detect the cpu type and otherwise thecpu
label will not be printed.Example with prototype http://golang.org/cl/234977:
Optionally disabled/enabled CPU features could be printed in addition:
features: aesni, avx, sse41
...This will help to understand, reproduce and document benchmark results better in context of different system configurations.
Some commit messages with benchmarks made by Go contributors already contain this information, but added manually:
https://go-review.googlesource.com/c/go/+/230737
https://go-review.googlesource.com/c/crypto/+/169037
https://go-review.googlesource.com/c/go/+/40693
https://go-review.googlesource.com/c/go/+/10367
https://go-review.googlesource.com/c/go/+/76470
https://go-review.googlesource.com/c/go/+/171736
https://go-review.googlesource.com/c/go/+/125316
https://go-review.googlesource.com/c/go/+/171731
https://go-review.googlesource.com/c/crypto/+/39693
....
Related Proposal: #28398
The text was updated successfully, but these errors were encountered: