News for hackers. Stuff that matters.
Re:Someone’s Been Messing with My Subnormals by black_knight on Tuesday September 06, 2022 @12:13PM (#32739172)
I ran Gentoo back in the good old days. The biggest draw was that after about a week of compiling my system ran a lot faster because of all the compiler optimisations one could enable because it only had to work on your CPU.

I might be misremembering, but I think fastmath was one of the flags explicitly warned against in the Gentoo manual.

Re:Someone’s Been Messing with My Subnormals by hackingthelema on Tuesday September 06, 2022 @01:15PM (#32740072)
> I might be misremembering, but I think fastmath was one of the flags explicitly warned against in the Gentoo manual.

It is, here: https://wiki.gentoo.org/wiki/GCC_optimization#But_I_get_bett...

Re:Someone’s Been Messing with My Subnormals by jeffbee on Tuesday September 06, 2022 @01:10PM (#32740016)
ChromeOS is sort of the successor to Gentoo. The images are built with profile-guided, link-time, and post-link optimization, and they are targeted to the specific CPU in a given Chromebook. Every other Linux leaves a large amount of performance on the table by targeting a common denominator CPU that's 20 years old and not having PGO.
Re:Someone’s Been Messing with My Subnormals by yjftsjthsd-h on Tuesday September 06, 2022 @01:33PM (#32740324)
It's not a successor, it's a derivative. And yes, if you're only targeting specific known hardware than you can and probably should optimize for it, but most distributions fully intend to be usable on very nearly any x86(_64) hardware so they can't do that.
Re:Someone’s Been Messing with My Subnormals by jerf on Tuesday September 06, 2022 @02:27PM (#32741091)
It's also a bit less relevant when everything is so fast. I used Gentoo on a cheap-for-the-time Pentium 133MHz. Gentoo was basically the difference between a modestly pleasant system and an unusably slow system if I tried to run a standard still-compiled-for-386 distro on it.

I've long since stopped worrying about it because on the systems I run, which are not top-of-the-line but aren't RPis either, it's not worth worrying about anymore for most programs. At most maybe you should target the one particular program you use that could use a boost.

Re:Someone’s Been Messing with My Subnormals by yjftsjthsd-h on Tuesday September 06, 2022 @03:35PM (#32742138)
Yeah, I don't know the breakdown between better hardware and better compiler optimizations (even in the default settings) and less differentiation between processors, but I've done some minor not-very-scientific tests of compiling packages with O3/march=mtune=native and in my limited experience it wasn't particularly useful. Like, not just small benefits, but zero or below the noise floor benefits in my benchmarks. Obviously this is super dependent on your workload and maybe hardware; it's an area where if you care, you have to do your own testing.
Re:Someone’s Been Messing with My Subnormals by jeffbee on Tuesday September 06, 2022 @04:12PM (#32742613)
Tune for native sometimes makes a difference but not always. Targeting a platform that is known to have AVX2, instead of detecting AVX2 at runtime and bouncing through the PLT, can make a large difference. PGO remains the largest opportunity.
Re:Someone’s Been Messing with My Subnormals by account42 on Wednesday September 07, 2022 @06:54AM (#32748950)
PGO is not something Gentoo does (outside a few packages like Firefox that have it in their build system) because the profiling cannot be done automatically for arbitrary packages.
Re:Someone’s Been Messing with My Subnormals by TazeTSchnitzel on Tuesday September 06, 2022 @01:12PM (#32740036)
Apple avoid this problem with their OS by having a separate architecture slice for modern x64 (Haswell+).
Re:Someone’s Been Messing with My Subnormals by account42 on Wednesday September 07, 2022 @06:59AM (#32748980)
glibc also supports loading different libraries based on CPU capabilities and some binary distros make use of that.

Still, there are always (admittedly diminishing) returns if you can target the exact CPU you have - pretty sure no binary distro ever had variants for AMD's TBM instructions [0] but my Gentoo install made use of them (which was made absolutely clear when trying to run any of that on a Zen 2 machine lol).

[0] https://en.wikipedia.org/wiki/X86_Bit_manipulation_instructi...

Re:Someone’s Been Messing with My Subnormals by account42 on Wednesday September 07, 2022 @06:47AM (#32748913)
Relevant: https://funroll-loops.probablymalware.lol/Gentoo-is-Rice.htm...

Though compiling for the exact CPU was definitely not insignificant before the amd64 switch which gave a new baseline - many distros still targeted i586.

Re:Someone’s Been Messing with My Subnormals by bombcar on Tuesday September 06, 2022 @12:47PM (#32739715)
It was and people would still use it because “hey it says fast”.

The CPU flags was less interesting to me compared to being able to disable features like X.

Re:Someone’s Been Messing with My Subnormals by p_l on Tuesday September 06, 2022 @12:50PM (#32739747)
There was a big warning that it might produce broken system, iirc