numba_vulkan.ufuncs#

How NumPy ufuncs are lowered on the Vulkan target.

Numba lowers a call such as np.sqrt(x) by looking up the ufunc’s “loops” (one per combination of argument types) in a database supplied by the target. This module builds that database, following the structure of numba.cuda.ufuncs:

  • arithmetic, comparison, logical and bitwise ufuncs reuse Numba’s CPU implementations, which emit plain LLVM instructions;

  • everything that needs a math library is routed to this target’s implementation of the corresponding math function, so that ufuncs and math behave identically (including the float64 restrictions).

Only loops over booleans, integers, float32 and float64 are provided.

Functions#

ufunc_db()

Build the database of supported ufunc loops.

get_ufunc_info(ufunc_key)

Look up the loops of a ufunc.

Module Contents#

numba_vulkan.ufuncs.ufunc_db()#

Build the database of supported ufunc loops.

Returns:

Maps each supported ufunc to a dictionary from NumPy loop signature (for example "ff->f") to the function generating that loop.

Return type:

dict

numba_vulkan.ufuncs.get_ufunc_info(ufunc_key)#

Look up the loops of a ufunc.

Parameters:

ufunc_key (numpy.ufunc) – The ufunc.

Returns:

Loop signature to implementation.

Return type:

dict

Raises:

KeyError – If the ufunc is not supported on Vulkan.