cmd/compile: MTFT benchmark performance regression with register ABI #46216
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
What version of Go are you using (
go version
)?1.17dev
Does this issue reproduce with the latest release?
This is only observed with the register ABI, so not on 1.16, but yes on 1.17 (which not a release yet).
What operating system and processor architecture are you using (
go env
)?Linux and Darwin OS, amd64 (i.e., where we have activated register ABI).
What did you do?
Using bent:
with configuration.toml =
Or:
with different versions of go, saving the respective binaries.
and then observe timings for
MTFT
What did you expect to see?
Same or better run time.
What did you see instead?
10-15% worse run time.
The cause (from differential profiles) appears to be poor compilation of at least one at least one inner loop.
Profiles:
Using GOSSAFUNC to compare the generated code, the main difference in
Forward
appears to be in compilation of a loop:An easy way to get these files with bent is to modify the configuration, like so:
The source code:
Fixed count profiles were collected with a
RunWrapper = ["cpuprofilex"]
which is a slightly modified version ofcpuprofile
, where "10000x" is a good run count for this benchmark:My current hypothesis is that use of the register ABI increases register pressure in the loop and causes the register allocator to make unwise choices. I don't think that this is an easy fix for 1.17, and overall performance is nicely up for far more benchmarks than those that regressed.
Regarding bent; it's currently at github.com/dr2chase/bent, but is in the process of being migrated to github.com/golang/benchmarks/cmd/bent.
"Forward"
1.16 ssa.html: https://gist.github.com/dr2chase/fb7110e9fafd6bccffd1aeb93d1b9144
1.17 ssa.html: https://gist.github.com/dr2chase/ba0a4f898842d99c4aec9e26c428c5b5
"Inverse" (which looks a whole lot like Forward)
1.16 ssa.html: https://gist.github.com/dr2chase/c9aaeb44d5e1063ab673c93c9a07a0a1
1.17 ssa.html: https://gist.github.com/dr2chase/2683c78471c4aac85c5daecb98392da6
The text was updated successfully, but these errors were encountered: