AMD Branch Sampling Support Being Worked On For Linux
A new kernel patch series was posted this morning working on AMD Branch Sampling "BRS" support.
AMD Family 19h "Zen 3" processors support this branch sampling feature for collecting details on branches taken during code execution. The latest AMD Zen 3 processors do contain improvements to BRS functionality. AMD BRS is detailed within their processor programming reference guides that are public but until now with this new patch series sent out by a Google engineer there hasn't been any Linux support/integration.
This AMD BRS bring-up for Linux is integrating the functionality into Linux's wonderful perf subsystem. But long story short why this AMD Branch Sampling support is news worthy is that the functionality can be used for AutoFDO-style optimizations on AMD processors with the compiler leveraging that collected hardware data to make more informed and accurate optimization decisions. With Google engineers working on this BRS bring-up, that appears to be their motivation is to in turn leverage it for compiler optimizations.
AMD's exposed feature set for "perf" on Linux has traditionally been lacking compared to Intel and the exposed performance counters, but it's great that in recent times there has been catching up. Once this AMD BRS support is squared away, it will be fun to see what compiler optimization work will come in leveraging this sampling data.
The set of 13 patches getting Linux's perf code wired up for AMD Zen BRS support can be found on the kernel mailing list.
AMD Family 19h "Zen 3" processors support this branch sampling feature for collecting details on branches taken during code execution. The latest AMD Zen 3 processors do contain improvements to BRS functionality. AMD BRS is detailed within their processor programming reference guides that are public but until now with this new patch series sent out by a Google engineer there hasn't been any Linux support/integration.
This AMD BRS bring-up for Linux is integrating the functionality into Linux's wonderful perf subsystem. But long story short why this AMD Branch Sampling support is news worthy is that the functionality can be used for AutoFDO-style optimizations on AMD processors with the compiler leveraging that collected hardware data to make more informed and accurate optimization decisions. With Google engineers working on this BRS bring-up, that appears to be their motivation is to in turn leverage it for compiler optimizations.
AMD's exposed feature set for "perf" on Linux has traditionally been lacking compared to Intel and the exposed performance counters, but it's great that in recent times there has been catching up. Once this AMD BRS support is squared away, it will be fun to see what compiler optimization work will come in leveraging this sampling data.
The set of 13 patches getting Linux's perf code wired up for AMD Zen BRS support can be found on the kernel mailing list.
3 Comments