cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
11,376 Views
Registered: ‎12-03-2013

HLS dataflow in a loop iteration

Hi, I have a problem now, I want to parallel the memcpy function and loopj. But cann't use #pragma AP dataflow in a for loop. How can I do this? int buf1[128],buf2[128]; for(i=0;i<100;i++) { memcpy(buf1,in,128*sizeof(int)); for(j=0;j<128;j++){ buf2[j]=buf1[j]+1; } memcpy(out,buf2,128*sizeof(int)); }
0 Kudos
5 Replies
Highlighted
Moderator
Moderator
11,375 Views
Registered: ‎04-17-2011

Using DATAFLOW is the ideal approach. Once you do that you can check that the Initiation Interval would be less than the latency and you can start to feed new data early. Whats the reason you cant use DATAFLOW?
Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Highlighted
11,362 Views
Registered: ‎12-03-2013

void run(int *in,int *out)
{

int buf1[128],buf2[128];

	for(k=0;k<100;k++)
	{
		#pragma AP dataflow

		memcpy(buf1,in,128*sizeof(int));
		for(i=0;i<128;i++){
			buf2[i]=buf1[i]+1;
		}
		memcpy(out,buf2,128*sizeof(int));
	}
}

 

like the code above, when I insert the pragma , the error is: cannot apply dataflow inside a loop that has exit condition.WHY?
How can I using dataflow in a loop? 
 
Thanks!
0 Kudos
Highlighted
Moderator
Moderator
11,358 Views
Registered: ‎04-17-2011

Use it as:

void run(int *in,int *out)
{

int buf1[128],buf2[128];

#pragma HLS DATAFLOW

for(k=0;k<100;k++)
{

#pragma HLS PIPELINE rewind

memcpy(buf1,in,128*sizeof(int));
for(i=0;i<128;i++){
buf2[i]=buf1[i]+1;
}
memcpy(out,buf2,128*sizeof(int));
}
}

Regards,
Debraj
----------------------------------------------------------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful and reply oriented.
----------------------------------------------------------------------------------------------
0 Kudos
Highlighted
11,353 Views
Registered: ‎12-03-2013

Thank you very much! It did work on this example.

But in my real program, there are two loop iteration ouside these three function, and the result is :Unable to satisfy pipeline directive: Loop contains subloop(s) not being unrolled or flattened.

I guess the memcpy function is unable to be pipelined?

I am wondering is there any way that I can pipeline these there function and ignore external for loop?

 

Thanks!

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
11,321 Views
Registered: ‎11-28-2007

DATAFLOW is used at function level to enable concurrency of subfunctions or loops within the top function. You can't use it in a loop if that is what you are asking. PIPELINE directive is what you need. memcpy() can be pipelined in 2013.3

 


@invisible_mmli wrote:
void run(int *in,int *out)
{

int buf1[128],buf2[128];

	for(k=0;k<100;k++)
	{
		#pragma AP dataflow

		memcpy(buf1,in,128*sizeof(int));
		for(i=0;i<128;i++){
			buf2[i]=buf1[i]+1;
		}
		memcpy(out,buf2,128*sizeof(int));
	}
}

 

like the code above, when I insert the pragma , the error is: cannot apply dataflow inside a loop that has exit condition.WHY?
How can I using dataflow in a loop? 
 
Thanks!



Cheers,
Jim