numba-dpex
numba-dpex copied to clipboard
Make python statements available in the kernel
The kernel
function currently silently ignores Python exceptions and assertions.
- [ ] The raise statement
- [ ] The assert statement
It is the correct behavior as a kernel cannot have exception and assertion errors raised during execution. Thus, a proper user experience will be to raise an exception during lowering of a kernel if the kernel has either a raise
or an assert
.
To implement the feature the DpexCallConv
used by the DpexKernelTarget
should override we have to override return_user_exc
to raise errors at compile-time.
~Solved by #1244~
Looks like we need to silently ignore the assert
and raise
statements in kernel. Overloading return_user_exc
will cause to fail different python expressions inside kernel, like range
and %
, because the numba
lowering mechanism of these expressions throw exceptions in different places.