@@ -62,10 +62,18 @@ and `+__LINE__+`, and the value of the standard variable `+__func__+`. If the
62
62
failing assert comes from an `nd_range` `parallel_for` it will also include the
63
63
global ID and the local ID of the failing work item.
64
64
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`.
69
77
70
78
The `assert()` macro is defined in system include headers, not in SYCL headers.
71
79
On most of systems it is `<cassert>` and/or `<assert.h>` header files.
0 commit comments