Intel® FPGA SDK for OpenCL™ Standard Edition: Best Practices Guide

ID 683176
Date 9/24/2018
Public
Document Table of Contents

1.4. Multi-Threaded Host Application

When there are parallel, independent data paths and the host processes the data between kernel executions, consider using a multi-threaded host application.
Figure 12. Comparison of the Launch Frequency of a Multi-Threaded Execution with a Pipelined Loop

Parallel threads are launched one thread every clock cycle in a pipelined manner where as loop pipelining enables pipeline parallelism and communication of state information between loop iterations. Loop dependencies may not be resolved in one clock cycle.

The figure below illustrates how a single-threaded host application processes parallel, independent data paths between kernel executions:

Figure 13. Kernel Execution by a Single-Threaded Host Application

With a single-threaded host application, you need to build an external synchronization mechanism around the OpenCL™ host function calls. Using a multi-threaded host application in a thread-safe runtime environment allows you to simplify the host code. In addition, processing multiple sets of data in the host simultaneously can speed up kernel execution.

The figure below illustrates how a multi-threaded host application processes parallel, independent data paths between kernel executions:

Figure 14. Kernel Execution by a Multi-Threaded Host Application in a Thread-Safe Runtime Environment