MSVC project for IPP5.0 Custom DLL

MSVC project for IPP5.0 Custom DLL

Hi, there,

I was trying to create a MSVC project for generating custom DLL for ipp5.0. I kept getting buffer overran problem with a simple test program. It is a simple matrix multiplication test. When the output buffer is the exact length it should be, the program crashes. If I increase the buffer, the program will finish but with the addition several byte overran by garbage data. The matrix multiplication results are correct though.

If I use makefile as illustrated in the manual, it won't cause crash.

I used the same project for ipp4.1. It worked fine.

My question is what change in Ipp 5.0 can lead to this buffer overran problem. Does anyone have sucessful experience of building custom DLL using MSVC project instead of makefile?

If anyone wants, I can share my MSVC project for you to troubleshoot.

Thanks in advance!

Fan
Code:

int _tmain(int argc, _TCHAR* argv[])
{
     Ipp64f pSrc1[3*4] = { 1, 2, 3, 4,
          5, 6, 7, 8,
          4, 3, 2, 1 };
     int src1Width = 4;
     int src1Height = 3;
     int src1Stride2 = sizeof(Ipp64f);
     int src1Stride1 = 4*sizeof(Ipp64f);

     /* Src2 matrix with width=3 and height=4 */
          Ipp64f pSrc2[4*3] = { 1, 5, 4,
          2, 6, 3,
          3, 7, 2,
          4, 8, 1 };
     int src2Width = 3;
     int src2Height = 4;
     int src2Stride2 = sizeof(Ipp64f);
     int src2Stride1 = 3*sizeof(Ipp64f);
     /*
     // Destination matrix has width=src2Width=3 and height=src1Height=3
     */
     //Ipp64f pDst[3*3];                 //<==allocated on stack. Will work.
     Ipp64f* pDst = ippsMalloc_64f( 9 ); //<== allocated on heap. Causing crash. If increase to 12 or larger bytes, it won't crash but will overran the pDst buffer.
     int dstStride2 = sizeof(Ipp64f);
     int dstStride1 = 3*sizeof(Ipp64f);
     IppStatus status = ippmMul_mm_64f((const Ipp64f*)pSrc1, src1Stride1,
          src1Stride2, src1Width, src1Height, (const Ipp64f*)pSrc2,
          src2Stride1, src2Stride2, src2Width, src2Height,
          pDst, dstStride1, dstStride2);
     ippsFree( pDst ); //<===== crash

     return 0;
}
16 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Fan,

there is answer from our expert

Thisproblem isnt concern with any project building features. An unfortunatelythere is a bugin ippmMul functionin IPP5.0.
This mistake has been already fixed to IPP5.1. One workaround today is to use IPP5.0 ippmpx library instead of processor specific version (ippmw7).

PX version is correct.

Regards,
Vladimir

Thanks for answering my question.

I have to say this: for tough technical problem, posting question on the forum is more effective than talking with premier tech-support.

I recall another post said the same thing.

Good work! Vladimir, althought I guess I did not get paid for QA IPP 5.0. :)

Fan

Thank you. By the way, providing a way and possibilityfor quick answering such technical but easy to answer questionswas the main goal of creating this forum. We are glad that it work as expected:)

Vladimir

I was expecting this rudimentary bug being fixed in 5.1 after I found and reported it in 5.0. However, to my extreme surprise, it is NOT!If multiplying two matrices will cause buffer overrun in 5.x, I am not sure anyone dare to venture further into using the whole library with their prodcuts.I should report it to tech-support. But I could not log into the tech-support website this morning. (I was being asked changing password after logging in. After trying about a dozen of new passwords following the most strict rules of passwords I have seen, it still told me my passwords did not pass their rules. )I admit that I am frustrated right now. But look at the way INTEL treates its customers. It is not a surpise to anyone that AMD is catching up quickly...Fan

well, I apologize for the harsh words in the post above. If IPP wasn't an integral part of our product, I won't be pissed off like that.

FYI, I also tried regular dynmaic dll and static linkage with dispatch. It showed exactly the same results. I am not going to try that catch-all (px)version of IPP functions since it defeats the whole point of using IPP.

I would appreciate very much if host can forward this message to the IPP dev team. I could not log in the tech-support for some reason today.

Many thanks.

Fan

Hi Fan,

thank you for reporting this issue again, we will double check this. It should be fixed in IPP v5.1 according engineering response.

We also will create issue on Premier for you.

Regards,
Vladimir

Fan,

we are apologize if you still have issue with that functions. But IPP engineer has provided some modification of your test code. He successfully tested this with IPP v5.1. Could you please check if it solve your problem?

Engineer also commented that you probably use wrong size of destination matrix in case of both operands are transposed. Code below should demonstrate correct usage.

Code:

int _tmain(int argc, _TCHAR* argv[])
{
     Ipp64f pSrc1[3*4] = { 1, 2, 3, 4,
          5, 6, 7, 8,
          4, 3, 2, 1 };
     int src1Width = 4;
     int src1Height = 3;
     int src1Stride2 = sizeof(Ipp64f);
     int src1Stride1 = 4*sizeof(Ipp64f);

     /* Src2 matrix with width=3 and height=4 */
          Ipp64f pSrc2[4*3] = { 1, 5, 4,
          2, 6, 3,
          3, 7, 2,
          4, 8, 1 };
     int src2Width = 3;
     int src2Height = 4;
     int src2Stride2 = sizeof(Ipp64f);
     int src2Stride1 = 3*sizeof(Ipp64f);
     /*
    // As the both operands are transposed matrices
    // destination matrix has dstWidth=src2Height=4 and dstHeight=src1Width=4
     */
     //Ipp64f pDst[4*4];                 .
     Ipp64f* pDst = ippsMalloc_64f( 16 ); 
     int dstStride2 = sizeof(Ipp64f);
     int dstStride1 = 4*sizeof(Ipp64f);
     IppStatus status = ippmMul_tt_64f((const Ipp64f*)pSrc1, src1Stride1,
          src1Stride2, src1Width, src1Height, (const Ipp64f*)pSrc2,
          src2Stride1, src2Stride2, src2Width, src2Height,
          pDst, dstStride1, dstStride2);
     ippsFree( pDst );

     return 0;
}

Destination matrix: 
42.000000  44.000000  46.000000  48.000000  
44.000000  49.000000  54.000000  59.000000  
46.000000  54.000000  62.000000  70.000000  
48.000000  59.000000  70.000000  81.000000  

Anyway, I'll inform IPP engineers and technical support engineers to re-open your previus issue or to create new one, so you will get notification email to track status of that.

Thanks,
Vladimir

Vladimir,

I know I can count on you. :) I got emails from the tech-support acknowledging the case is re-opened.

I hope I was wrong in understanding the "transposeness" of a matrix. But in your code posted above, it does multiplication of two transposed matrices. That is not what I intend to do. I want to multiply two matrices as they are defined. We are testing two different IPP functions.

Actually, my original code was copied from a source from INTEL. If you look at the page 5-42 of the matrix manual, mine is almost identical to that code with trivial differences.

I still could not log into the tech-support. My bookmark did not work. It seems thatthe link on your site pointing to tech-supportcould not find the webpage either. Could you please point me to the right URL if the site is available right now please?

Thanks a bunch...

Fan

Fan,

could you please attach simple test case, so we can verify issue exactly on your code (with all that trivial changes). Just to be sure that we catch your case, because of no issues in our internal testing, which is good enough, to be honest.

Regarding accessing to technical support, please try to login to Intel Premier Support site.

Regards,
Vladimir

Code:

#include "stdafx.h"
//#include "ipp.h"
#include "IPPCustomDll.h"
#include 
void main(int argc, char* argv[])
{
 /*const int SIZE = 256;
 Ipp8u pSrc[SIZE], pDst[SIZE];

 int i;
 for (i=0; i

Here is the code I used without any modification. It will crash at vs_ippsFree(...). The prefix "vs_" is added in my custom dll project. But I did try using IPP as regular DLL, in which case there is no "vs_", the problem still exists, at least it does on my machine...Thanks.Fan

I've tested you code with original IPP static libraries, no issues was detected. So, probably issue is at making custom library stage. Could you also specify what OS and processor do you use?
Could you also list steps you did when generating custom library? Important to knowthe list offunctions you place in your custom library and what defines you use when compile it.

Vladimir

Thanks, Vladimir.

I also linked that simple code with static library. But I got the same result. I am glad that finally we might getting close to where the problem is.

I am trying to reinstall IPP v.5.1. But it did not find my old license file and started asking for serial number. The serial number I have inside the CD box doesn't work. I already informed the tech-support on this issue. I bought v.4.1 with commerical license. I don't need to pay for v. 5.1, don't I ?

I will let you know if it works with my static library afterre-installing v. 5.1

Thanks.

Fan

Dear Fan,

We are working for ourregistration team for your account in our premier support . We will resend your the new password.

Regards,

Chao

Problem solved.I think the problem is related if not 100% caused by the expired license file. I asked our IT department to renew the license and re-registered the new serial number, wala, everything works now. Another thing I did is to re-download v5.1 to make sure I got the latest and the greatest.The very first time I tested v5.1, at least I thought it was v 5.1, the installation program seemed happy with my expired license. The installation file is called "w_ipp_ia32_p_5[1].1.017.exe". I downloaded and saved it when 5.1 just came out. The latest v5.1 file is called w_ipp_ia32_p_5.1.017.exe. I probably was testing some beta version of v5.1 when I cried like a girl for help...Anyway, I am happy that everything is back on track now. Thanks for INTEL tech-support team.Fan

Hi Fan,

thanks for updating on this. We glad that you find solution. Please feel free to communicate any issues.

Regards,
Vladimir

Leave a Comment

Please sign in to add a comment. Not a member? Join today