A newer version of this document is available. Customers should click here to go to the newest version.
Why is FPGA Compilation Different?
Types of SYCL* FPGA Compilation
FPGA Compilation Flags
Emulate and Debug Your Design
Evaluate Your Kernel Through Simulation
Device Selectors for FPGA
FPGA IP Authoring Flow
Fast Recompile for FPGA
Generate Multiple FPGA Images (Linux only)
FPGA BSPs and Boards
Targeting Multiple Homogeneous FPGA Devices
Targeting Multiple Platforms
Emulation Compile
FPGA Hardware Compile
FPGA-CPU Interaction
FPGA Performance Optimization
Use of RTL Libraries for FPGA
Use SYCL Shared Library With Third-Party Applications
FPGA Workflows in IDEs
Intel oneAPI DPC++ Library (oneDPL)
Intel oneAPI Math Kernel Library (oneMKL)
Intel oneAPI Threading Building Blocks (oneTBB)
Intel oneAPI Data Analytics Library (oneDAL)
Intel oneAPI Collective Communications Library (oneCCL)
Intel oneAPI Deep Neural Network Library (oneDNN)
Intel oneAPI Video Processing Library (oneVPL)
Other Libraries
Targeting Multiple Platforms
To compile a design that targets multiple target device types (using different device selectors), you can run the following commands:
Emulation Compile
For compiling your SYCL* code for the FPGA emulator target, execute the following commands:
# For Linux:
icpx -fsycl jit_kernel.cpp -c -o jit_kernel.o
icpx -fsycl -fintelfpga -fsycl-link=image fpga_kernel.cpp -o fpga_kernel.a
icpx -fsycl -fintelfpga main.cpp jit_kernel.o fpga_kernel.a
# For Windows:
icx-cl -fsycl jit_kernel.cpp -c -o jit_kernel.o
icx-cl -fsycl -fintelfpga -fsycl-link=image fpga_kernel.cpp -o fpga_kernel.lib
icx-cl -fsycl -fintelfpga main.cpp jit_kernel.o fpga_kernel.lib
The design uses libraries and includes an FPGA kernel (AOT flow) and a CPU kernel (JIT flow).
Specifically, there should be a main function residing in the main.cpp file and two kernels for both CPU (jit_kernel.cpp) and FPGA (fpga_kernel.cpp).
Sample jit_kernel.cpp file:
sycl::cpu_selector device_selector;
queue deviceQueue(device_selector);
deviceQueue.submit([&](handler &cgh) {
// CPU Kernel function
});
Sample fpga_kernel.cpp file:
#if FPGA_SIMULATOR
auto selector = sycl::ext::intel::fpga_simulator_selector_v;
#elif FPGA_HARDWARE
auto selector = sycl::ext::intel::fpga_selector_v;
#else // #if FPGA_EMULATOR
auto selector = sycl::ext::intel::fpga_emulator_selector_v;
#endif
queue deviceQueue(device_selector);
deviceQueue.submit([&](handler &cgh) {
// FPGA Kernel Function
});
FPGA Hardware Compile
To compile for the FPGA hardware target, add the -Xshardware flag and remove the -DFPGA_EMULATOR flag, as follows:
# For Linux:
icpx -fsycl jit_kernel.cpp -c -o jit_kernel.o
//Hardware compilation command. Takes a long time to complete.
icpx -fsycl -fintelfpga -fsycl-link=image -Xshardware fpga_kernel.cpp -o fpga_kernel.a
icpx -fsycl -fintelfpga main.cpp jit_kernel.o fpga_kernel.a
# For Windows:
icx-cl -fsycl jit_kernel.cpp -c -o jit_kernel.o
//Hardware compilation command. Takes a long time to complete.
icx-cl -fsycl -fintelfpga -fsycl-link=image -Xshardware fpga_kernel.cpp -o fpga_kernel.lib
icx-cl -fsycl -fintelfpga main.cpp jit_kernel.o fpga_kernel.lib