You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Tools/ApplicationDebugger/guided_matrix_mult_Exceptions/README.md
+37-35Lines changed: 37 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ The sample code is a simple program that multiplies together two large matrices
13
13
14
14
## Purpose
15
15
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.
17
17
18
18
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.
19
19
@@ -31,11 +31,12 @@ The sample includes three different versions of some simple matrix multiplicatio
31
31
32
32
## Prerequisites
33
33
34
-
| Optimized for | Description
35
-
|:--- |:---
34
+
| Optimized for | Description
35
+
|:--- |:---
36
36
| OS | Ubuntu* 24.04 LTS
37
37
| 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
39
40
40
41
41
42
## Key Implementation Details
@@ -54,7 +55,7 @@ When working with the command-line interface (CLI), you should configure the one
54
55
## Build and Run the `Guided Matrix Multiplication Exception` Programs
55
56
56
57
> **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.
58
59
>
59
60
> Linux*:
60
61
> - 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
147
148
Device max work item size: 1024, 1024, 1024
148
149
Device max work group size: 1024
149
150
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
151
152
terminate called after throwing an instance of 'sycl::_V1::exception'
152
153
what(): NULL pointer argument in memory copy operation.
153
154
Aborted (core dumped)
@@ -160,13 +161,15 @@ As an exercise, let's find this a debugger (any host debugger will work; however
160
161
gdb-oneapi ./1_matrix_mul_null_pointer
161
162
(gdb) run
162
163
```
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.
164
167
165
168
2. Notice the application failure. The error is the same message seen when we ran it outside the debugger.
166
169
```
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
168
171
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.
170
173
171
174
Thread 1.1 "1_matrix_mul_nu" received signal SIGABRT, Aborted.
172
175
```
@@ -215,7 +218,9 @@ In the second version, the code attempts to execute more than one offload statem
215
218
gdb-oneapi ./2_matrix_mul_multi_offload
216
219
(gdb) run
217
220
```
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.
219
224
220
225
2. The error is the same message seen when we ran it outside the debugger.
221
226
```
@@ -224,14 +229,14 @@ In the second version, the code attempts to execute more than one offload statem
224
229
225
230
Thread 1.1 "2_matrix_mul_mu" received signal SIGABRT, Aborted.
226
231
```
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.
228
233
229
234
3. Run a `backtrace` to get summary showing the rough location that triggered the assert.
230
235
```
231
236
(gdb) backtrace
232
237
```
233
238
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):
235
240
```
236
241
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
237
242
#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
242
247
#6 0x00007ffff78bb0da in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
243
248
#7 0x00007ffff78a5a55 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
244
249
#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
0 commit comments