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

Division by infinity problem

krzysztofpiotrowski
409 Views

Hello,

I am using IPP 2017 update 3 as single-threaded static library on Visual Studio 2015. My runtime environments are:

  • Intel® Core™ i7-3770 CPU @ 3.40GHz on Windows 7,
  • Intel® Xeon® CPU E5-1650 v4 @ 3.60GHz on Windows 10.

I found a problem with division of finite number by infinity (like 1/inf) with the following functions:

  • ippsDiv_32f,
  • ippsDiv_32f_I,
  • ippiDiv_32f_C1R,
  • ippiDiv_32f_C1IR

As the result of operation I receive NaN instead of 0.

I checked that the problem does not exist on Intel® Core™2 Quad Processor Q8400 CPU.

I also confirmed that the problem does not exist on i7 and Xeon CPUs when I enable only these features which are supported by Core 2 Quad:

  • ippCPUID_MMX,
  • ippCPUID_SSE,
  • ippCPUID_SSE2,
  • ippCPUID_SSE3,
  • ippCPUID_SSSE3,
  • ippCPUID_SSE41.

When I enable ippCPUID_SSE42 feature, the problem can be spot again.

I checked also ippsDiv_64f and it seems the it works properly.

Please also find the attached full table of results for different set of cpuFeatures and particular division arguments.results.png

0 Kudos
4 Replies
Chao_Y_Intel
Moderator
409 Views

HI,  thanks for your report.  We rooted the problem, and will fix it in our future product release ( likely it will in IPP 2018 update 1 release).

Regards,
Chao

0 Kudos
krzysztofpiotrowski
409 Views

I'd like to confirm that the problem has been fixed in IPP 2018 Update 1. Thank you very much for your support.

0 Kudos
Wieszok__Zygfryd
Beginner
409 Views

Dear Chao

I have verified the results of division operation in Ipp 2018 Update 1 and there are still some issues with infinity arithmetics. The division operation for 1 / inf and 0 / inf works correctly but there are still some issues for inf / constant.

For example for the given code:

#include <ipp.h>
#include <limits>
#include <iostream>

int main()
{
	ippInit();

	const IppLibraryVersion *lib;
	lib = ippsGetLibVersion();
	printf("CPU       : %s\n", lib->targetCpu);
	printf("Name      : %s\n", lib->Name);
	printf("Version   : %s\n", lib->Version);
	printf("Build date: %s\n", lib->BuildDate);


	auto inf = std::numeric_limits<float>::infinity();

	int step1, step2, step3;
	
	float* a = ippiMalloc_32f_C1(1, 1, &step1);
	float* b = ippiMalloc_32f_C1(1, 1, &step2);
	float* c = ippiMalloc_32f_C1(1, 1, &step3);

	a[0] = inf;
	b[0] = 10;
	for (size_t i = 0; i < 9; i++)
	{
		b[0] += 0.1;
		ippiDiv_32f_C1R(b, step1, a, step2, c, step2, { 1,1 });
		std::cout <<  a[0] << " / " << b[0] <<" =  Without IPP: " << a[0] / b[0] << " Ipp: " << c[0] << std::endl;
	}
}

the results are as follow:

as you can see the results are not stable.

Regards
Zygfryd

0 Kudos
Chao_Y_Intel
Moderator
409 Views

thanks Zygfryd.  We will check this.

regards,
Chao

 

0 Kudos
Reply