numba_vulkan.mathfuncs#

math functions that Vulkan lacks, written in Python.

These are fallbacks. Where libclc provides a function (see numba_vulkan.mathimpl.libclc_name), its version is used instead; the implementations here serve when libclc is not installed and with fastmath.

GLSL.std.450 has no hypot, log1p, erf, gamma… and there is no vendor math library to fall back on, as libdevice is for CUDA. The functions here are ordinary Python implementations that Numba compiles for the Vulkan target whenever a kernel calls the corresponding math function.

Each factory receives the Numba float type to compute in and returns the implementation for it. All constants are created in that type, because a Python float literal would promote the whole computation to float64.

The transcendental building blocks (exp, log, sin) are 32-bit only on Vulkan, so most of these functions inherit that restriction; see numba_vulkan.mathimpl.