numba_dpex.kernel_api.index_space_ids

Implements a mock Python classes to represent sycl::item and ``sycl::nd_item``for prototyping numba_dpex kernel functions before they are JIT compiled.

Overview

Classes

Group

Analogue to the sycl::group class.

Item

Analogue to the sycl::item class.

NdItem

Analogue to the sycl::nd_item class.

Classes

class Group(global_range: Range, local_range: Range, group_range: Range, index: list)

Analogue to the sycl::group class.

Represents a particular work-group within a parallel execution and provides API to extract various properties of the work-group. An instance of the class is not user-constructible. Users should use numba_dpex.kernel_api.NdItem.get_group() to access the Group to which a work-item belongs.

Overview

Methods

get_group_id(dim)

Returns a specific coordinate of the multi-dimensional index of a group.

get_group_linear_id()

Returns a linearized version of the work-group index.

get_group_range(dim)

Returns the extent of the range of groups in an nd-range for given dimension.

get_group_linear_range()

Returns the total number of work-groups in the nd_range.

get_local_range(dim)

Returns the extent of the range of work-items in a work-group for given dimension.

get_local_linear_range()

Return the total number of work-items in the work-group.

Members

get_group_id(dim)

Returns a specific coordinate of the multi-dimensional index of a group.

Since the work-items in a work-group have a defined position within the global nd-range, the returned group id can be used along with the local id to uniquely identify the work-item in the global nd-range.

Parameters:

dim (int) – An integral value between (1..3) for which the group index is returned.

Returns:

The coordinate for the dim dimension for the group’s multi-dimensional index within an nd-range.

Return type:

int

Raises:

ValueError – If the dim argument is not in the (1..3) interval.

get_group_linear_id()

Returns a linearized version of the work-group index.

Returns:

The linearized index for the group’s position within an nd-range.

Return type:

int

get_group_range(dim)

Returns the extent of the range of groups in an nd-range for given dimension.

Parameters:

dim (int) – An integral value between (1..3) for which the group index is returned.

Returns:

The extent of group range for the specified dimension.

Return type:

int

get_group_linear_range()

Returns the total number of work-groups in the nd_range.

Returns:

Returns the number of groups in a parallel execution of an nd-range kernel.

Return type:

int

get_local_range(dim)

Returns the extent of the range of work-items in a work-group for given dimension.

Parameters:

dim (int) – An integral value between (1..3) for which the group index is returned.

Returns:

The extent of the local work-item range for the specified dimension.

Return type:

int

get_local_linear_range()

Return the total number of work-items in the work-group.

Returns:

Returns the linearized size of the local range inside an nd-range.

Return type:

int

class Item(extent: Range, index: list)

Analogue to the sycl::item class.

Identifies the work-item in a parallel execution of a kernel launched with the Range index-space class.

Overview

Methods

get_linear_id()

Returns the linear id associated with this item for all dimensions.

get_id(idx)

Get the id for a specific dimension.

get_linear_range()

Return the total number of work-items in the work-group.

get_range(idx)

Get the range size for a specific dimension.

Members

get_linear_id()

Returns the linear id associated with this item for all dimensions.

Returns:

The linear id of the work item in the global range.

Return type:

int

get_id(idx)

Get the id for a specific dimension.

Returns:

The id

Return type:

int

get_linear_range()

Return the total number of work-items in the work-group.

get_range(idx)

Get the range size for a specific dimension.

Returns:

The size

Return type:

int

class NdItem(global_item: Item, local_item: Item, group: Group)

Analogue to the sycl::nd_item class.

Identifies an instance of the function object executing at each point in an NdRange.

Overview

Methods

get_global_id(idx)

Get the global id for a specific dimension.

get_global_linear_id()

Get the linearized global id for the item for all dimensions.

get_local_id(idx)

Get the local id for a specific dimension.

get_local_linear_id()

Get the local linear id associated with this item for all

get_global_range(idx)

Get the global range size for a specific dimension.

get_local_range(idx)

Get the local range size for a specific dimension.

get_local_linear_range()

Return the total number of work-items in the work-group.

get_global_linear_range()

Return the total number of work-items in the work-group.

get_group()

Returns the group.

Members

get_global_id(idx)

Get the global id for a specific dimension.

Returns:

The global id

Return type:

int

get_global_linear_id()

Get the linearized global id for the item for all dimensions.

Returns:

The global linear id.

Return type:

int

get_local_id(idx)

Get the local id for a specific dimension.

Returns:

The local id

Return type:

int

get_local_linear_id()

Get the local linear id associated with this item for all dimensions.

Returns:

The local linear id.

Return type:

int

get_global_range(idx)

Get the global range size for a specific dimension.

Returns:

The size

Return type:

int

get_local_range(idx)

Get the local range size for a specific dimension.

Returns:

The size

Return type:

int

get_local_linear_range()

Return the total number of work-items in the work-group.

get_global_linear_range()

Return the total number of work-items in the work-group.

get_group()

Returns the group.

Returns:

A group object.