numba_dppy.utils.type_conversion_fns module

Provides helper functions to convert from numba types to numba_dppy types.

Currently the module supports the following converter functions:
  • npytypes_array_to_dppy_array: types.npytypes.Array to

    numba_dppy.dppy_array_type.DPPYArray.

numba_dppy.utils.type_conversion_fns.npytypes_array_to_dppy_array(arrtype, addrspace=1)

Convert Numba’s Array type to numba_dppy’s DPPYArray type.

Numba’s Array type does not have a notion of address space for the data pointer. numba_dppy defines its own array type, DPPYArray, that is similar to Numba’s Array, but the data pointer has an associated address space. In addition, the meminfo and the parent attributes of Array are stored as CPointer types instead of PyObject. The converter function converts the Numba Array type to DPPYArray type with address space of pointer members typed to the specified address space.

Args:
arrtype (numba.types): A numba data type that should be

numba.types.Array.

specified: Defaults to numba_dppy.utils.address_space.GLOBAL.

The SPIR-V address space to which the data pointer of the array belongs.

Returns: The numba_dppy data type corresponding to the input numba type.

Raises:
NotImplementedError: If the input numba type is not

numba.types.Array