PYNQ: PYTHON PRODUCTIVITY

Execution time calculation

I have developed a kernel in HLS using streaming interfaces. Usually the parameters considered for finding timing values are clock cycles and the latency.
execution time =clock*latency;

But in streaming there is overlap with latency. So how do i find the total execution time in HLS for streaming? should i proceed to jupyter notebook to get the exact timing values?

Hi @srinivasan74,

In pipeline designs there are two key concepts

  • Initiation Interval (II), the number of clock cycles between the start times of consecutive loop iterations, ideally this should be 1
  • Latency, the time it takes to get an output since the input was fed

If you are only feeding one input the execution time (in clock cycles) is going to be equal to the Latency,
when you feed multiple inputs the computation in the different stages overlaps, so the equation to compute execution time is

execution time = Latency + II * number of inputs

Consider a simple example where the L = 5 and II=1 and you are feeding 10 input elements and for each element you get an output.

It is going to take 5 cycles to get the first output, but in the next clock cycle you’ll get another valid output and so on until all elements are processed. Therefore, the execution time is 15 clock cycles.

If you measure the execution time from the jupyter notebook, you will be measuring the time to move data from the PS to PL and vice versa. It really depends on what you want to measure.

Mario

Thanks , can we measure the data transfer time from PS to PL in jupyter notebook using existing python functions? .Can we just compute the kernel execution time using the same function?

You could do these measurements from the jupyer notebook using magics https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-time,
for instance

%time
<your code goes here>

When the cell finishes executing you will get a report with the execution time. Note that the underlying OS impacts this measurement, and the granularity is the one the OS provides.

Mario