This is an archive of the discontinued LLVM Phabricator instance.

[PGO] Adds branch accuracy metric script and x86 branch tracing tool.
Needs ReviewPublic

Authored by red1bluelost on Aug 25 2023, 2:10 PM.

Details

Summary

[2/2] This is the second of two patches for branch accuracy metrics.

Depends on D158889

Patch adds a utility script for collecting branch accuracy metrics and a pin tool file
for tracing branches on x86. The metrics currently just support x86 but should be
extensible for other targets as well.

The script consumes compiler branch probabilities (from patch 1 of 2) and branch
traces (from Pin) to generate overall statistics about branch accuracy and a CSV of
individual jump accuracy. These metrics should help judging accuracy of PGO
generate branch weights.

We've been using these metrics at MediaTek to help track PGO accuracy changes
and find bugs in our toolchain.

Diff Detail