My device code has over 100 kernels based on OneAPI and Intel stratix 10.
Fisrt I built device code with
-fsycl -fintelfpga -fsycl-link=image -Xshardware -Xstarget=/home/xxxx
and get dev.a.
Then built host code by linking to dev.a with cmake file. dev.a was used as static library linking.
The cmake file shows below:
cmake_minimum_required(VERSION 3.20)
FPGA board selection
if(NOT DEFINED FPGA_DEVICE)
set(FPGA_DEVICE "xxx_bsp:xxxxx")
message(STATUS "FPGA_DEVICE was not specified.\
\nConfiguring the design to run on the default FPGA board ${FPGA_DEVICE} (Intel(R) PAC with Intel Stratix(R) 10 GX FPGA). \
\nPlease refer to the README for information on board selection.")
else()
message(STATUS "Configuring the design to run on FPGA board ${FPGA_DEVICE}")
endif()
project(fme)
set(CMAKE_CXX_COMPILER icpx)
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb -Wno-nonnull -Wno-reorder -D_DEBUG -lpthread -lrt -std=c++17 -DONEAPI -DFPGA -fsycl -fintelfpga -D_linux")
add_executable(fme ${PROJECT_SOURCE_DIR}/main.cpp)
target_link_libraries(fme pthread rt uuid opae-c dev.a)
The content in the cmake file is simplified, but the key parameters are shown. Binary programs can be compiled normally. However, when running the binary program, the program reports an error when issuing the kernel task:
Native API failed. Native API returns: -42 (PI_ERROR_INVALID_BINARY) -42 (PI_ERROR_INVALID_BINARY)
Not sure what is the reason for this error. Maybe there is a compilation problem?