Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle systems that do not support denormalized floats #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

schiele
Copy link
Contributor

@schiele schiele commented Apr 8, 2023

A feature of gcc on Intel platforms is to enable the FTZ and DAZ features available on modern Intel CPUs. Those features convert denormal floating point values to zero to avoid expensive and slow exception handling inside the CPU. Details can be found at https://www.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/floating-point-operations/set-the-ftz-and-daz-flags.html

Some Linux distributions now started to make this flag the compiler default and build the standard runtime libraries with this switch turned on. On those systems the definition of least---float evaluates to zero, no longer adhering to their specification, and as such failing test cases relying on them. Compiling sbcl with this compiler feature explicitly turned off is not preventing this problem from happening since we use functions from libm that is built with this switch turned on and as such will apply the conversions nevertheless to our surprise.

Therefore this introduces a new feature "normalize-float" for systems with that behavior. This automatically gets switched on by an automated test. The test is designed to detect similar behavior also on non-Intel systems. The definitions of least---float are adapted accordingly.

This can be found at https://bugs.launchpad.net/sbcl/+bug/2002810 as well.

@schiele
Copy link
Contributor Author

schiele commented Apr 21, 2023

Rebased to master to make the changes compatible with the recently added Android build.

A feature of gcc on Intel platforms is to enable the FTZ and DAZ
features available on modern Intel CPUs. Those features convert
denormal floating point values to zero to avoid expensive and slow
exception handling inside the CPU. Details can be found at
https://www.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/floating-point-operations/set-the-ftz-and-daz-flags.html

Some Linux distributions now started to make this flag the compiler
default and build the standard runtime libraries with this switch
turned on. On those systems the definition of least-*-*-float evaluates
to zero, no longer adhering to their specification, and as such failing
test cases relying on them. Compiling sbcl with this compiler feature
explicitly turned off is not preventing this problem from happening
since we use functions from libm that is built with this switch turned
on and as such will apply the conversions nevertheless to our surprise.

Therefore this introduces a new feature "normalize-float" for systems
with that behavior. This automatically gets switched on by an automated
test. The test is designed to detect similar behavior also on non-Intel
systems. The definitions of least-*-*-float are adapted accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant