ippiSqrt_32f is causing _EM_INVALID floating point error

ippiSqrt_32f is causing _EM_INVALID floating point error

Mikhail Matrosov的头像

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.

8 帖子 / 0 new
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项
Sergey Kostrov的头像

>>...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 )

Gennady Fedorov (Intel)的头像

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

Sergey Kostrov的头像

>>...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 ) );
...

Mikhail Matrosov的头像

Quote:

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?

Mikhail Matrosov的头像

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

Sergey Kostrov的头像

>>...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.

Sergey Kostrov的头像

>>...Could you provide any details on what Gennady Fedorov said?

No.

登陆并发表评论。