UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
11,000 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
10,999 Views
Registered: ‎04-17-2011

Re: HLS dataflow in a loop iteration

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
10,986 Views
Registered: ‎12-03-2013

Re: HLS dataflow in a loop iteration

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
Moderator
Moderator
10,982 Views
Registered: ‎04-17-2011

Re: HLS dataflow in a loop iteration

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
10,977 Views
Registered: ‎12-03-2013

Re: HLS dataflow in a loop iteration

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
Xilinx Employee
Xilinx Employee
10,945 Views
Registered: ‎11-28-2007

Re: HLS dataflow in a loop iteration

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