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

ippiSqrt_32f is causing _EM_INVALID floating point error

Mikhail_Matrosov
541 Views

I'm using Intel IPP v7.0.205. When I call ippiSqrt_32f_C1IR for image containig zero pixels I occasionally encounter floating point exception _EM_INVALID. The excpetion is thrown only on several computers. The answer is always correct and sqrt is properly computed for an image. I'm currently forced to disable this error with _controlfp_s function. I'm sure an image contains no negative pixels.

The same problem exists for ippiExp_32f_C1IR applied for image with -Inf pixels. The result is correctly computed as zero, but the exception is occasionally thrown.

I tested this under Windows 7 x64, Visual Studio 2010 SP1 Professional.

0 Kudos
7 Replies
SergeyKostrov
Valued Contributor II
541 Views
>>...I'm using Intel IPP v7.0.205. When I call ippiSqrt_32f_C1IR for image containig zero pixels I occasionally encounter >>floating point exception _EM_INVALID. The excpetion is thrown only on several computers. The answer is always correct and >>sqrt is properly computed for an image. I'm currently forced to disable this error with _controlfp_s function. I'm sure an image >>contains no negative pixels. - Did you try to use _control87 CRT-function instead? ( it is similar to _controlfp_s but I would try anyway ) - Could you provide a test-case? - You could also try to use _MM_SET_EXCEPTION_STATE macro from xmmintrin.h header file ( macro provides direct control of SSE exceptions )
0 Kudos
Gennady_F_Intel
Moderator
541 Views

You can check the 7.1 - if I am not mistaken the similar issue has been fixed in this version.

0 Kudos
SergeyKostrov
Valued Contributor II
541 Views
>>...You could also try to use _MM_SET_EXCEPTION_STATE macro from xmmintrin.h header file... Mikhail, I'd like to make a correction and _MM_SET_EXCEPTION_MASK has to be used: [ xmmintrin.h ] ... #define _MM_SET_EXCEPTION_MASK(mask) \ _mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (mask)) #define _MM_GET_EXCEPTION_MASK() \ (_mm_getcsr() & _MM_MASK_MASK) ... The macros application could look like: ... _MM_SET_EXCEPTION_MASK( _MM_GET_EXCEPTION_MASK() &~( _MM_MASK_INVALID ) ); ...
0 Kudos
Mikhail_Matrosov
541 Views

Sergey Kostrov wrote:

- Did you try to use _control87 CRT-function instead? ( it is similar to _controlfp_s but I would try anyway )

- Could you provide a test-case?

- You could also try to use _MM_SET_EXCEPTION_STATE macro from xmmintrin.h header file ( macro provides direct control of SSE exceptions )

_controlfp_s works fine and I see no reason for me to replace it with anything else.

Unfortunately, the bug is not reproduced on a small test-case I've created. Seems like I need to slice and cut my original project to remove all the unnecessary stuff. I don't have time for that at the moment. Could you provide any details on what Gennady Fedorov said?

0 Kudos
Mikhail_Matrosov
541 Views

I posted a reply, but it is still in the moderation. Why does it take so long?

0 Kudos
SergeyKostrov
Valued Contributor II
541 Views
>>...I posted a reply, but it is still in the moderation. Why does it take so long? I don't know why it takes so long to approve a post. In your case the post was queued because it has a web-link to a user's "home" web-page on IDZ website. Take a look at: Forum topic: Post problem on IDZ website: Message queued for admin approval Web-link: software.intel.com/en-us/forums/topic/369744 for more details.
0 Kudos
SergeyKostrov
Valued Contributor II
541 Views
>>...Could you provide any details on what Gennady Fedorov said? No.
0 Kudos
Reply