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

DMIP crashes when reusing Graphs

Goran_N
Beginner
486 Views
I ran into a DMIP problem, where code is crashing after leaving the function. This is an example of the problem.

Graph g1, g2, g3, g4, g5, g6;
Kernal k;
g1 = Src(src1);
g2 = Src(src2);

g3 = g1 * k;
g4 = g3 * 2;
g5 = g4 * 3;

g6 = g5 * g3; <-- problem

The main point is that graph g5 depends on g3, or another words, if I understand it correctly, g5 destroyed g3 so the g6 cannot be evaluated.

I fixed the problem by duplicating a lot of code:
g3 = g1 * k;
g3_copy = g1 * k;
g4 = g3 * 2;
g5 = g4 * 3;

g6 = g5 * g3_copy;

My actual code is much longer, so there is a lot of duplicated operations, which affects performance. I have a feeling there is a better solution, but I couldn't figure it out. I tried to use Copy, but again, I had to duplicate a lot of code, otherwise it kept crashing.



0 Kudos
11 Replies
Vladimir_Dudnik
Employee
486 Views

Hi,

I'm affraid I did not get what you are trying to do with DMIP. Would be nice if you can provide just arithmetic equation of what you want to achieve.

Is it something like this?

Image src;
Image dst;
Kernel K;
Graph f;

f = src * K

dst = ((f * 2) * 3) * f;

Regards,
Vladimir
0 Kudos
Goran_N
Beginner
486 Views
Yes, that's it. Again, my actual code is much, much longer but this is a good representation. So the code was crashing until I separated the paths of the shared graph output. Maybe a better way to see this would be:

Crashing:
Image src;
Image dst;
Kernel K;
Graph f, g;

f = src * K

g = ((f * 2) * 3) * f;
dst = g * f;

Not crashing:
Image src;
Image dst;
Kernel K;
Graph f, f_copy, g;

f = src * K;
f_copy = src * K;

g = ((f * 2) * 3) * f;
dst = g * f_copy;

Again, I have many temporary Graphs variables since putting everything into one equation would be very difficult.
Thanks.

Quoting - Vladimir Dudnik (Intel)

Hi,

I'm affraid I did not get what you are trying to do with DMIP. Would be nice if you can provide just arithmetic equation of what you want to achieve.

Is it something like this?

Image src;
Image dst;
Kernel K;
Graph f;

f = src * K

dst = ((f * 2) * 3) * f;

Regards,
Vladimir

0 Kudos
Vladimir_Dudnik
Employee
486 Views
Ok, we will take a look at this.

Regards,
Vladimir
0 Kudos
Vladimir_Dudnik
Employee
486 Views
Hello,

we still not able to reproduce that issue. I've attached a simple sample we made based on your description. Could you please check if this work for you?

[cpp]int main (void)
{
   IppiSize  roi    = { 2048, 2048 };
   IppiSize  kernel = { 7, 7 };
   IppiPoint anchor = { 3, 3 };

   Kernel K(idmFilterBox, kernel, anchor);

   Image src(ipp8u,ippC1,roi);
   Image dst(ipp8u,ippC1,roi);

   Graph f;
   Graph g;

   f = src * K; // filtered image

   g = ((f * 2) * 3) * f;

   dst = g * f;

   return 0;
}
[/cpp]


Regards,
Vladimir
0 Kudos
Goran_N
Beginner
486 Views
Hi, it turns out this problem is not so simple to recreate. I started with our full code, and removed everything unnecessary to see the problem. By swapping two lines of code, it will fail or pass. It turns out that the memory access violation happens at some image DPI's, but not other. Also it happens when attached to debugger, but sometimes doesn't fail when ran detached (maybe because access violation happens during tear-down). But even if the crash is hidden somehow, we always see incorrect results when we look at the produced image (last ~25 rows of the image were garbage). When I added the node copies, the crashing and garbage in the image was fixed.

Please provide an email to send you the source and related files.

Thanks, Goran



Quoting - Vladimir Dudnik (Intel)

Hello,

we still not able to reproduce that issue. I've attached a simple sample we made based on your description. Could you please check if this work for you?

[cpp]int main (void)
{
IppiSize roi = { 2048, 2048 };
IppiSize kernel = { 7, 7 };
IppiPoint anchor = { 3, 3 };

Kernel K(idmFilterBox, kernel, anchor);

Image src(ipp8u,ippC1,roi);
Image dst(ipp8u,ippC1,roi);

Graph f;
Graph g;

f = src * K; // filtered image

g = ((f * 2) * 3) * f;

dst = g * f;

return 0;
}
[/cpp]


Regards,
Vladimir

0 Kudos
Vladimir_Dudnik
Employee
486 Views
Hi Goran,

I inform IPP TCE team, they will get in contact with you and create issue record in product data base where you will be able to attach necessary materials.

Regards,
Vladimir
0 Kudos
Goran_N
Beginner
486 Views
I made many attempts to send the files by email, but every time I got an automated reply that the attachments have been rejected.
The code is obfuscated enough that I can attach the ZIP file here.
Thanks, Goran

0 Kudos
Vladimir_Dudnik
Employee
486 Views

Thank you we will take a look at this and come back to you soon.

Regards,
Vladimir
0 Kudos
Igor_B_Intel1
Employee
486 Views
Quoting - Goran N
I made many attempts to send the files by email, but every time I got an automated reply that the attachments have been rejected.
The code is obfuscated enough that I can attach the ZIP file here.
Thanks, Goran


Thank you.
I reproduce crash with your example. Will investigate and return to you.

Igor S. Belyakov
0 Kudos
Vladimir_Dudnik
Employee
486 Views
Hello,

we have investigated your test case. It demonstrate a limitation we have in IPP 6.1 DMIP. The DMIP slice size in IPP 6.1 can't be less than half of filter kernel height. So for your particular case we would recommend to set manually slice size like this:

[cpp]        // In 6.1 for correct processing without crash slice size must be more than half of kernel size.
	status = GR.Compile(5);
	if ( status != idmOK )
	{
		return false;
	}
	status = GR.Execute();
	if ( status != idmOK )
	{
		return false;
	}
[/cpp]

This limitation will be removed in the next version of DMIP. Thanks for helping us to discover this.
Regards,
Vladimir
0 Kudos
Naveen_G_Intel
Employee
486 Views
Quoting - Goran N
I ran into a DMIP problem, where code is crashing after leaving the function. This is an example of the problem.

Graph g1, g2, g3, g4, g5, g6;
Kernal k;
g1 = Src(src1);
g2 = Src(src2);

g3 = g1 * k;
g4 = g3 * 2;
g5 = g4 * 3;

g6 = g5 * g3; <-- problem

The main point is that graph g5 depends on g3, or another words, if I understand it correctly, g5 destroyed g3 so the g6 cannot be evaluated.

I fixed the problem by duplicating a lot of code:
g3 = g1 * k;
g3_copy = g1 * k;
g4 = g3 * 2;
g5 = g4 * 3;

g6 = g5 * g3_copy;

My actual code is much longer, so there is a lot of duplicated operations, which affects performance. I have a feeling there is a better solution, but I couldn't figure it out. I tried to use Copy, but again, I had to duplicate a lot of code, otherwise it kept crashing.




Hi,
I like to inform you that, we have fixed this issue in the latest release of IPP. Please refer to below forum link to get more information like package download, installation and list of bug fixed in this relase.
http://software.intel.com/en-us/forums/showthread.php?t=69675

Thanks,
Naveen Gv
0 Kudos
Reply