Developer Guide


I/O Pipes

An I/O pipe is a unidirectional (source or sink) connection to the hardware that may be connected to input or output features of an FPGA board. These features might include network interfaces, PCIe®, cameras, or other data capture or processing devices or protocols.
A source I/O device provides data that a SYCL kernel can read whereas a sink I/O device accepts data written by a SYCL kernel and sends it to the hardware device. A common use of I/O pipes is to interface to ethernet connections that interface directly with the FPGA. The source reads from the network and the sink writes to the network. This allows a SYCL kernel to process data from the network and resend it back to the network.
For testing purposes, you can use files on the disk as input or output devices, allowing you to debug using emulation for faster compilation.
To implement I/O pipes, follow these steps:
  1. Consult your board vendor documentation before you implement I/O pipes in your kernel program.
  2. Use a
    with a numeric
    to define a
    type to declare an I/O pipe to interface with hardware peripherals. These definitions are typically provided by a board vendor.
    • The numeric
      value is the 0-origin index into the interfaces in the channels section of the
      for the device.
    Only channels marked type
    are used for indexing.
  3. Implement the interface to hardware I/O pipes or files (emulator ) by mapping the
    variable, as shown in the following:
    // Specialize a pipe type struct read_io_pipe { static constexpr unsigned id = 0; }; struct write_io_pipe { static constexpr unsigned id = 1; }; // id 0 -> file name or channel name: "c1" for hardware, "0" for emulator. using read_iopipe = sycl::INTEL::kernel_readable_io_pipe<read_io_pipe, unsigned, 4>; // id 1 -> file name or channel name: "c2" for hardware, "1" for emulator. using write_iopipe = sycl::INTEL::kernel_writeable_io_pipe<write_io_pipe, unsigned, 3>;
    For Hardware
    id N
    is mapped to the channel (not file) in the associated hardware. For example:
    • id 0
      is mapped to the
      in the first interface defined.
    • id 1
      is mapped to the
      in the second interface defined, and so on.
    If there is no matching channel, an error is generated.
    For Emulator
    id N
    is mapped to a file named
    , which means
    id 0
    is file
    . This file is read or written by reading or writing to the associated I/O pipe.

The I/O Pipe Classes and Their Use

The I/O pipe APIs exposed by the FPGA implementations is equivalent to the following class declarations:
template <class name, class dataT, size_t min_capacity = 0> class kernel_readable_io_pipe { public: static dataT read(); // Blocking static dataT read(bool &success_code); // Non-blocking }; template <class name, class dataT, size_t min_capacity = 0> class kernel_writeable_io_pipe { public: static void write(dataT data); // Blocking static void write(dataT data, bool &success_code); // Non-blocking }
The following table describes the
Template Parameters
The type that is the basis of an I/O pipe identification. It may be provided by the device vendor or user defined. The type must contain a
static constexpr unsigned
expression with name
, which is used to determine the hardware device referenced by the I/O pipe.
The type of data packet contained within an I/O pipe. This is the data type that is read during a successful pipe
operation, or written during a successful pipe
operation. The type must have a standard layout and be trivially copyable.
User-defined minimum number of words (in units of
) that an I/O pipe must be able to store without any being read out. The compiler may create an I/O pipe with a larger capacity due to performance considerations.
A data word in this context is the data type that the pipe contains (
dataT pipe template
Example Code for I/O Pipes
Here is an example that includes the definitions above:
// "Built-in pipes" provide interfaces with hardware peripherals // These definitions are typically provided by a device vendor and // made available to developers for use. namespace example_platform { template <unsigned ID> struct ethernet_pipe_id { static constexpr unsigned id = ID; }; using ethernet_read_pipe = kernel_readable_io_pipe<ethernet_pipe_id<0>, int, 0>; using ethernet_write_pipe = kernel_writeable_io_pipe<ethernet_pipe_id<1>, int, 0>; }

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at