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:
dpcpp jit_kernel.cpp -c -o jit_kernel.o
dpcpp -fintelfpga -fsycl-link=image fpga_kernel.cpp -o fpga_kernel.a
dpcpp -fintelfpga main.cpp jit_kernel.o fpga_kernel.a
// For Windows:
dpcpp jit_kernel.cpp -c -o jit_kernel.o
dpcpp -fintelfpga -fsycl-link=image fpga_kernel.cpp -o fpga_kernel.lib
dpcpp -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:#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:// For Linux:
dpcpp jit_kernel.cpp -c -o jit_kernel.o
//Hardware compilation command. Takes a long time to complete.
dpcpp -fintelfpga -fsycl-link=image -Xshardware fpga_kernel.cpp \
-o fpga_kernel.a
dpcpp -fintelfpga main.cpp jit_kernel.o fpga_kernel.a
// For Windows:
dpcpp jit_kernel.cpp -c -o jit_kernel.o
// Hardware compilation command. Takes a long time to complete.
dpcpp -fintelfpga -fsycl-link=image -Xshardware fpga_kernel.cpp \
-o fpga_kernel.lib
dpcpp -fintelfpga main.cpp jit_kernel.o fpga_kernel.lib