numba_dpex.core.kernel_interface.indexers module

class numba_dpex.core.kernel_interface.indexers.NdRange(global_size, local_size)

Bases: object

A class to encapsulate all kernel launch parameters.

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.

get_global_range()

Returns a Range defining the index space.

Returns:

Range: A Range object defining the index space.

get_local_range()

Returns a Range defining the index space of a work group.

Returns:

Range: A Range object to specify index space of a work group.

property global_range

Accessor for global_range.

Returns:

Range: The global_range Range object.

property local_range

Accessor for local_range.

Returns:

Range: The local_range Range object.

class numba_dpex.core.kernel_interface.indexers.Range(dim0, dim1=None, dim2=None)

Bases: tuple

A data structure to encapsulate a single kernel launch parameter.

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.

get(index)

Returns the range of a single dimension.

Args:

index (int): The index of the dimension, i.e. [0,2]

Returns:

int: The range of the dimension indexed by index.

size()

Returns the size of a range.

Returns the size of a range by multiplying the range of the individual dimensions.

Returns:

int: The size of a range.