Reducing the Impact of
Denormalizedfloating-point values are those that are too small to be represented in the normal manner; that is, the mantissa cannot be left-justified.
Denormal values require hardware or operating system interventions to handle the computation, so floating-point computations that result in
denormalvalues may have an adverse impact on performance.
There are several ways to handle
denormalsto increase the performance of your application:
- Scale the values into the normalized range
- Use a higher precision data type with a larger range
- Flushdenormalsto zero
For example, you can translate them to normalized numbers by multiplying them using a large scalar number, doing the remaining computations in the normal space, then scaling back down to the
denormalrange. Consider using this method when the small
denormalvalues benefit the program design.
Consider using a higher precision data type with a larger range; for example, by converting variables declared as
floatto be declared as
double. Understand that making the change can potentially slow down your program. Storage requirements will increase, which will increase the amount of time for loading and storing data from memory. Higher precision data types can also decrease the potential throughput of Intel® Streaming SIMD Extensions (Intel® SSE) and Intel® Advanced Vector Extensions (Intel® AVX) operations.
If you change the type declaration of a variable, you might also need to change associated library calls, unless these are generic;
; for example,.
Another strategy that might result in increased performance is to increase the amount of precision of intermediate values using theYou should verify that the gain in performance from eliminating
-fp-model [double|extended]option. However, this strategy might not eliminate all
denormalexceptions, so you must experiment with the performance of your application.
denormalsis greater than the overhead of using a data type with higher precision and greater dynamic range.
In many cases,
denormalnumbers can be treated safely as zero without adverse effects on program results. Depending on the target architecture, use flush-to-zero (
IA-32 and Intel® 64 Architectures
These architectures take advantage of the