Given the topic complexity and the length of this article I have split it in 3 three different blog-post:
Step 1: What is PGO
PGO (Profile-Guided Optimization) is a two-pass compilation technique.
First, we build the program with instrumentation that adds
counters to every branch, loop, and call site.
Next, we run it against a representative training workload so
these counters can record which code paths are actually hot
versus cold.
We then recompile the program using that data to drive …