Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional backtrace implementation for validation layer #368

Open
kswiecicki opened this issue Mar 21, 2023 · 0 comments
Open

Add optional backtrace implementation for validation layer #368

kswiecicki opened this issue Mar 21, 2023 · 0 comments
Assignees

Comments

@kswiecicki
Copy link
Contributor

There's an open PR that adds a simple leak-checking mechanism to the validation layer. Leak-checking mechanism searches for unreleased references at the time of the urTearDown() call and provides a backtrace of the time each unreleased record was first recorded.

Default implementation on Linux uses the <execinfo.h> to provide a backtrace that might not be entirely useful. It looks like this:

<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/lib/libur_loader.so.0(+0x62f4e) [0x7f6d71addf4e]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/lib/libur_loader.so.0(urContextCreate+0x56) [0x7f6d71ad0ed6]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x11258) [0x558370258258]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x74f8b) [0x5583702bbf8b]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x5802a) [0x55837029f02a]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x390e3) [0x5583702800e3]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x39c70) [0x558370280c70]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x3a4bd) [0x5583702814bd]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x4aeb4) [0x558370291eb4]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x77beb) [0x5583702bebeb]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x5a47a) [0x5583702a147a]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x4aa0b) [0x558370291a0b]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x232a1) [0x55837026a2a1]
<VALIDATION>[ERROR]: /home/kswiecic/dev/sycl_workspace/unified-runtime/build/bin/validation_test-leaks_mt(+0x2327d) [0x55837026a27d]
<VALIDATION>[ERROR]: /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f6d71541d90]
<VALIDATION>[ERROR]: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f6d71541e40]

It would be beneficial to provide an alternative backtrace implementation that depends on an external library to provide an unmangled backtrace, e.g. libbacktrace, libunwind. Backtrace implementation could be selected at the compile time based on the provided option eg. -DVALIDATION_BACKTRACE_LIBUNWIND.

Mentioned PR: #318.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant