numba_dpex.core.boxing¶
Contains the box
and unbox
functions for numba_dpex types that are
passable as arguments to a kernel or dpjit decorated function.
Overview¶
Numba-dpex type corresponding to |
|
Numba-dpex type corresponding to |
|
Analogue to the sycl::nd_range class. |
|
Analogue to the sycl::range class. |
|
A type class to represent dpctl.tensor.usm_ndarray. |
|
Analogue to the sycl::nd_range class. |
|
Analogue to the sycl::range class. |
|
Converts a Python Range object to numba-dpex’s native struct representation |
|
Converts a Python Range object to numba-dpex’s native struct representation |
|
Convert a native range structure to a Range object. |
|
Convert a native range structure to a Range object. |
|
Converts a dpctl.tensor.usm_ndarray/dpnp.ndarray object to a Numba-dpex |
|
Boxes a NativeValue representation of USMNdArray/DpnpNdArray type into a |
Classes¶
- class NdRangeType(ndim: int)¶
Bases:
numba.core.types.Type
Numba-dpex type corresponding to
numba_dpex.kernel_api.ranges.NdRange
- class RangeType(ndim: int)¶
Bases:
numba.core.types.Type
Numba-dpex type corresponding to
numba_dpex.kernel_api.ranges.Range
- class NdRange(global_size, local_size)¶
Analogue to the sycl::nd_range class.
The NdRange defines the index space for a work group as well as the global index space. It is passed to parallel_for to execute a kernel on a set of work items.
This class basically contains two Range object, one for the global_range and the other for the local_range. The global_range parameter contains the global index space and the local_range parameter contains the index space of a work group. This class mimics the behavior of sycl::nd_range class.
Overview
¶ Returns a Range defining the index space.
Returns a Range defining the index space of a work group.
Members
- get_global_range()¶
Returns a Range defining the index space.
- Returns:
A Range object defining the index space.
- Return type:
- class Range¶
Bases:
tuple
Analogue to the sycl::range class.
The range is an abstraction that describes the number of elements in each dimension of buffers and index spaces. It can contain 1, 2, or 3 numbers, depending on the dimensionality of the object it describes.
This is just a wrapper class on top of a 3-tuple. The kernel launch parameter is consisted of three int’s. This class basically mimics the behavior of sycl::range.
Overview
Members
- get(index)¶
Returns the range of a single dimension.
- Parameters:
index (int) – The index of the dimension, i.e. [0,2]
- Returns:
The range of the dimension indexed by index.
- Return type:
int
- size()¶
Returns the size of a range.
Returns the size of a range by multiplying the range of the individual dimensions.
- Returns:
The size of a range.
- Return type:
int
- class USMNdArray(ndim, layout='C', dtype=None, usm_type='device', device=None, queue=None, readonly=False, name=None, aligned=True, addrspace=address_space.GLOBAL.value)¶
Bases:
numba.core.types.npytypes.Array
A type class to represent dpctl.tensor.usm_ndarray.
Overview
¶ copy
(dtype, ndim, layout, readonly, addrspace, device, usm_type)-
unify
(typingctx, other)Unify this with the other USMNdArray.
can_convert_to
(typingctx, other)Convert this USMNdArray to the other.
Members
- copy(dtype=None, ndim=None, layout=None, readonly=None, addrspace=None, device=None, usm_type=None)¶
- unify(typingctx, other)¶
Unify this with the other USMNdArray.
- can_convert_to(typingctx, other)¶
Convert this USMNdArray to the other.
- class NdRange(global_size, local_size)¶
Analogue to the sycl::nd_range class.
The NdRange defines the index space for a work group as well as the global index space. It is passed to parallel_for to execute a kernel on a set of work items.
This class basically contains two Range object, one for the global_range and the other for the local_range. The global_range parameter contains the global index space and the local_range parameter contains the index space of a work group. This class mimics the behavior of sycl::nd_range class.
Overview
¶ Returns a Range defining the index space.
Returns a Range defining the index space of a work group.
Members
- get_global_range()¶
Returns a Range defining the index space.
- Returns:
A Range object defining the index space.
- Return type:
- class Range¶
Bases:
tuple
Analogue to the sycl::range class.
The range is an abstraction that describes the number of elements in each dimension of buffers and index spaces. It can contain 1, 2, or 3 numbers, depending on the dimensionality of the object it describes.
This is just a wrapper class on top of a 3-tuple. The kernel launch parameter is consisted of three int’s. This class basically mimics the behavior of sycl::range.
Overview
Members
- get(index)¶
Returns the range of a single dimension.
- Parameters:
index (int) – The index of the dimension, i.e. [0,2]
- Returns:
The range of the dimension indexed by index.
- Return type:
int
- size()¶
Returns the size of a range.
Returns the size of a range by multiplying the range of the individual dimensions.
- Returns:
The size of a range.
- Return type:
int
Functions¶
- unbox_range(typ, obj, c)¶
Converts a Python Range object to numba-dpex’s native struct representation for RangeType.
- unbox_ndrange(typ, obj, c)¶
Converts a Python Range object to numba-dpex’s native struct representation for NdRangeType.
- box_range(typ, val, c)¶
Convert a native range structure to a Range object.
- box_ndrange(typ, val, c)¶
Convert a native range structure to a Range object.
- unbox_dpnp_nd_array(typ, obj, c)¶
Converts a dpctl.tensor.usm_ndarray/dpnp.ndarray object to a Numba-dpex internal array structure.
- Parameters:
typ – The Numba type of the PyObject
obj – The actual PyObject to be unboxed
c – The unboxing context
- Returns: A NativeValue object representing an unboxed
dpctl.tensor.usm_ndarray/dpnp.ndarray
- box_array(typ, val, c)¶
Boxes a NativeValue representation of USMNdArray/DpnpNdArray type into a dpctl.tensor.usm_ndarray/dpnp.ndarray PyObject
- Parameters:
typ – The representation of the USMNdArray/DpnpNdArray type.
val – A native representation of a Numba USMNdArray/DpnpNdArray type object.
c – The boxing context.
- Returns: A Pyobject for a dpctl.tensor.usm_ndarray/dpnp.ndarray boxed from
the Numba-dpex native value.