tanakamura / waifu2x-converter-cpp

waifu2x(original : https://github.com/nagadomi/waifu2x) re-implementation in C++ using OpenCV
Other
319 stars 37 forks source link

Segfaults when using OpenCL #34

Open eigengrau opened 7 years ago

eigengrau commented 7 years ago

When using any OpenCL backend, waifu2x (f89dd61) will segfault.

My platforms are these:

   0: AMD CEDAR (DRM 2.45.0 / 4.7.7-1-ck, LLVM 3.8.1)(OpenCL    ): num_core=2
   1:         Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz(AVX       ): num_core=8
   2:         Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz(OpenCL    ): num_core=8

When invoking waifu2x --processor $i -i input.jpg -o output.jpg (where i={0,2}), the process segfaults.

Backtrace for the OpenCL mesa (12.0.3) backend:

Thread 1 "waifu2x-convert" received signal SIGSEGV, Segmentation fault.
#0  0x00007ffff3be3fbe in fwrite () from /usr/lib/libc.so.6
#1  0x00007ffff79a2ea4 in w2xc::initOpenCL (c=0x6ad6e0, env=0x6ad750, proc=0x6f4e70)
    at /tmp/makepkg/waifu2x-converter-cpp-git/src/waifu2x-converter-cpp/src/modelHandler_OpenCL.cpp:398
#2  0x00007ffff79aa29e in w2xconv_init_with_processor (processor_idx=0, nJob=8, 
    enable_log=1)
    at /tmp/makepkg/waifu2x-converter-cpp-git/src/waifu2x-converter-cpp/src/w2xconv.cpp:379
#3  0x000000000041ab35 in main (argc=7, argv=0x7fffffffdcf8)
    at /tmp/makepkg/waifu2x-converter-cpp-git/src/waifu2x-converter-cpp/src/main.cpp:187

Backtrace for the Intel OpenCL (runtime 16.1.1) backend:

Thread 1 "waifu2x-convert" received signal SIGSEGV, Segmentation fault.
#0  0x0000000000000000 in ?? ()
#1  0x00007fffe7b02007 in ?? () from /opt/intel/opencl-runtime/lib64/libcpu_device.so
#2  0x00007fffe7b0c33b in ?? () from /opt/intel/opencl-runtime/lib64/libcpu_device.so
#3  0x00007fffe7b0d826 in clDevCreateDeviceInstance () from /opt/intel/opencl-runtime/lib64/libcpu_device.so
#4  0x00007fffe84b7fa5 in ?? () from /opt/intel/opencl-runtime/lib64/libintelocl.so
#5  0x00007fffe8479b69 in ?? () from /opt/intel/opencl-runtime/lib64/libintelocl.so
#6  0x00007fffe84569a2 in ?? () from /opt/intel/opencl-runtime/lib64/libintelocl.so
#7  0x00007fffe843bb74 in clCreateContext () from /opt/intel/opencl-runtime/lib64/libintelocl.so
#8  0x00007fffee87a060 in clCreateContext () from /usr/lib/libOpenCL.so.1
#9  0x00007ffff79a27ec in w2xc::initOpenCL (c=0x6ad6e0, env=0x6ad750, proc=0x6f4ec0) at /tmp/makepkg/waifu2x-converter-cpp-git/src/waifu2x-converter-cpp/src/modelHandler_OpenCL.cpp:209
#10 0x00007ffff79aa29e in w2xconv_init_with_processor (processor_idx=2, nJob=8, enable_log=1) at /tmp/makepkg/waifu2x-converter-cpp-git/src/waifu2x-converter-cpp/src/w2xconv.cpp:379
#11 0x000000000041ab35 in main (argc=7, argv=0x7fffffffdcf8) at /tmp/makepkg/waifu2x-converter-cpp-git/src/waifu2x-converter-cpp/src/main.cpp:187
eigengrau commented 7 years ago

Rebuilt with CXXFLAGS=-g, edited original comment.

eigengrau commented 7 years ago

The Intel OpenCL segfault looks the same on my other Intel machine (Ivybridge, the other was Sandybridge). NVidia OpenCL seems to work.