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

ippsFilterMedian_32f broken with misaligned pDst and AVX

frayien
Beginner
380 Views

Hello,

The ippsFilterMedian_32f does not yield to a correct result when any AVX cpu feature is enable/available.

 

Tested with IPP 11.0, tested on both Linux and Windows, on multiple computers with AVX, AVX2 and AVX512.

 

Minimal reproduction code :

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

#define PX_FM ( ippCPUID_MMX | ippCPUID_SSE | ippCPUID_SSE2 )
#define M7_FM ( PX_FM | ippCPUID_SSE3 )
#define U8_FM ( M7_FM | ippCPUID_SSSE3 )
#define N8_FM ( U8_FM | ippCPUID_MOVBE )
#define Y8_FM ( U8_FM | ippCPUID_SSE41 | ippCPUID_SSE42 )

int main()
{
ippInit();
// ippSetCpuFeatures(Y8_FM);

int len = 10;
int maskSize = 7;

float pSrc[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
float* pDst = ippsMalloc_32f(17);
// Have pDst be misaligned
pDst = pDst+7;

int bufferSize;
ippsFilterMedianGetBufferSize(maskSize, ipp32f, &bufferSize);
unsigned char* pBuffer = ippsMalloc_8u(bufferSize);

ippsFilterMedian_32f(pSrc, pDst, len, maskSize, nullptr, nullptr, pBuffer);

std::cout << "dst = [ ";
for(int i = 0; i<10; ++i)
std::cout << pDst[i] << " ";
std::cout << "]" << std::endl;

}

 

The shared code computes the effect of a median filter on the input :
src=[ 1 2 3 4 5 6 7 8 9 10 ]

 

The expected result is :
dst = [ 1 1 1 1 2 3 4 5 6 7 ]

 

The actual result (on a computer with AVX) is :
dst = [ 1 1 2 2 3 3 4 5 6 7 ]

The actual result is erroneous.

Either
- uncommenting the line 13 "ippSetCpuFeatures(Y8_FM);" to disable AVX
- commenting the line 21 "pDst = pDst+7;" to have the destination aligned to 64 bytes yield the expected result.

0 Kudos
3 Replies
Ruqiu_C_Intel
Moderator
323 Views

Do you mean IPP version 2021.11?

0 Kudos
frayien
Beginner
313 Views

Oh sorry, I mean version 2022.0 (last version available today) (11.0 is the SOVERSION...)
Note that it is broken since at least 2021.8

0 Kudos
Aleksandra_K
Employee
215 Views

Thank you for noting the issue. I reproduced it and we'll work on it internally. I will update here once there is progress.


Best regards,

Aleksandra


0 Kudos
Reply