Visible to Intel only — GUID: GUID-C76490AE-A631-4A02-A838-5E535A56B4C6
Visible to Intel only — GUID: GUID-C76490AE-A631-4A02-A838-5E535A56B4C6
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