Re:Bubble sort slower with -O3 than -O2 with GCC
by unwind on Sunday October 17, 2021 @01:59PM
(#28898341)
Just to clarify, in this context PGO = Profile-Guided Optimization [1].
[1]: https://en.m.wikipedia.org/wiki/Profile-guided_optimization
Re:Bubble sort slower with -O3 than -O2 with GCC
by jhgb on Sunday October 17, 2021 @04:14PM
(#28899391)
...as opposed to? Off the top of my head I can't seem to remember a single acronym I could possibly confuse it with, and now you got me wondering which common acronym I completely failed to learn.
Re:Bubble sort slower with -O3 than -O2 with GCC
by toxik on Sunday October 17, 2021 @04:46PM
(#28899652)
Pose graph optimization
Re:Bubble sort slower with -O3 than -O2 with GCC
by mhh__ on Sunday October 17, 2021 @05:15PM
(#28899865)
That seems like a bit of a reach given that the thread is obviously about GCC.
Re:Bubble sort slower with -O3 than -O2 with GCC
by gnufx on Sunday October 17, 2021 @02:04PM
(#28898374)
Yes to -fprofile-use. That brought gfortran to essentially the same geometric mean as ifort with reasonable "good" flags for me, running a benchmark set which I think is supposed to show off proprietary compilers. ifort got little benefit from its equivalent.
Re:Bubble sort slower with -O3 than -O2 with GCC
by MauranKilom on Sunday October 17, 2021 @02:00PM
(#28898350)
Not sure if that would have an impact here. GCC is just unaware of the latency implications of store forwarding. I mean, it's definitely worth a shot, but you'd just be more or less hoping that your mentioned techniques disable the right optimization pass.
Re:Bubble sort slower with -O3 than -O2 with GCC
by mhh__ on Sunday October 17, 2021 @08:06PM
(#28900862)
That's true, although I'm curious if any compiler really understands the microarchitecture at that level without being coerced by a compiler dev writing a pass (i.e. won't happen straight from a pipeline description)
Re:Bubble sort slower with -O3 than -O2 with GCC
by bick_nyers on Monday October 18, 2021 @08:10AM
(#28904587)
Do you know of any tools for generating this, possibly with runtime data? Been wanting to do this ever since I learned about the feature but I don't want to do this by hand for dependencies.
Edit: It is possible that I just don't understand how to actually implement PGO
Re:Bubble sort slower with -O3 than -O2 with GCC
by gnufx on Monday October 18, 2021 @05:08PM
(#28911779)
I don't know what exactly is required, but the basic business is
gcc -fprofile-generate ...
./a.out ...
gcc -fprofile-use ...
I don't know the current state of https://gcc.gnu.org/wiki/AutoFDO
If the code slows down, it's usually because the compiler has generated a bunch of code because it doesn't know what hot path to schedule for.
They will generate hundreds to thousands of instructions for factorial if you let them because it turns it into a loop, then vectorizes the loop.
Undefined Behaviour pub quiz question in there ^^