News: 0001642894

  ARM Give a man a fire and he's warm for a day, but set fire to him and he's warm for the rest of his life (Terry Pratchett, Jingo)

One Line x86 Change To GCC Compiler Nets +12% Benchmark Win For Modern Intel/AMD CPUs

([GNU] 5 Hours Ago Generic Tuning)


A one line code change to the GNU Compiler Collection (GCC) for its generic x86 tuning is benefiting modern Intel and AMD processors.

Intel software engineer Lili Cui discovered it's quite worthwhile increasing the misprediction cost of the generic x86 tuning for the GCC compiler. On the basis of modern CPUs having deeper pipelines and thus making branch mispredictions more expensive, increasing the cost in the generic tuning table helps avoid pipeline stalls from mispredicted branches. This is for those just relying on the generic x86/x86_64 tuning and not any CPU-specific -march=native type builds.

By simply increasing the branch mispredict scale by three, it was found to increase the performance on Granite Rapids by 12.7% and by AMD Zen 5 for 12.1%. That is for SPEC CPU 2017's 544.nab_r Nucleic Acid Builder (NAB) test case. No other performance numbers were shared in the Git commit/patch but in any event a 12% win for at least one SPEC CPU test case is quite enticing -- especially from changing a single line of code -- and it will be interesting to see the impact on other workloads.

This change is [1]merged in GCC Git for next year's GCC 17 stable release.



[1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=52cd02606b906160bf47001a00b446c35d46f15f



As long as war is regarded as wicked, it will always have its fascination.
When it is looked upon as vulgar, it will cease to be popular.
-- Oscar Wilde, "Intentions"