Skip to content

Commit ee8133c

Browse files
committed
Merge pull request #2700 from CharlesCongdon/cc_tutupdate20253
2025.3 Guided Debugging Sample updates
1 parent 6f5ade5 commit ee8133c

10 files changed

Lines changed: 455 additions & 268 deletions

File tree

Tools/ApplicationDebugger/guided_matrix_mult_BadBuffers/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required (VERSION 3.4)
1+
cmake_minimum_required (VERSION 3.5)
22
set (CMAKE_CXX_COMPILER "icpx")
33
project (matrix_mul LANGUAGES CXX)
44

Tools/ApplicationDebugger/guided_matrix_mult_BadBuffers/README.md

Lines changed: 200 additions & 91 deletions
Large diffs are not rendered by default.

Tools/ApplicationDebugger/guided_matrix_mult_Exceptions/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required (VERSION 3.4)
1+
cmake_minimum_required (VERSION 3.5)
22
set (CMAKE_CXX_COMPILER "icpx")
33
project (matrix_mul LANGUAGES CXX)
44

Tools/ApplicationDebugger/guided_matrix_mult_Exceptions/README.md

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The sample code is a simple program that multiplies together two large matrices
1313
1414
## Purpose
1515

16-
The two samples in this tutorial show examples of situations where the SYCL runtime provides an assert when it detects incorrect use of the SYCL API that is not caught at build time. Unfortunately, these runtime error checks are not comprehensive, so not getting an assert does not indicate correct code structure or practices.
16+
The two samples in this tutorial show situations where the SYCL runtime provides an assert when it detects incorrect use of the SYCL API that is not caught at build time. Unfortunately, these runtime error checks are not comprehensive, so not getting an assert does not indicate correct code structure or practices.
1717

1818
Currently, SYCL asserts only tell you that an error was detected, but not where it resides in your code. To determine the location, you must run the program in the Intel® Distribution for GDB* with debug symbols enabled. Turning off optimization can also help.
1919

@@ -31,11 +31,12 @@ The sample includes three different versions of some simple matrix multiplicatio
3131

3232
## Prerequisites
3333

34-
| Optimized for | Description
35-
|:--- |:---
34+
| Optimized for | Description
35+
|:--- |:---
3636
| OS | Ubuntu* 24.04 LTS
3737
| Hardware | GEN9 or newer
38-
| Software | Intel® oneAPI DPC++/C++ Compiler 2025.1 <br> Intel® Distribution for GDB* 2025.1
38+
| Software | Intel® oneAPI DPC++/C++ Compiler 2025.3 <br> Intel® Distribution for GDB* 2025.3
39+
| Intel GPU Driver | Intel® General-Purpose GPU Long-Term Support driver 2523.31 or later from https://dgpu-docs.intel.com/releases/releases.html
3940

4041

4142
## Key Implementation Details
@@ -54,7 +55,7 @@ When working with the command-line interface (CLI), you should configure the one
5455
## Build and Run the `Guided Matrix Multiplication Exception` Programs
5556

5657
> **Note**: If you have not already done so, set up your CLI
57-
> environment by sourcing the `setvars` script in the root of your oneAPI installation.
58+
environment by sourcing the `setvars` script in the root of your oneAPI installation.
5859
>
5960
> Linux*:
6061
> - For system wide installations: `. /opt/intel/oneapi/setvars.sh`
@@ -147,7 +148,7 @@ In `1_matrix_mul_null_pointer` a null pointer is passed to a SYCL `memcpy` state
147148
Device max work item size: 1024, 1024, 1024
148149
Device max work group size: 1024
149150
Problem size: c(150,600) = a(150,300) * b(300,600)
150-
Exception caught at File: 1_matrix_mul_null_pointer.cpp | Function: main | Line: 95 | Column: 5
151+
Exception caught at File: 1_matrix_mul_null_pointer.cpp | Function: main | Line: 95 | Column: 7
151152
terminate called after throwing an instance of 'sycl::_V1::exception'
152153
what(): NULL pointer argument in memory copy operation.
153154
Aborted (core dumped)
@@ -160,13 +161,15 @@ As an exercise, let's find this a debugger (any host debugger will work; however
160161
gdb-oneapi ./1_matrix_mul_null_pointer
161162
(gdb) run
162163
```
163-
When you get the error message `Debugging of GPU offloaded code is not enabled`, ignore it and answer `n` to the question `Quit anyway? (y or n)`
164+
> When you get the error message `Debugging of GPU offloaded code is not enabled`, ignore it and answer `n` to the question `Quit anyway? (y or n)`. You may need to do this more than once.
165+
166+
> Why can we ignore these messages and keep on debugging anyway? Because we don't need to monitor the code running on the device in the debugger - the asserts are coming from the host during the call of the kernel. Running `gdb-oneapi` with `ZET_ENABLE_PROGRAM_DEBUGGING=1` is only necessary if you want to debug the kernels running on the GPU.
164167
165168
2. Notice the application failure. The error is the same message seen when we ran it outside the debugger.
166169
```
167-
Exception caught at File: 1_matrix_mul_null_pointer.cpp | Function: main | Line: 95 | Column: 5
170+
Exception caught at File: 1_matrix_mul_null_pointer.cpp | Function: main | Line: 95 | Column: 7
168171
terminate called after throwing an instance of 'sycl::_V1::exception'
169-
what(): NULL pointer argument in memory copy operation.
172+
what(): NULL pointer argument in memory copy operation.
170173
171174
Thread 1.1 "1_matrix_mul_nu" received signal SIGABRT, Aborted.
172175
```
@@ -215,7 +218,9 @@ In the second version, the code attempts to execute more than one offload statem
215218
gdb-oneapi ./2_matrix_mul_multi_offload
216219
(gdb) run
217220
```
218-
When you get the error message `Debugging of GPU offloaded code is not enabled`, ignore it and answer `n` to the question `Quit anyway? (y or n)`
221+
> When you get the error message `Debugging of GPU offloaded code is not enabled`, ignore it and answer `n` to the question `Quit anyway? (y or n)`. You may need to do this more than once.
222+
223+
> Why can we ignore these messages and keep on debugging anyway? Because we don't need to monitor the code running on the device in the debugger - the asserts are coming from the host during the call of the kernel. Running `gdb-oneapi` with `ZET_ENABLE_PROGRAM_DEBUGGING=1` is only necessary if you want to debug the kernels running on the GPU.
219224
220225
2. The error is the same message seen when we ran it outside the debugger.
221226
```
@@ -224,14 +229,14 @@ In the second version, the code attempts to execute more than one offload statem
224229
225230
Thread 1.1 "2_matrix_mul_mu" received signal SIGABRT, Aborted.
226231
```
227-
The exception talks about a “command group” and that only a single command group is allowed within a `submit`. A command group is something like a `parallel_for` or a SYCL `memcpy` statement – it’s a language construct or function call that makes something happen on the device. Only one action is allowed per `submit` construct.
232+
The exception talks about a “command group” and that only a single command group is allowed within a `submit`. A command group is something like a `parallel_for` or a SYCL `memcpy` statement – it’s a language construct or function call that makes something happen on the device. Only one such action is allowed per `submit` construct.
228233

229234
3. Run a `backtrace` to get summary showing the rough location that triggered the assert.
230235
```
231236
(gdb) backtrace
232237
```
233238

234-
4. Notice in the results (which should look something like the following) that the exception (frame 8) was triggered around line 98 (frame 19):
239+
4. Notice in the results (which should look something like the following) that the exception (frame 8) was triggered around line 98 (frame 17):
235240
```
236241
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
237242
#1 __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
@@ -242,37 +247,34 @@ In the second version, the code attempts to execute more than one offload statem
242247
#6 0x00007ffff78bb0da in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
243248
#7 0x00007ffff78a5a55 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
244249
#8 0x00007ffff78bb391 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
245-
#9 0x00007ffff7f076a0 in sycl::_V1::handler::memcpy(void*, void const*, unsigned long) ()
246-
from /opt/intel/oneapi/compiler/2025.1/lib/libsycl.so.8
247-
#10 0x0000000000404ba2 in main::{lambda(auto:1&)#1}::operator()<sycl::_V1::handler>(sycl::_V1::handler&) const (
248-
this=0x7fffffffb2d8, h=sycl::handler& = {...})
249-
at /nfs/site/home/cwcongdo/oneAPI-samples-true/Tools/ApplicationDebugger/guided_matrix_mult_Exceptions/src/2_matrix_mul_multi_offload.cpp:100
250-
#11 0x0000000000404b3d in std::__invoke_impl<void, main::{lambda(auto:1&)#1}&, sycl::_V1::handler&>(std::__invoke_other, main::{lambda(auto:1&)#1}&, sycl::_V1::handler&) (__f=..., __args=sycl::handler& = {...})
251-
at /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:61
252-
#12 0x0000000000404add in std::__invoke_r<void, main::{lambda(auto:1&)#1}&, sycl::_V1::handler&>(main::{lambda(auto:1&)#1}&, sycl::_V1::handler&) (__fn=..., __args=sycl::handler& = {...})
253-
at /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/invoke.h:111
254-
#13 0x00000000004049f5 in std::_Function_handler<void (sycl::_V1::handler&), main::{lambda(auto:1&)#1}>::_M_invoke(std::_Any_data const&, sycl::_V1::handler&) (__functor=..., __args=sycl::handler& = {...})
255-
at /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:290
256-
#14 0x00007ffff7e83121 in sycl::_V1::detail::queue_impl::submit_impl(std::function<void (sycl::_V1::handler&)> const&, std::shared_ptr<sycl::_V1::detail::queue_impl> const&, std::shared_ptr<sycl::_V1::detail::queue_impl> const&, std::shared_ptr<sycl::_V1::detail::queue_impl> const&, bool, sycl::_V1::detail::code_location const&, bool, sycl::_V1::detail::SubmissionInfo const&) () from /opt/intel/oneapi/compiler/2025.1/lib/libsycl.so.8
257-
#15 0x00007ffff7e895c8 in sycl::_V1::detail::queue_impl::submit_with_event(std::function<void (sycl::_V1::handler&)> const&, std::shared_ptr<sycl::_V1::detail::queue_impl> const&, sycl::_V1::detail::SubmissionInfo const&, sycl::_V1::detail::code_location const&, bool) () from /opt/intel/oneapi/compiler/2025.1/lib/libsycl.so.8
258-
#16 0x00007ffff7f33afa in sycl::_V1::queue::submit_with_event_impl(std::function<void (sycl::_V1::handler&)>, sycl::_V1::detail::SubmissionInfo const&, sycl::_V1::detail::code_location const&, bool) ()
259-
from /opt/intel/oneapi/compiler/2025.1/lib/libsycl.so.8
260-
#17 0x00000000004048b3 in sycl::_V1::queue::submit_with_event<main::{lambda(auto:1&)#1}>(main::{lambda(auto:1&)#1}, sycl::_V1::queue*, sycl::_V1::detail::code_location const&) (this=0x7fffffffb860, CGF=..., SecondaryQueuePtr=0x0,
261-
CodeLoc=...) at /opt/intel/oneapi/compiler/2025.1/bin/compiler/../../include/sycl/queue.hpp:2826
262-
#18 0x00000000004042cd in sycl::_V1::queue::submit<main::{lambda(auto:1&)#1}>(main::{lambda(auto:1&)#1}, sycl::_V1::detail::code_location const&) (this=0x7fffffffb860, CGF=..., CodeLoc=...)
263-
at /opt/intel/oneapi/compiler/2025.1/bin/compiler/../../include/sycl/queue.hpp:365
264-
#19 0x0000000000403edc in main ()
265-
at 2_matrix_mul_multi_offload.cpp:98
250+
#9 0x00007ffff7f11ed0 in sycl::_V1::handler::memcpy(void*, void const*, unsigned long) ()
251+
from /opt/intel/oneapi/compiler/2025.3/lib/libsycl.so.8
252+
#10 0x0000000000404812 in main::{lambda(auto:1&)#1}::operator()<sycl::_V1::handler>(sycl::_V1::handler&) const (
253+
this=0x7fffffffb098, h=sycl::handler& = {...})
254+
at Tools/ApplicationDebugger/guided_matrix_mult_Exceptions/src/2_matrix_mul_multi_offload.cpp:100
255+
#11 0x00000000004047ad in sycl::_V1::detail::type_erased_cgfo_ty::invoker<main::{lambda(auto:1&)#1}>::call(void const*, sycl::_V1::handler&) (object=0x7fffffffb098, cgh=sycl::handler& = {...})
256+
at /opt/intel/oneapi/compiler/2025.3/bin/compiler/../../include/sycl/handler.hpp:190
257+
#12 0x00007ffff7e8a4a4 in sycl::_V1::detail::queue_impl::submit_impl(sycl::_V1::detail::type_erased_cgfo_ty const&, sycl::_V1::detail::queue_impl*, bool, sycl::_V1::detail::code_location const&, bool, sycl::_V1::detail::v1::SubmissionInfo const&) () from /opt/intel/oneapi/compiler/2025.3/lib/libsycl.so.8
258+
#13 0x00007ffff7e90022 in sycl::_V1::detail::queue_impl::submit_with_event(sycl::_V1::detail::type_erased_cgfo_ty const&, sycl::_V1::detail::v1::SubmissionInfo const&, sycl::_V1::detail::code_location const&, bool) ()
259+
from /opt/intel/oneapi/compiler/2025.3/lib/libsycl.so.8
260+
#14 0x00007ffff7f58844 in sycl::_V1::queue::submit_with_event_impl(sycl::_V1::detail::type_erased_cgfo_ty const&, sycl::_V1::detail::v1::SubmissionInfo const&, sycl::_V1::detail::code_location const&, bool) const ()
261+
from /opt/intel/oneapi/compiler/2025.3/lib/libsycl.so.8
262+
#15 0x0000000000407392 in sycl::_V1::queue::submit_with_event<false, sycl::_V1::ext::oneapi::experimental::properties<sycl::_V1::ext::oneapi::experimental::detail::properties_type_list<> > >(sycl::_V1::ext::oneapi::experimental::properties<sycl::_V1::ext::oneapi::experimental::detail::properties_type_list<> >, sycl::_V1::detail::type_erased_cgfo_ty const&, sycl::_V1::detail::code_location const&) const (this=0x7fffffffb570, Props=..., CGF=..., CodeLoc=...)
263+
at /opt/intel/oneapi/compiler/2025.3/bin/compiler/../../include/sycl/queue.hpp:3762
264+
#16 0x00000000004042a1 in sycl::_V1::queue::submit<main::{lambda(auto:1&)#1}>(main::{lambda(auto:1&)#1}, sycl::_V1::detail::code_location const&) (this=0x7fffffffb570, CGF=..., CodeLoc=...)
265+
at /opt/intel/oneapi/compiler/2025.3/bin/compiler/../../include/sycl/queue.hpp:429
266+
#17 0x0000000000403eac in main ()
267+
at Tools/ApplicationDebugger/guided_matrix_mult_Exceptions/src/2_matrix_mul_multi_offload.cpp:98
266268
267269
```
268270

269271
5. Examine the last frame (it may be different from the output above) using the following command:
270272
```
271-
(gdb) frame 19
273+
(gdb) frame 17
272274
```
273275
You may need to issue this command twice before you see output similar to the following example:
274276
```
275-
#19 0x0000000000403e7c in main ()
277+
#17 0x0000000000403e7c in main ()
276278
at 2_matrix_mul_multi_offload.cpp:98
277279
98 q.submit([&](auto &h) {
278280
```

Tools/ApplicationDebugger/guided_matrix_mult_InvalidContexts/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required (VERSION 3.4)
1+
cmake_minimum_required (VERSION 3.5)
22
set (CMAKE_CXX_COMPILER "icpx")
33
project (matrix_mul LANGUAGES CXX)
44

0 commit comments

Comments
 (0)