Community
cancel
Showing results for
Did you mean:
Beginner
129 Views

ippiFilterGetBufSize_64f_C1R fails (sometimes) under 32 bit (for 1D vertical filter Kernels)

Hi,

we first noticed the following issue under Linux 32 bit (on a VM pretending to be an Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz, and on a real Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz.  However, in trying to narrow this down to a minimal testcase will could also reproduce essentially the same error (not quite as reliably, and for different input) under Windows 32 Bit on an Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz.

However, due to the more reliable reproducibility under Linux I'll concentrate on this for now.

The code below filters an image (at several resolutions, as the exact size for which this happens varies with CPU) with a 1D vertical Kernel (in my test 7 is the smallest kernel size for which this fails).

It SHOULD produce an image where, except for the first and last 3 lines, everything is filled with '7.0'.

Instead, for some image sizes you will see a swath of zeros going diagonally through the image and the last line either filled with '3.0' (which should never be calculated) on Linux or random memory content on Windows.

Maybe we are using the function wrong (but not sure how)?  Anyway, here's the code, any pointers appreciated:

#include <vector>
#include "ipp.h"
#include "ippi.h"

int main()
{
int nBorder = 3;
int nKernelSize = 7;
IppiSize kernelSize = { 1, nKernelSize };
IppiPoint anchor = { 0, nKernelSize/2 };
std::vector<double> aKernel(nKernelSize, 1.);

for (int nWidth = 4; nWidth < 25; ++nWidth)
{
int nPitch = 2 * nBorder + nWidth;

aSrc.resize(nPitch*nPitch);
aSrc.assign(nPitch*nPitch, 0.);

//for (size_t y = 0; y < 2 * nBorder + nWidth; ++y)
for (size_t y = nBorder; y < nBorder + nWidth; ++y)
{
for (size_t x = nBorder; x < nBorder + nWidth; ++x)
{
aSrc[y*nPitch + x] = 1.;
}
}

IppiSize dstRoiSize = { nWidth, nWidth };
int nBufferSize = 0;
IppStatus status = ippiFilterGetBufSize_64f_C1R(kernelSize, nWidth, &nBufferSize);
std::vector<Ipp8u> aBuffer(nBufferSize);

status = ippiFilter_64f_C1R(&(aSrc[nPitch*nBorder+nBorder]), (int)(nPitch * sizeof(aSrc[0])),
aKernel.data(), kernelSize, anchor, aBuffer.data());
(void)status;

// we expect an image full of nKernelSize, except for the first and last nKernelSize/2 lines
bool bFail = false;
for (int y = nKernelSize/2; y < nWidth-nKernelSize/2; ++y)
{
for (int x = 0; x < nWidth; ++x)
{
if (nKernelSize != aDst[y*nWidth + x])
{
bFail = true;
}
}
}

if (bFail)
{
printf("Failure for nWidth = %d\n", nWidth);
for (int y = 0; y < nWidth; ++y)
{
for (int x = 0; x < nWidth; ++x)
{
printf("%3.1f ", aDst[nWidth * y + x]);
}
printf("\n");
}
}
}
return 0;
}


In my tests this fails for

• nWidth \in {18, 20, 22} on the E5-2640
• nWidth \in {16, 24} on the i7-5820K
• nWidth \in {16, 18, 20} on the E5-1620 under Windows, but not quite as reproducible.

Any help very much appreciated!

Sven

6 Replies
Beginner
129 Views

Damn, the subject should of course have read "ippiFilter_64f_C1R fails (sometimes) under 32 bit (for 1D vertical filter Kernels)", but not allowed to change that (why?).

And since we're changing things:

• nPitch might better be called nStride
• It might have been worth pointing out that it also fails for much bigger images, we first noticed the problem at 328x364 pixels (apparently only under Linux 32)
Employee
129 Views

Hi Sven.

You are right. It is bug in IPP library in special code path for 1xH kernel mask. This bug will be fixed at nearest IPP release. As workaround you can try to call IPP with 2xH mask where last column is zero.

Beginner
129 Views

Hi,

looks like it wasn't fixed in 9.0.4 (see https://software.intel.com/en-us/articles/intel-ipp-90-bug-fixes) - any idea when a fix will be out?

Thanks, Sven

Employee
129 Views

Sven, Can you check the latest 2017 update 1 release? This problem is expected to be fixed in the release.

thanks,
Chao

Beginner
129 Views

Excuse the noop question, but is this a different branch from the 9.0.x line, or a change in version number, or what?

Where would I download this from, or is this only available as part of parallels?

Thank you very much!

Sven

Employee
129 Views

Hi Sven,

the version go as  IPP 9.0.x, then IPP 2017 , IPP 2017 update 1.  You can gotten  such information from

https://software.intel.com/en-us/articles/which-version-of-the-intel-ipp-intel-mkl-and-intel-tbb-lib...

Best Regards,

Ying