Skip to content

Commit fbca768

Browse files
authored
Update extension with suggestion
Signed-off-by: Sergey Kanaev <[email protected]>
1 parent 16fd8f0 commit fbca768

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

sycl/doc/extensions/Assert/SYCL_ONEAPI_ASSERT.asciidoc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,18 @@ and `+__LINE__+`, and the value of the standard variable `+__func__+`. If the
6262
failing assert comes from an `nd_range` `parallel_for` it will also include the
6363
global ID and the local ID of the failing work item.
6464

65-
It is unspecified whether a failing `assert()` returns to its caller before the
66-
kernel terminates. If a failing call returns, the device code may need to
67-
continue execution without deadlocking for the assertion message to be printed
68-
or for `std::abort()` to be called.
65+
Some devices implement `assert()` natively while others use a fallback
66+
implementation, and the two implementations provide different guarantees. The
67+
native implementation is most similar to the way `assert()` works on the host. If
68+
an assertion fails in the native implementation, the assertion message is
69+
immediately printed to stderr and the program terminates by calling
70+
`std::abort()`. If an assertion fails with the fallback implementation, the
71+
failing assert() returns back to its caller and the device code must continue
72+
executing (without deadlocking) until the kernel completes. The implementation
73+
prints the assertion message to stderr and terminates with `std::abort()` only
74+
after the kernel completes execution. An application can determine which of the
75+
two mechanisms a device uses by testing the device aspect
76+
`aspect::ext_oneapi_native_assert`.
6977

7078
The `assert()` macro is defined in system include headers, not in SYCL headers.
7179
On most of systems it is `<cassert>` and/or `<assert.h>` header files.

0 commit comments

Comments
 (0)