Skip to content

Commit 32a32f4

Browse files
author
Sergey Kanaev
committed
Reorder text to increase readability
Signed-off-by: Sergey Kanaev <[email protected]>
1 parent a5461f3 commit 32a32f4

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

sycl/doc/Assert.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,8 @@ performed only when assertion is enabled and Device-side Runtime doesn't provide
200200
implementation of `__devicelib_assert_fail`.
201201

202202
In DPCPP headers one can see if assert is enabled with status of `NDEBUG` macro
203-
with `#ifdef`'s. This allows to enqueue a copy kernel and host task. The copy
204-
kernel will copy `AssertHappenedMem` to host and host-task will check the `Flag`
205-
value and `abort()` as needed. The kernel and host task are enqueued when
206-
`NDEBUG` macro isn't defined.
207-
208-
When in DPCPP Runtime Library this knowledge is obtained from device binary
209-
image descriptor's property sets.
203+
with `#ifdef`'s. When in DPCPP Runtime Library this knowledge is obtained from
204+
device binary image descriptor's property sets.
210205

211206
Each device image is supplied with an array of property sets. For description
212207
of property sets see `struct pi_device_binary_struct` in
@@ -347,6 +342,19 @@ fail.
347342

348343
### Raising assert failure flag and reading it on host
349344

345+
In DPCPP headers one can see if assert is enabled with status of `NDEBUG` macro
346+
with `#ifdef`'s. Though, in order to support for multi translation unit use-case
347+
it's not allowed to rely on definition of `NDEBUG` macro.
348+
349+
*Note: Multi translation unit use-case here is the one with `SYCL_EXTERNAL`
350+
function compiled with assertions enabled and used in a kernel but the kernel
351+
is compiled with assertions disabled.*
352+
353+
There're two commands used for reading assert failure flag: copy kernel and
354+
checker host task. The copy kernel will copy `AssertHappenedMem` to host and
355+
host-task will check the `Flag` value and `abort()` as needed. The kernel and
356+
host task are enqueued when `NDEBUG` macro isn't defined.
357+
350358
All translation units provided by the user should have a declaration of the
351359
assert flag read function available:
352360
```c++

0 commit comments

Comments
 (0)