Application Acceleration With FPGAs
Programmable Acceleration Cards (PACs), DCP, FPGA AI Suite, Software Stack, and Reference Designs
477 Discussions

Double buffering with Intel HLS

DimitrisGrn
Beginner
935 Views

Hello,

I am trying to implement double buffering using Intel HLS, in order to overlap communication with computation. I know that it can be done with Vivado HLS (with the dataflow pragma), but I have not yet figured out a way to do it with Intel HLS.

Basically, I have a for loop that looks like this:

for (batch=0; batch<BATCHES; batch++){
  load_inputs(input, BATCH_SIZE, batch);
  compute(input, output);
  write_outputs(output,batch);
}

The input data are fetched from DRAM via a master interface and stored in the input array.
The compute() unit does computations on this data and stores results in the output array.
The results are written back to DRAM via a master interface.

The input and output arrays are implemented as hls_memory variables internal to the component.
I am using Intel HLS version 19.3 and the hls_max_concurrency pragma to create 2 private copies of these variables.
However, the compiler does not automatically implement the double buffering and I do not know if there is a way to do so (similarly to the dataflow pragma of Vivado HLS).

Alternatively, I am thinking of defining the load_inputs(), compute() and write_outputs() functions as tasks in a system of tasks and have better control of launching them.

However, this will introduce a lot of hassle, as I will no longer be able to keep the inputs and outputs arrays as local hls_memory variables (tasks cannot have them as input arguments) and I will have to define them as external memories in the Platform Designer, manually applying the optimizations that are easily controlled by HLS. The tasks will then access these memories via master interfaces.

Is there a way that double buffering can be done with HLS by avoiding all the hassle?
If not, does my alternative methodology sound viable?
Any suggestions would be very helpful.

Thank you in advance.

0 Kudos
1 Reply
BoonBengT_Intel
Moderator
725 Views

Hi @DimitrisGrn,

 

Thank you for posting in Intel community forum, hope all is well and apologies for the delayed in response.
Following up on the queries, please do let us know if the doubts are still here, and we would try our best to clarify.

 

Best Wishes
BB

0 Kudos
Reply