6 ms·
2001 - GCC 3.0: - Introduction of `-ffast-math`: The `-ffast-math` flag was introduced, enabling aggressive floating-point optimizations at the cost of strict I
by spacebacon 2y ago
2001 - GCC 3.0:
- Introduction of `-ffast-math`: The `-ffast-math` flag was introduced, enabling aggressive floating-point optimizations at the cost of strict IEEE compliance.
2004 - GCC 3.4:
- Refinements and Extensions: Additional optimizations added, including better handling of subnormal numbers and more aggressive operation reordering.
2007 - GCC 4.2:
- Introduction of Related Flags: `-funsafe-math-optimizations` flag introduced, offering more granular control over specific optimizations.
2010 - GCC 4.5:
- Improvements in Vectorization: Enhanced vectorization capabilities, particularly for SIMD hardware using SSE and AVX instruction sets.
2013 - GCC 4.8:
- More Granular Control: Introduction of flags like `-fno-math-errno`, improving efficiency by assuming mathematical functions do not set `errno`.
2017 - GCC 7.0:
- Enhanced Complex Number Optimizations: Improved performance for complex number arithmetic, benefiting scientific and engineering applications.
2021 - GCC 11.0:
- Better Support for Modern Hardware: Optimizations leveraging modern CPU architectures and instruction sets like AVX-512.
2024 - GCC 13.0 (Experimental):
- Experimental Features: Additional optimizations focused on new CPU features and better handling of edge cases.
Sources:
- GCC documentation archives
- Release notes from various GCC versions
- [GCC Wiki](https://gcc.gnu.org/wiki/ https://gcc.gnu.org/wiki/)
- [Krister Walfridsson's blog](https://kristerw.github.io https://kristerw.github.io)
- amluto 2y agoYour timeline is missing: 2012: I file the obvious bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55522 Early 2023: bug is fixed. Feb 2024: clang follows suit: https://github.com/llvm/llvm-project/pull/80475 https://github.com/llvm/llvm-project/pull/80475 And maybe later this year this problem will finally be gone in common Linux distros.
- SAI_Peregrinus 2y agoPlenty of OSS authors are contributing from work, so there's a good chance they're running LTS distros. Give it another few years for those to get updated.
- duped 2y agoI don't want to read through 11 years of comments, but what does observable effects does corrupting mxcsr have? Surely it's just enabling FTZ/DAZ mode for the FPU which could harm bit-exactness in floating point math... but in code that cares about it, it's not uncommon to see RAII guards to configure the behavior you want (and usually, it's desirable to not comply with IEEE754 w.r.t subnormal numbers). Like it's a quirk that floating point math can be non-deterministic but how bad is it, and is it actually a bug?
- mbauman 2y agoI think the biggest thing is that programmers can safely assume that a floating point `x-y` is nonzero if `x != y`. You can actually go farther and know that it's an exact computation (with no error) if the two are close [1]. But both results only hold if subnormals don't flush to or behave like zero. It's not too hard to imagine how an algorithm might depend upon that — there could be a branch for the case where `x == y` and then a branch that relies upon dividing by `(x-y)` and assumes that it's not a division by zero. 1. https://en.wikipedia.org/wiki/Sterbenz_lemma https://en.wikipedia.org/wiki/Sterbenz_lemma
- duped 2y agoI don't think an algorithm that relies on this is particularly well designed. Anything that trusts a float is non-zero is probably some kind of division where you must avoid division by zero. In that case you should explicitly checking for the zero condition instead of relying on the semantics of real numbers, since floats are not real numbers.
- mbauman 2y agoThat’s precisely the misapprehension that makes folks think that -ffast-math is fine. Each and every floating point number is an exact quantity. They are real mathematical objects that identify exact values. They just have limited precision and might round (think snap) to the nearest representable number after each computation. You might not use them that way, but it doesn’t mean others shouldn’t.