Programming Guide

Contents

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 FPGA emulator target, execute the following commands:
dpcpp -fsycl-targets=spir64-unknown-unknown-sycldevice \ jit_kernel.cpp -c -o jit_kernel.o dpcpp -DFPGA_EMULATOR \ -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice fpga_kernel.cpp \ -c -o fpga_kernel.o dpcpp -DFPGA_EMULATOR \ -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice,spir64-unknown-unknown-sycldevice main.cpp jit_kernel.o fpga_kernel.o -o emulator.out
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:
#ifdef FPGA_EMULATOR INTEL::fpga_emulator_selector device_selector; #else INTEL::fpga_selector device_selector; #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:
dpcpp -fsycl-targets=spir64-unknown-unknown-sycldevice \ jit_kernel.cpp -c -o jit_kernel.o dpcpp -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice \ fpga_kernel.cpp -c -o fpga_kernel.o dpcpp -fintelfpga main.cpp jit_kernel.o fpga_kernel.o -Xshardware

Product and Performance Information

1

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