void-packages icon indicating copy to clipboard operation
void-packages copied to clipboard

foot: Add PGO build option

Open travankor opened this issue 4 years ago • 7 comments

PGO optimization speed foot up by a significant amount. Add a build option that enables PGO during build.

travankor avatar Mar 17 '21 08:03 travankor

Definitely not on by default, since PGO is affected by the CPU that's being used.

ericonr avatar Apr 27 '21 23:04 ericonr

since PGO is affected by the CPU that's being used.

It's actually not. PGO counts functions and branches executed, and helps re-organize the code; it clusters "hot" functions, to improve cache locality. It can also re-arrange code within a function to make the "normal" path the fast path (i.e. placing the not-often executed branches at e.g. the end of the function). But PGO in itself does not emit CPU specific instructions, nor does it depend on CPU-specific knowledge for e.g. instruction scheduling.

Over at nix, @sternenseemann has been able to do reproducable PGO builds. That is, builds on different systems produce identical output. I can't for my life find the issue, or comment, where I saw this, but pretty sure sterni can fill in the details, if needed.

Oh, and as a bonus, PGO builds tend to be smaller (in binary size) than regular release builds. This is at least true for LTO builds (which I strongly recommend building foot with, with or without PGO).

dnkl avatar Jul 02 '21 06:07 dnkl

I can confirm that building foot with PGO can be reproducible, i. e. I can reproduce the exact hash of the binary package produced by our builders on two different local machines (at different times). This also leads me to believe that a reproducible gcc with PGO is possible, but most likely very hard to get to work.

The only thing necessary to achieve a reproducible foot build is generating the random inputs which are used for profiling while building using a fixed seed.

sternenseemann avatar Jul 02 '21 08:07 sternenseemann

Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.

github-actions[bot] avatar May 09 '22 02:05 github-actions[bot]

Not stale. @ifreund do you have anything in effect for this? I think I had a branch attempting it a while back

ericonr avatar May 10 '22 02:05 ericonr

@ericonr nope, I haven't tried to implement this yet.

ifreund avatar May 10 '22 11:05 ifreund

Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.

github-actions[bot] avatar Aug 09 '22 02:08 github-actions[bot]