numba_dpex.core.utils package

Subpackages

Submodules

Module contents

class numba_dpex.core.utils.SyclUSMArrayInterface(data, writable, size, shape, dimensions, itemsize, strides, dtype, usm_type, device, queue)

Bases: object

Stores as attributes the information extracted from a __sycl_usm_array_interface__ dictionary as defined by dpctl.memory.Memory* classes.

property data
property device
property dimensions
property dtype
property is_writable
property itemsize
property queue
property shape
property size
property strides
property usm_type
numba_dpex.core.utils.build_key(*args)

Constructs key from variable list of args

Args:

*args: List of components to construct key

Return:

Tuple of args

numba_dpex.core.utils.create_func_hash(pyfunc)

Creates a tuple of sha256 hashes out of code and variable bytes extracted from the compiled funtion.

Args:

pyfunc: Python function object

Return:

Tuple of hashes of code and variable bytes

numba_dpex.core.utils.get_info_from_suai(obj)

Extracts the metadata of an object of type UsmNdArray using the objects __sycl_usm_array_interface__ (SUAI) attribute.

The dpctl.memory.as_usm_memory function converts the array-like object into a dpctl.memory.USMMemory object. Using the as_usm_memory is an implicit way to verify if the array-like object is a legal SYCL USM memory back Python object that can be passed to a dpex kernel.

Args:

obj: array-like object with a SUAI attribute.

Returns:

A SyclUSMArrayInterface object

numba_dpex.core.utils.strip_usm_metadata(argtypes)

Convert the USMNdArray to an abridged type that disregards the usm_type, device, queue, address space attributes.

Args:

argtypes: List of types

Return:

Tuple of types after removing USM metadata from USMNdArray type