Segfault when releasing access from host

HI

Could you please instruct me how I can debug segfault in a Sycl program ? Are there some tools ? The trace shows that the segfault occurs in release_access_from_host. In my program, the device buffers are accessed from the host accessors.

Thanks

#0 0x00007ffff67d55bd in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff67d82ed in malloc () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff717b258 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff761fc71 in cl::sycl::detail::view::release_access_from_host(void*, bool) ()
from /usr/local/ComputeCpp-CE-1.1.4-Ubuntu-16.04-x86_64/lib/libComputeCpp.so
#4 0x00007ffff76110e0 in cl::sycl::detail::storage_mem::release_access() ()
from /usr/local/ComputeCpp-CE-1.1.4-Ubuntu-16.04-x86_64/lib/libComputeCpp.so
#5 0x00007ffff7611276 in cl::sycl::detail::storage_mem::~storage_mem() ()
from /usr/local/ComputeCpp-CE-1.1.4-Ubuntu-16.04-x86_64/lib/libComputeCpp.so
#6 0x00007ffff760f299 in cl::sycl::storage_mem::~storage_mem() ()

Hi zjin,

SYCL application debugging has also been addressed in other forum topics under the SYCL development category so you might wanna have a look, for example, here.

You can debug SYCL code with the standard tools you would use for debugging C++ but only on the host device.

  • Make sure that you are compiling the application binary with the debug symbols by adding -g to your compilation command or if you are using CMake, specify the -DCMAKE_BUILD_TYPE=Debug option.
  • Create a queue from a host device selector. e.g.,
    cl::sycl::queue myQueue(cl::sycl::host_selector{});
  • Run gdb and inspect the segfault-related frames from the backtrace.
  • I would also recommend running valgrind with memcheck to help detect the memory errors:
    valgrind --leak-check=full --show-leak-kinds=all ./your-application

Lookup the memcheck-manual for more information that explains in details the memcheck error messages.

Regards,
Georgi