Assertions in kernel code
From now on, it is possible to put assertions in a kernel function:
function [] = __kernel__ kernel (pos : ivec3)
b = 2
assert(b==3)
end
In this example, the assertion obviously fails. Quasar breaks with the following error message:
(parallel_do) test_kernel - assertion failed: line 23
Note that the assertion handling is implemented in CUDA using a C macro:
#define assert(x) if(!(x)) __trap;
Also see CUDA Error handling for more information about assertions and error handling.