Created attachment 122706 [details] example file for reproducible error I have come across a segmentation fault where I am trying to run a simple integer matrix multiplication using beignet and the OpenCL C++ API. The error is currently reproducible on the following platform information: Hardware = Lenovo t440p OS = Debian GNU/Linux testing GPU = Intel(R) HD Graphics Haswell GT2 Mobile Beignet Version = 1.1.1 (installed from apt-get install beignet-dev) OpenCL Headers = cl2.hpp (installed from apt-get install opencl-headers) Compile the program with: g++ opencl_test.cpp -o opencl_test -I/usr/include/eigen3 -DHAVE_CL2 -lOpenCL -std=c++11 ./opencl_test which has been resulting in the following output: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 got platforms selected default platform Context Made Device Found Segmentation fault
Hi Charles, It seems the problem is about the cl2.hpp, the release v1.1.1 does not support OpenCL2.0 API. Maybe you need a -DCL_HPP_TARGET_OPENCL_VERSION=120 as a compile option. Could you give us the backtrace to confirm that? Thanks Xiuli
Hi Xiuli, I am unfortunately working through this bug via a kind user who is able to reproduce this problem. Do you have a proposed method that you prefer to get the backtrace? gdb? valgrind? other method? If you have any specific instructions I can contact the user and return the output to you. Thanks, Charles
Hi charles, GBD with bt(backtrace) is fine. Thanks Xiuli
Here are the results from the backtrace (gdb) r Starting program: /home/Hornik/tmp/WWW/opencl_test 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". got platforms selected default platform Context Made Device Found Program received signal SIGSEGV, Segmentation fault. 0x0000000000000000 in ?? () (gdb) backtrace #0 0x0000000000000000 in ?? () #1 0x0000000000404ba6 in cl::CommandQueue::CommandQueue (this=0x7fffffffdec0, context=..., device=..., properties=0, err=0x7fffffffe058) at /usr/include/CL/cl2.hpp:6833 #2 0x0000000000402dad in main () at opencl_test.cpp:96
Hi charles, It seems to be the cl2.hpp called some api that only OpenCL 2.0 supported. For beignet releasev1.1.1, it only support OpenCL 1.2 api. If you want to use beignet with the cl2.hpp please use -DCL_HPP_TARGET_OPENCL_VERSION=120 with -DHAVE_CL2 or just try to use cl.hpp. In short, beignet 1.1.1 does not have those api cl2.hpp needed, use cl.hpp instead. Thanks Xiuli
Thanks for looking into this. That said, is there a timeline for beignet to accept OpenCL 2.0?
(In reply to charles from comment #6) > Thanks for looking into this. That said, is there a timeline for beignet to > accept OpenCL 2.0? Could it work with OpenCL 1.2? If problem solved I'd like to close this bug. For OpenCL 2.0 we are still working on it. Thanks Xiuli
It appears this didn't solve the problem. The compiler complains about a minimum opencl version. $ g++ opencl_test.cpp -o opencl_test -g -I/usr/include/eigen3 -lOpenCL -std=c++11 -DCL_HPP_TARGET_OPENCL_VERSION=120 In file included from opencl_test.cpp:11:0: /usr/include/CL/cl2.hpp:407:3: error: #error "CL_HPP_MINIMUM_OPENCL_VERSION must not be greater than CL_HPP_TARGET_OPENCL_VERSION" # error "CL_HPP_MINIMUM_OPENCL_VERSION must not be greater than CL_HPP_TARGET_O
Hi charles, I have tried the exact case you provide, the problem is still about the cl2.hpp. For beignet-dev from apt-get it only support OpenCL 1.2 api. So you must pass the exact option to enable only OpenCL 1.2 api. I have used this to build and can run (maybe need to delete the cout in line 8) g++ test.cpp -o opencl_test -g -I/usr/include/eigen3 -lOpenCL -std=c++11 -DHAVE_CL2 -DCL_HPP_TARGET_OPENCL_VERSION=120 -DCL_HPP_MINIMUM_OPENCL_VERSION=120 Please have a try, thanks! The result: ./opencl_test 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 got platforms selected default platform Context Made Device Found Command Queue created Program created Program Built Kernel made Buffers initialized Buffers written kernel completed Completed Buffer Read Result 90 100 110 120 202 228 254 280 314 356 398 440 426 484 542 600 Thanks Xiuli
Xiuli, The additional -DCL_HPP_MINIMUM_OPENCL_VERSION flag did in fact fix the problem. It now compiles and runs without problem. Thanks for your help. Regards, Charles
OK, I will close this bug.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.