Re:Chrome just got faster with Profile Guided Optimization
by 3pt14159 on Tuesday August 25, 2020 @01:54PM
(#24274016)
I'm surprised that there isn't a way to do PGO when compiling from scratch. A way of telling the compiler exactly what parts are, but build it into the codebase so that one could get the best of both worlds.
[ Parent
| on HN ]
Re:Chrome just got faster with Profile Guided Optimization
by mintplant on Tuesday August 25, 2020 @01:56PM
(#24274039)
You can pass a PGO flag to the build system [0], but IIRC from when I was there last, Mozilla puts some serious machine hours into PGO cycles for each release and that isn't easy to replicate as an individual developer. The profiling captures things which are very specific to the actual build being optimized, so inlining that information into the codebase wouldn't be so helpful. Though there are already static optimization hints spread throughout the code (off the top of my head, MOZ_LIKELY/MOZ_UNLIKELY for marking conditionals).
[0] https://firefox-source-docs.mozilla.org/build/buildsystem/pg...
Re:Chrome just got faster with Profile Guided Optimization
by loeg on Tuesday August 25, 2020 @02:20PM
(#24274314)
Mozilla could publish their profile data for a given release image.
Re:Chrome just got faster with Profile Guided Optimization
by glandium on Tuesday August 25, 2020 @07:36PM
(#24277514)
They are public, but you have to know where to look. I do think they should be published alongside the builds on archive.mozilla.org. (disclaimer: I work for Mozilla)
Re:Chrome just got faster with Profile Guided Optimization
by CalChris on Tuesday August 25, 2020 @04:34PM
(#24275786)
Given PGO and branch prediction, has anyone tested whether turning off MOZ_LIKELY/MOZ_UNLIKELY makes any difference?
Re:Chrome just got faster with Profile Guided Optimization
by wyldfire on Tuesday August 25, 2020 @02:25PM
(#24274373)
PGO guides inlining and branch prediction IIRC. You can give static hints about each of these. But the hints aren't on a continuum like they are with PGO. So finding an optimal balance for these will be harder. Also you have to maintain these hints. So if you were somehow giving hints with a hotness ratio in the source it would be impossible to maintain and keep it accurate.
Re:Chrome just got faster with Profile Guided Optimization
by brandmeyer on Tuesday August 25, 2020 @04:32PM
(#24275767)
Also hot/cold partitioning. Keeping cold code code away from hot code can help L1I cache utilization, iTLB utilization, Operating system page-out, etc.
Re:Chrome just got faster with Profile Guided Optimization
by 1f60c on Tuesday August 25, 2020 @03:17PM
(#24274933)
This isn't the same, but some compilers have support for macros that tell it which branches are more likely to be taken than others, and in C++20, it's even a language feature.
Re:Chrome just got faster with Profile Guided Optimization
by rurban on Tuesday August 25, 2020 @05:01PM
(#24276060)
The G stands for guide. You need a testsuite to create a guided profile to optimize the branch hints.
Normally there's a simple make target, like chrome.pgo to create the initial binary chrome, run the testsuite with pgo or better autofdo via perf and from this create the optimized chrome.pgo. using Facebook's bolt is even better.
I have no idea about Google's byzantinian bazel tool. With make it's a simple target which automates these steps.