Programming Guide

Contents

Device Selectors for FPGA

Depending on whether you are targeting the FPGA emulator or FPGA hardware, you must use the correct SYCL* device selector in the host code. You can use the FPGA hardware device selector for simulation also. The following host code snippet demonstrates how you can use a selector to specify the target device at compile time:
// FPGA device selectors are defined in this utility header, along with // all FPGA extensions such as pipes and fpga_reg #include <sycl/ext/intel/fpga_extensions.hpp> int main() { // Select either: // - the FPGA emulator device (CPU emulation of the FPGA) // - the FPGA device (a real FPGA, can be used for simulation too) #if defined(FPGA_EMULATOR) ext::intel::fpga_emulator_selector device_selector; #else ext::intel::fpga_selector device_selector; #endif queue q(device_selector); ... }
  • The FPGA emulator and the FPGA are different target devices. Intel® recommends using a preprocessor
    define
    to choose between the emulator and FPGA selectors. This makes it easy to switch between targets using only command-line flags. For example, you can compile the above code snippet for the FPGA emulator by passing the flag
    -DFPGA_EMULATOR
    to the
    dpcpp
    command.
  • Since FPGAs support only the ahead-of-time compilation method, dynamic selectors (such as the
    default_selector
    ) are less useful that explicit selectors when targeting FPGAs.
When targeting the FPGA emulator or FPGA hardware, you must pass correct compiler flags and use the correct device selector in the host code. Otherwise, you might experience runtime failures. Refer to the fpga_compile tutorial in the Intel® oneAPI Samples Browser to get started with compiling SYCL code for FPGA.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.