6 comments

  • pixelpoet 21 minutes ago
    This has been the case since a zillion years, since the Core 2 Duo days at minimum.
    • account42 14 minutes ago
      The interesting part is that this seems to be Intel-specific.
  • juancn 1 hour ago
    Apparently it only happens on P-cores, recent E-cores have a fast path for subnormals.
    • rustybolt 21 minutes ago
      That seems weird. They did throw extra hardware at it to speed it up for the efficient cores, but not for the performance cores?
  • khuey 47 minutes ago
    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.
    • bee_rider 20 minutes ago
      IIRC intel’s compilers enable FTZ/DAZ, at least at higher optimization levels.
  • gwbas1c 23 minutes ago
    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?

    • ant6n 6 minutes ago
      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.

  • rf15 1 hour ago
    ...Is this running extra micro code to fix some hardware bug/unreliability? How can this happen? Doesn't look like a normal design decision.
    • Sharlin 1 hour ago
      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.

    • aardvark179 1 hour ago
      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.

    • duped 31 minutes ago
      It's to satisfy IEEE 754 and it's been this way for decades.
      • pohl 29 minutes ago
        Does that mean that the ARM processors in the writeup are not satisfying IEEE 754?
        • tasty_freeze 16 minutes ago
          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.