Visible to Intel only — GUID: GUID-C55F8870-1E77-4F02-B13E-D071BB8C2E0C
Visible to Intel only — GUID: GUID-C55F8870-1E77-4F02-B13E-D071BB8C2E0C
Host Pipe API
Host pipes expose read and write interfaces that allow a single element to be read or written in FIFO order to the pipe. These read and write interfaces are static class methods on the templated classes described later in this section and in Declare a Host Pipe.
Blocking Write
The host pipe write interface writes a single element of the given data type (int in the examples that follow) to the host pipe. On the host side, this class method accepts a reference to a SYCL* device queue as its first argument and the element being written as its second argument.
queue q(...); ... int data_element = ...; // blocking write from host to pipe MyPipeInstance::write(q, data_element); ...
In the FPGA kernel, writes to a host pipe accept a single argument, which is the element being written.
float data_element = ...; // blocking write from device to pipe AnotherPipeInstance::write(data_element);
Non-blocking Write
Non-blocking writes add a bool argument in both host and device APIs that is passed by reference and returns true in this argument if the write was successful, and false if it was unsuccessful.
On the host:
queue q(...); ... int data_element = ...; // variable to hold write success or failure bool success = false; // attempt non-blocking write from host to pipe until successful while (!success) MyPipeInstance::write(q, data_element, success);
On the device:
float data_element = ...; // variable to hold write success or failure bool success = false; // attempt non-blocking write from device to pipe until successful while (!success) AnotherPipeInstance::write(data_element, success);
Blocking Read
The host pipe read interface reads a single element of a given data type from the host pipe. Like the write interface, the read interface on the host takes a SYCL* device queue as a parameter. The device read interface consists of the class method read call with no arguments.
On the host:
// blocking read in host code float read_element = AnotherPipeInstance::read(q);
On the device:
// blocking read in device code int read_element = FirstPipeInstance::read();
Non-blocking Read
Like non-blocking writes, non-blocking reads add a bool argument in both host and device APIs that is passed by reference and returns true in this argument if the read was successful and false if it was unsuccessful.
On the host:
// variable to hold read success or failure bool success = false; // attempt non-blocking read until successful in host code float read_element; while (!success) read_element = SecondPipeInstance::read(q, success);
On the device:
// variable to hold read success or failure bool success = false; // attempt non-blocking read until successful in device code int read_element; while (!success) read_element = FirstPipeInstance::read(success);
Host Pipe Connections
Host pipe connections for a particular host pipe are inferred by the compiler from the presence of read and write calls to that host pipe in your code.
A host pipe can be connected from the host only to a single kernel. That is, host pipe calls for a particular host pipe must be restricted to the same kernel.
Host pipes can also operate in only one direction. That is, host-to-kernel or kernel-to-host.
Host code for a particular host pipe can contain either only all writes or only all reads to that pipe, and the corresponding kernel code for the same host pipe can consist only of the opposite transaction.