- 93comments
- —discuss
- 150comments
- 37comments
- 14comments
- 58comments
- 135comments
- 1comments
- —discuss
- 69comments
- 30comments
- 352comments
- 50comments
- 156comments
- 630comments
- 254comments
- 97comments
- 4comments
- 174comments
- 80comments
- 10comments
- 239comments
- 53comments
- 150comments
- 165comments
- —discuss
- 22comments
- 74comments
- 28comments
- 30comments
...Is this running extra micro code to fix some hardware bug/unreliability? How can this happen? Doesn't look like a normal design decision.
Subnormal numbers have a different, basically fixed-point, representation. They exist in order to bridge the large (relatively speaking; indeed "infinite" in a sense) gap between the least positive normal number, zero, and the greatest negative normal number, caused by the usual significand-exponent representation.
Most "mundane" uses of floating point have no need for subnormal numbers, and numbers that underflow could just be flushed to zero. But they’re sometimes important in scientific computing to ensure sufficient smoothness around zero, avoiding precision issues.
I don’t know if any bugs contribute to this but this in the intel case but it has been very common historically for subnormal performance to be lower on many processors, and things like the Alpha required you to handle them in software if the COU fired a trap.
Have a look at https://en.wikipedia.org/wiki/Subnormal_number for some context.
It's to satisfy IEEE 754 and it's been this way for decades.
Does that mean that the ARM processors in the writeup are not satisfying IEEE 754?
It probably means Apple spent the silicon to handle subnormals at full speed in hardware, rather than triggering a slow microcode handler for such numbers.
Apparently it only happens on P-cores, recent E-cores have a fast path for subnormals.
That seems weird. They did throw extra hardware at it to speed it up for the efficient cores, but not for the performance cores?
If you don't _need_ subnormals MXCSR.DAZ/FTZ (which you can get gcc to set via -mdaz-ftz) will let you ignore all of this.
IIRC intel’s compilers enable FTZ/DAZ, at least at higher optimization levels.
I'm still trying to understand what a subnormal number is; IE, I'm looking for the TLDR so I know just enough to know if I'm using them and need to learn more.
Unfortunately, the Wikipedia article, while probably being accurate, doesn't give a clear and concise answer.
IE, is 0.0001 a subnormal? Or is it 0.000000000000000000001?
Usually IEEE floats have an implied 1 in the front. So for the standard represented numbers, there's some minimum number 1.bbbbbb.. * 2^-N. This allows 1bit more precision than is actually stored.
between any two numbers, there's basically the same epsilon difference, but from the smallest number to zero it's bigger.
A subnormal number breaks that convention, it just becomes 0.bbbbb... * 2^-N. As the numbers get smaller, the relative difference between the numbers gets larger. That also means their precision is smaller than the normal floats.
This has been the case since a zillion years, since the Core 2 Duo days at minimum.
The interesting part is that this seems to be Intel-specific.