Blaok / fpga-runtime

MIT License
11 stars 4 forks source link

cannot install FRT with Xilinx OpenCL ext 2022 #2

Closed hecmay closed 2 years ago

hecmay commented 2 years ago

Hi,

We recently upgraded to XRT/Vitis 2022.1. It seems that Xilinx has made a lot of changes to their OpenCL extension APIs, and as a result, FRT cannot be compiled. Here is an excerpt of the error when I was compiling FRT from source

[ 66%] Building CXX object CMakeFiles/frt_static.dir/src/frt/devices/xilinx_opencl_device.cpp.o
/scratch/users/sx233/fpga-runtime/src/frt/devices/xilinx_opencl_stream.cpp: In destructor ‘virtual fpga::internal::XilinxOpenclStream::~XilinxOpenclStream()’:
/scratch/users/sx233/fpga-runtime/src/frt/devices/xilinx_opencl_stream.cpp:22:39: error: too many arguments to function ‘void clReleaseStream()’
     auto err = clReleaseStream(stream_);
                                       ^
In file included from /opt/xilinx/xrt/include/CL/cl_ext.h:39:0,
                 from /usr/include/CL/opencl.h:50,
                 from /usr/include/CL/cl2.hpp:504,
                 from /scratch/users/sx233/fpga-runtime/src/frt/devices/xilinx_opencl_stream.h:6,
                 from /scratch/users/sx233/fpga-runtime/src/frt/devices/xilinx_opencl_stream.cpp:1:
/opt/xilinx/xrt/include/CL/cl_ext_xilinx.h:342:13: note: declared here
 extern void clReleaseStream();
             ^~~~~~~~~~~~~~~
/scratch/users/sx233/fpga-runtime/src/frt/devices/xilinx_opencl_stream.cpp:22:10: error: ‘void err’ has incomplete type
     auto err = clReleaseStream(stream_);
          ^~~
/scratch/users/sx233/fpga-runtime/src/frt/devices/xilinx_opencl_stream.cpp: In constructor ‘fpga::internal::XilinxOpenclStream::XilinxOpenclStream(const string&, cl::Device, cl::Kernel, int, fpga::internal::Tag)’
:
/scratch/users/sx233/fpga-runtime/src/frt/devices/xilinx_opencl_stream.cpp:33:3: error: ‘cl_stream_flags’ was not declared in this scope
   cl_stream_flags flags;
Blaok commented 2 years ago

Hi Shaojie, you are right that FRT requires an old XRT to compile because Xilinx removed the streaming APIs since XRT 2.13 in https://github.com/Xilinx/XRT/commit/d2540202aba4f402519b663612fe7d1c5b459196. I'll make xilinx_opencl_stream an optional feature.

Blaok commented 2 years ago

@hecmay Could you try a6c4f884d4bda35ab18197bc028dc0a78cf2e3e0 from the latest master branch? It will disable xilinx_opencl_stream if XRT_VERSION >= 2.13. You can disable it manually with cmake -DENABLE_XOCL_STREAM=OFF ..., too.

BTW, this is a private, compile-time dependency; as long as you don't actually use the streaming APIs from FRT, any library or binary files compiled against the old XRT will still work.

hecmay commented 2 years ago

@Blaok thanks Yuze! Sure I will it a try.