numba_dpex.core.datamodel.models

Overview

Classes

GenericPointerModel

A primitive type can be represented natively in the target in all

IntEnumLiteralModel

Representation of an object of LiteralIntEnum type using Numba’s

USMArrayDeviceModel

A data model to represent a usm array type in the LLVM IR generated for a

USMArrayHostModel

Data model for the USMNdArray type when used in a host-only function.

SyclQueueModel

Represents the native data model for a dpctl.SyclQueue PyObject.

SyclEventModel

Represents the native data model for a dpctl.SyclEvent PyObject.

RangeModel

The numba_dpex data model for a numba_dpex.kernel_api.Range PyObject.

NdRangeModel

The numba_dpex data model for a numba_dpex.kernel_api.NdRange PyObject.

AtomicRefModel

Data model for AtomicRefType.

EmptyStructModel

Data model that does not take space. Intended to be used with types that

DpctlMDLocalAccessorModel

Data model to represent DpctlMDLocalAccessorType.

LocalAccessorModel

Data model for the LocalAccessor type when used in a host-only function.

Function

get_flattened_member_count(ty)

Returns the number of fields in an instance of a given StructModel.

Classes

class GenericPointerModel(dmm, fe_type)

Bases: numba.core.datamodel.models.PrimitiveModel

A primitive type can be represented natively in the target in all usage contexts.

class IntEnumLiteralModel(dmm, fe_type)

Bases: numba.core.datamodel.models.PrimitiveModel

Representation of an object of LiteralIntEnum type using Numba’s PrimitiveModel that can be represented natively in the target in all usage contexts.

class USMArrayDeviceModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

A data model to represent a usm array type in the LLVM IR generated for a device-only kernel function.

The USMArrayDeviceModel adds an extra address space attribute to the data member. The extra attribute is needed when passing usm_ndarray array arguments to kernels that are compiled for certain OpenCL GPU devices. Note that the address space attribute is applied only to the data member and not other members of USMArrayDeviceModel that are pointers. It is done this way as other pointer members such as meminfo are not used inside a kernel and these members maybe removed from the USMArrayDeviceModel in future (refer #929).

We use separate data models for host (USMArrayHostModel) and device (USMArrayDeviceModel) as the address space attribute is only required for kernel functions and not needed for functions that are compiled for a host memory space.

class USMArrayHostModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

Data model for the USMNdArray type when used in a host-only function.

USMArrayHostModel is used by the numba_dpex.types.USMNdArray and numba_dpex.types.DpnpNdArray type and abstracts the usmarystruct_t C type defined in numba_dpex.core.runtime._usmarraystruct.h.

The USMArrayDeviceModel differs from numba’s ArrayModel by including an extra member sycl_queue that maps to _usmarraystruct.sycl_queue pointer. The _usmarraystruct.sycl_queue pointer stores the C++ sycl::queue pointer that was used to allocate the data for the dpctl.tensor.usm_ndarray or dpnp.ndarray represented by an instance of _usmarraystruct.

class SyclQueueModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

Represents the native data model for a dpctl.SyclQueue PyObject.

Numba-dpex uses a C struct as defined in numba_dpex/core/runtime._queuestruct.h to store the required attributes for a dpctl.SyclQueue Python object.

  • queue_ref: An opaque C pointer to an actual SYCL queue C++ object.

  • parent: A PyObject* that stores a reference back to the original

    dpctl.SyclQueue PyObject if the native struct is created by unboxing the PyObject.

class SyclEventModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

Represents the native data model for a dpctl.SyclEvent PyObject.

Numba-dpex uses a C struct as defined in numba_dpex/core/runtime._eventstruct.h to store the required attributes for a dpctl.SyclEvent Python object.

  • event_ref: An opaque C pointer to an actual SYCL event C++ object.

  • parent: A PyObject* that stores a reference back to the original

    dpctl.SyclEvent PyObject if the native struct is created by unboxing the PyObject.

class RangeModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

The numba_dpex data model for a numba_dpex.kernel_api.Range PyObject.

class NdRangeModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

The numba_dpex data model for a numba_dpex.kernel_api.NdRange PyObject.

class AtomicRefModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

Data model for AtomicRefType.

class EmptyStructModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

Data model that does not take space. Intended to be used with types that are presented only at typing stage and not represented physically.

class DpctlMDLocalAccessorModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

Data model to represent DpctlMDLocalAccessorType.

Must be the same structure as dpctl/syclinterface/dpctl_sycl_queue_interface.h::MDLocalAccessor.

Structure intended to be used only on host side of the kernel call.

class LocalAccessorModel(dmm, fe_type)

Bases: numba.core.datamodel.models.StructModel

Data model for the LocalAccessor type when used in a host-only function.

Functions

get_flattened_member_count(ty)

Returns the number of fields in an instance of a given StructModel.

Attributes

dpex_data_model_manager
dpjit_data_model_manager