Skip to content

Commit a0ae2e9

Browse files
Minor badbuffer README tweaks
Signed-off-by: Charles Congdon <charles.w.congdon@intel.com>
1 parent be2bf03 commit a0ae2e9

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • Tools/ApplicationDebugger/guided_matrix_mult_BadBuffers

Tools/ApplicationDebugger/guided_matrix_mult_BadBuffers/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ A recent addition to the oneAPI compiler is that ability to use the "Address San
187187
Take a look at the lines where the arrays are allocated:
188188

189189
```
190-
buffer<float, 2> a_buf(range(0, 0));
191-
buffer<float, 2> b_buf(range(N, P));
192-
buffer c_buf(reinterpret_cast<float *>(c_back), range(M, P));
190+
61 buffer<float, 2> a_buf(range(0, 0));
191+
62 buffer<float, 2> b_buf(range(N, P));
192+
63 buffer c_buf(reinterpret_cast<float *>(c_back), range(M, P));
193193
```
194194

195195
Well, that's a problem. `a` was accidentally allocated with zero size. Fix this like you see in `a2_matrix_mul.cpp` and things will work just fine.
@@ -470,7 +470,7 @@ Let us use the Address Sanitizer again to catch invalid pointer addresses at run
470470
128 });
471471
```
472472
473-
4. Understand what is happening
473+
4. Putting together what we know
474474
475475
Looking at the error, we see that we were trying to read local index `LID(68, 3, 0)` , or global index `GID(468, 73, 0)` of either array `a` or array `b`. According to the text when the program ran (`Problem size: c(150,600) = a(150,300) * b(300,600)`) both of these indexes are in range, but are they?
476476
@@ -488,6 +488,7 @@ Let us use the Address Sanitizer again to catch invalid pointer addresses at run
488488
489489
In `b1_matrix_mul_null_usm.cpp` a bad (in this case, null) pointer that is supposed to represent allocated memory on the device is inadvertently passed as an argument to a kernel. This example uses explicitly allocated device memory rather than SYCL buffers like the previous example.
490490
491+
#### Checking the Behavior using Multiple Backends
491492
1. Run the program on the GPU using Level Zero.
492493
```
493494
ONEAPI_DEVICE_SELECTOR=level_zero:gpu ./b1_matrix_mul_null_usm
@@ -541,7 +542,7 @@ In `b1_matrix_mul_null_usm.cpp` a bad (in this case, null) pointer that is suppo
541542
Segmentation fault (core dumped)
542543
```
543544
544-
#### Attempting to Understand What Is Happening
545+
#### Debugging the Problem
545546
546547
Why did we try with multiple backends? If one had shown correct or incorrect results, and one had crashed, we might be facing a race condition that only occasionally manifests as something that goes terribly wrong. Or one of the backbends might have a bug while the others do not. But here all three crash, so it's likely the program is doing something illegal to memory. The host CPU is a particularly good place to test for illegal memory accesses, because the CPU never allows pointers with an address within a few kilobytes of address `0x0`, while this may be legally allocated memory on the GPU.
547548

0 commit comments

Comments
 (0)