One Line x86 Change To GCC Compiler Nets +12% Benchmark Win For Modern Intel/AMD CPUs
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 merged in GCC Git for next year's GCC 17 stable release.
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.
👁 GCC x86 mispredict tuning change
This change is merged in GCC Git for next year's GCC 17 stable release.
