4 ms·
Could the compiler put PGO (profile guided optimization) results into a table embedded into the executable binary and feed that to the CPU?
by 1over137 4y ago
Could the compiler put PGO (profile guided optimization) results into a table embedded into the executable binary and feed that to the CPU?
- saagarjha 4y agoYes, the “table” is encoded into the code itself ;)
- astrange 4y agoThe CPU can’t necessarily use any per-branch hints, including special “unlikely” branch instructions or implying one direction is less likely than the other, because not all designs have that info available at the predictor. It especially usually doesn’t know the address of the branch.
- tjalfi 4y agoSome architectures such as Itanium, MIPS, and x86 have branch hint instructions that allow the compiler to indicate whether branches are taken. I'm not sure about Itanium, but they weren't really beneficial on MIPS or x86; the MIPS branch hint instructions are deprecated and Intel's compiler stopped emitting branch hints at least a decade ago.