Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

ippsMagnitude/SSEx rounding issues?

tjkelman
Beginner
314 Views
Hello all,

Our application requires computation of an acoustic wave envelope, and thus the ippsMagnitude function is very appropriate for our needs. What I wasn't expecting is that the Ipp32f (float) version of this routine would have rounding behavior different from its scalar counterpart, which is really to say (I believe) that SSEx floating point instruction rounding is different that its scalar instruction counterpart. To illustrate, I wrote test code (attached) which compares scalar vs. vector calculation of magnitude. Example results are below:

x=5 y=24005 res1=24005 res2=24004.998046875
x=5 y=24007 res1=24007 res2=24006.998046875
x=5 y=24012 res1=24012.001953125 res2=24011.998046875
x=5 y=24014 res1=24014 res2=24013.998046875

Note: res1 is the result of the scalar operation, res2 is the result of the vector operator, and x & y can be considered as the real and imaginary parts, respectively.

I've used the "floor" function to catch the most egregious rounding differences between the scalar & vector operations, in which the vector operator actually returns a value *less* than either the real or the imaginary component - an obvious impossibility from a magnitude calculation. I understand the notion of rounding error with base-2 calculations, but I am curious about the difference in scalar vs. vector rounding, since the 32-bit floating point scalar operations seem to suffer much less effect than the vector operations.

To summarize, I would just like to confirm that this is indeed a function of SSEx instructions, and not of the IPPS library itself. For our purposes, it makes the 32-bit floating point IPPS routines very difficult to use, so confirmation is very important for our purposes.

Many thanks for your time,
-todd


p.s. We're running IPP 5.1 Windows on a Pentium IV.

Todd Kelman, Engineering Consultant
Volcano Corporation
2870 Kilgore Rd.
Rancho Cordova, CA 95670
tkelman@volcanocorp.com

Message Edited by tjkelman on 06-22-200612:38 PM

Message Edited by tjkelman on 06-22-200612:39 PM

0 Kudos
1 Reply
Vladimir_Dudnik
Employee
314 Views

Hello Todd,

there is answer from our experts

IppsMagnitude_32f function uses Newton-Raphson algorithm for square root calculation (2 iterations). This method have relative error about 1.e-7. Therefore the result of this function for sourse data x=5 y=24005 is 24004.998 whereas accurate result must be 24005.0005. (The releative error is equal (24005.0005-24004.998)/24005.0005=1e-7.) After rounding-to-zero we obtain the ending result 24004 instead 24005.

You can solve this problem if you will use data of double type (Ipp64f).

Regards,
Vladimir

0 Kudos
Reply