This section contains information, tips and pointers on debugging SYCL™ applications on various devices.
The host part of a SYCL application can simply be debugged as a C++ application, but kernel debugging support or tooling may vary depending on the device being targeted.
Note
If a SYCL application is generic, it may sometimes be helpful to debug it on devices with better debugging support and tooling such as an Intel® OpenCL™ CPU device, rather than on the actual target device.
Debugging on an Intel OpenCL CPU Device
Documentation regarding debugging a DPC++ application using the Intel OpenCL CPU device can be found in the Debugging the DPC++ and OpenMP* Offload Process section of the Intel oneAPI Programming Guide.
ROCm™ Debugger Support
The ROCm SDK comes with a debugger rocgdb
that can be used to debug kernels
on AMD GPUs for HIP applications.
However, DPC++ is currently unable to generate appropriate debug information
for SYCL kernels targeting AMD GPUs. So, trying to debug a SYCL kernel using
rocgdb
will fail with an error such as:
Thread 5 "dbg" hit Breakpoint 1, with lanes [0-63], main::{lambda(sycl::_V1::handler&)#1}::operator()(sycl::_V1::handler&) const::{lambda(sycl::_V1::id<1>)#1}::operator()(sycl::_V1::id<1>) const (/long_pathname_so_that_rpms_can_package_the_debug_info/src/rocm-gdb/gdb/dwarf2/frame.c:1032: internal-error: Unknown CFA rule.
The debugger can still be helpful when the application is built without debug
information. For example if a kernel is throwing an error such as an invalid
memory access, it’s possible to use rocgdb
to run the program. It will
then break on the error and the kernel assembly can be inspected at the point
triggering the error using the disas
command.