cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
492 Views
Registered: ‎08-31-2017

How to parallel 4 different independent functions with the same inputs ?

Jump to solution

Hi, dear HLS elites, 

I'm using HLS to explore how to implement the following parallel architecture.

The top module input is a[2] and the output is d[4]. The fun_A, fun_B, fun_C, and fun_D are different and independent functions and I would like to have the 4 functions to run in parallel.

Firstly, I studied the description of the dataflow in the UG902. However, it appears the architecture I considered has no consumer between func_A to func_D. Thus, I think it doesn't meet the requirement of dataflow as I know.

Thus, I need you advice on how to implement the parallel architecture for the code.

void top (a[2],d[4]) { //assume a[2] and d[4] are partitioned completely

func_A(a,d[0]); // input is a[2] and output is d[0]
func_B(a,d[1]);
func_C(a,d[2]);
func_D(a,d[3]);

}

Thank you very much.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Xilinx Employee
Xilinx Employee
397 Views
Registered: ‎09-04-2017

Re: How to parallel 4 different independent functions with the same inputs ?

Jump to solution

@nanson  Apply INLINE off on function_1, function_2 and function_3

Then look at the Analysis view

#pragma HLS INLINE off

HLS schedules these in parallel

Thanks,

Nithin

View solution in original post

0 Kudos
8 Replies
Highlighted
Visitor
Visitor
481 Views
Registered: ‎03-30-2020

Re: How to parallel 4 different independent functions with the same inputs ?

Jump to solution

Hi @nanson ,

I don't think those functions will run in parallel as they use the same input (reading from one array). HLS can't share an array between two functions that are supposed to be run in parallel so if you have functions which are reading from one array then the tool will run them sequentially.

0 Kudos
Highlighted
Explorer
Explorer
470 Views
Registered: ‎08-31-2017

Re: How to parallel 4 different independent functions with the same inputs ?

Jump to solution

@A8738 Thank you.

Provided that the a[2] is partitioned as registers completely and thus they are broadcasted to these downstream 4 functions. If that's the case, does HLS still have a problem to parallelize these 4 functions?

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
466 Views
Registered: ‎09-04-2017

Re: How to parallel 4 different independent functions with the same inputs ?

Jump to solution

@nanson If they are completely partitioned, HLS should be able to run them in parallel. 

Are you seeing HLS not scheduling that way?

Thanks,

Nithin

0 Kudos
Highlighted
Explorer
Explorer
450 Views
Registered: ‎08-31-2017

Re: How to parallel 4 different independent functions with the same inputs ?

Jump to solution

@nithink 

I don't try yet. I'm conducting an experiment without any HLS constraints and let you know if it works as you said. 

Thank you.

0 Kudos
Highlighted
Explorer
Explorer
442 Views
Registered: ‎08-31-2017

Re: How to parallel 4 different independent functions with the same inputs ?

Jump to solution

@nithink 

I tried two cases. The first one is input a[2] with complete partition directive and the second one is to use 3 different inputs explicitly. However, all cannot be implemented as parallel functions. All implementation is in serial.

Thus, I need your help in how to enable parallel functions running in the case. Attached please find the testcase for your information. Thank you.

0 Kudos
Highlighted
Explorer
Explorer
402 Views
Registered: ‎08-31-2017

Re: How to parallel 4 different independent functions with the same inputs ?

Jump to solution

@nithink 

I also tried the following case which uses independent output variables but HLS still implements sequentially.

void linear ( float in_data1[2],
float in_data2[2],
float in_data3[2],
float& HN_OUT_0,
float& HN_OUT_1,
float& HN_OUT_2
)
{

HN_OUT_0=function_1(in_data1);
HN_OUT_1=function_2(in_data2);
HN_OUT_2=function_3(in_data3);



}// end of linear_core

 

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
398 Views
Registered: ‎09-04-2017

Re: How to parallel 4 different independent functions with the same inputs ?

Jump to solution

@nanson  Apply INLINE off on function_1, function_2 and function_3

Then look at the Analysis view

#pragma HLS INLINE off

HLS schedules these in parallel

Thanks,

Nithin

View solution in original post

0 Kudos
Highlighted
Explorer
Explorer
383 Views
Registered: ‎08-31-2017

Re: How to parallel 4 different independent functions with the same inputs ?

Jump to solution

@nithinkThank you. It works now.

To sum up, the way to parallel 4 different independent functions with the same inputs work by doing the trick with applying "HLS pragma INLINE off" on each function separately.

p.s. The input and output of the code below share the same array with completely array partition.

void linear ( float in_data1[2],
//float in_data2[2],
//float in_data3[2],
float HN_OUT[3]
//float& HN_OUT_1,
//float& HN_OUT_2
)
{

HN_OUT[0]=function_1(in_data1);
HN_OUT[1]=function_2(in_data1);
HN_OUT[2]=function_3(in_data1);

0 Kudos