# Mapping a Guided Image Filter on the HARP Reconfigurable Architecture Using OpenCL
## 6 Experimental Results
### Runtime Measurements  
The implemented kernel was synthesized to filter full-HD images, with a resolution of \(1080\times 1920\) pixels and a radius \(r=3\). This generates a bitstream with operating frequency \(237.5\) MHz. The bitstream was then executed on the HARP platform, by filtering 100 images. Two time recordings were registered. A first recording measured the execution time of the OpenCL kernel itself, without accounting for passing input parameters. A second recording measured the total execution time at the host side. This includes the FPGA execution, but also passing the input parameters and invoking the OpenCL kernel. The average execution time per image is shown in Table 4.  
Since the kernel is synthesized using a frequency of \(237.5\) MHz, a clock cycle time of \(4.21\) ns is obtained. As denoted in the compilation reports, the kernel is fully pipelined and has an initiation interval equal to one. Therefore, in every clock cycle an output pixel can be calculated. This leads to a theoretical execution time equal to approximately the total number of pixels multiplied by the cycle time, which equals \(8.78\) ms. If this value is compared to the obtained execution time of \(18.20\) ms, it can be observed that the obtained execution time is higher. This can be explained using the profiling results, displayed in Table 5.  
The occupancy is defined as the portion of the execution time of the kernel that a memory operation is issued. While the optimal value is an occupancy of \(100\%\), only an occupancy of \(48.6\%\) is achieved in this kernel. Therefore, the load and read statement are only issued \(48.6\%\) of the clock cycles, which means that a read takes around \(2\) clock cycles. Therefore, the bandwidth is lower as well.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Profile** & **Execution Time** & **GOPS** & **Frames/s** \\ \hline Kernel Execution & 18.20 ms & 139 & 54 \\ Total Execution & 22.06 ms & 114 & 45 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Execution times when executing the sliding window implementation of the guided filter on the HARP platform.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Memory Operation** & **Occupancy** & **Bandwidth** & **Efficiency** \\ \hline Filtering Input & 48.6\% & 1371.6 MB/s & 100\% \\ Guidance Input & 48.6\% & 343.0 MB/s & 100\% \\ Filtering Output & 48.5\% & 1459.9 MB/s & 100\% \\ \hline \hline \end{tabular}
\end{table}
Table 5: Profiling results when executing the sliding window implementation of the guided image filter algorithm.  
The theoretical requested bandwidth is 12 B/4.21 ns = 2850 MB/s. However, because of the occupancy of 48.6%, only a bandwidth of 2850 MB/s \(\times\) 48.6% = 1385 MB/s \(\approx\) 1371.6 MB/s is obtained. The low bandwidth is due to the alignment of the channel structs. Both the filtering input, the guidance input and the filtering output consist of a data type that has a size that is a multiple of 3 bytes. The filtering input, for instance, has a size of 12 B and is aligned at 4 B. Therefore, 3 separate read requests are needed, which reduces the bandwidth and explains the low occupancy.  
Despite the lower occupancy, the bandwidth efficiency of all I/O-operations equals 100%, meaning that all data are effectively used. This is because all three color channels are used using structs without padding and therefore no read values are discarded.