Community
cancel
Showing results for 
Search instead for 
Did you mean: 
vimal_bhatia1
Beginner
72 Views

Newbie question: Integer Matrix or vector maths in IPP (or any other)

Hi,

I will be grateful if someone can tell if there are any functions to perform Integer maths using IPP.

Basically, I want to multiply a 3x3 matrix with 3x1 vector. Currently all the code is scalar and hence the performance sucks!, I hope to improve the performance using SIMD features of the processor, however can't find function which does maths on INTEGERS (16-bit).

I found an intrinsic which does only floating point 32 or 64-bit arithematic and not INTEGER.

If there is no such library, are there libraries for vector-vector DOT product or vector addition (adding all elements) in SIMD data-type.

Many thanks

Newbie

0 Kudos
3 Replies
Vladimir_Dudnik
Employee
72 Views

I would recommend you to start from looking at IPP documenation. Especially if you are newbie with IPP

You can try the following function

DotProd:

IPPAPI(IppStatus, ippsDotProd_16s_Sfs, (const Ipp16s* pSrc1,

const Ipp16s* pSrc2, int len, Ipp16s* pDp, int scaleFactor))

IPPAPI(IppStatus, ippsDotProd_16sc_Sfs,(const Ipp16sc* pSrc1,

const Ipp16sc* pSrc2, int len, Ipp16sc* pDp, int scaleFactor))

IPPAPI(IppStatus, ippsDotProd_16s16sc_Sfs, (const Ipp16s* pSrc1,

const Ipp16sc* pSrc2, int len, Ipp16sc* pDp, int scaleFactor))

IPPAPI(IppStatus, ippsDotProd_16s64s, (const Ipp16s* pSrc1,

const Ipp16s* pSrc2, int len, Ipp64s* pDp))

IPPAPI(IppStatus, ippsDotProd_16sc64sc, (const Ipp16sc* pSrc1,

const Ipp16sc* pSrc2, int len, Ipp64sc* pDp))

IPPAPI(IppStatus, ippsDotProd_16s16sc64sc,(const Ipp16s* pSrc1,

const Ipp16sc* pSrc2, int len, Ipp64sc* pDp))

IPPAPI(IppStatus, ippsDotProd_16s32f, (const Ipp16s* pSrc1,

const Ipp16s* pSrc2, int len, Ipp32f* pDp))

IPPAPI(IppStatus, ippsDotProd_16sc32fc, (const Ipp16sc* pSrc1,

const Ipp16sc* pSrc2, int len, Ipp32fc* pDp))

IPPAPI(IppStatus, ippsDotProd_16s16sc32fc,(const Ipp16s* pSrc1,

const Ipp16sc* pSrc2, int len, Ipp32fc* pDp))

Math:

IPPAPI(IppStatus, ippsAdd_16s_ISfs, (const Ipp16s* pSrc, Ipp16s* pSrcDst,

int len, int scaleFactor))

IPPAPI(IppStatus, ippsAdd_16sc_ISfs, (const Ipp16sc* pSrc, Ipp16sc* pSrcDst,

int len, int scaleFactor))

IPPAPI(IppStatus, ippsSub_16s_ISfs, (const Ipp16s* pSrc, Ipp16s* pSrcDst,

int len, int scaleFactor))

IPPAPI(IppStatus, ippsSub_16sc_ISfs, (const Ipp16sc* pSrc, Ipp16sc* pSrcDst,

int len, int scaleFactor))

IPPAPI(IppStatus, ippsMul_16s_ISfs, (const Ipp16s* pSrc, Ipp16s* pSrcDst,

int len, int scaleFactor))

IPPAPI(IppStatus, ippsMul_16sc_ISfs, (const Ipp16sc* pSrc, Ipp16sc* pSrcDst,

int len, int scaleFactor))

Regards,
Vladimir

vimal_bhatia1
Beginner
72 Views

Thanks Vladimir.

I was wondering if there are any primitives for

1) Matrix-Vector multiplication for integers

2) Multiply even and odd(seperately) 16-bit integer of 128 bit word i.e.

C[0] = A[0]*B[0]

C[1] = A[2]*B[2]

....

C[3] = A[6]*B[6]

And

D[0] = A[1]*B[1]

D[1] = A[3]*B[3]

...

D[3] = A[7]*B[7]

i.e some modification of "ippsMul_16s32s_Sfs()"

Thanks,

Newbie

vimal_bhatia
Beginner
72 Views

Hi,

I am performing a basic operation where I multiply a 3x3 matrix with 3x1 vector, and get another 3x1 vector.

All my inputs are 16-bit integers. The coefficients in the matrix remains constants, however the input vector change. Input 3x1 vector is 1000-elements long. So it can be assumed that I multiply the 3x3 with 3x1 input vector, fill the 3x1 input vector again and then multiply and then keep on doing so 1000 times.

I wrote both a scalar and a vector (SIMD) version of the code. To my surprise, thescalar version's performance is stillbetter than vector (SIMD) version using the IPP libraries.

Any suggestions pointer would be greatly useful.

Thanks
Vimal

Reply