Programming Guide

Contents

Device Selectors for FPGA

You must use the correct SYCL device selector in the host code, depending on whether you are targeting the FPGA emulator or FPGA hardware. 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 <CL/sycl/INTEL/fpga_extensions.hpp> int main() { // Select either: // - the FPGA emulator device (CPU emulation of the FPGA) // - the FPGA device (a real FPGA) #if defined(FPGA_EMULATOR) INTEL::fpga_emulator_selector device_selector; #else 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, the above code snippet can be compiled 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 FPGA.
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.