numba_dpex.kernel_api.ranges

Defines types to define the range of execution of a kernel. The types are designed along the lines of classes defined in the SYCL 2020 spec section 4.9.

Overview

Classes

Range

Analogue to the sycl::range class.

NdRange

Analogue to the sycl::nd_range class.

Classes

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

Methods

get(index)

Returns the range of a single dimension.

size()

Returns the size of a range.

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 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

Methods

get_global_range()

Returns a Range defining the index space.

get_local_range()

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:

Range

get_local_range()

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

Returns:

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

Return type:

Range