_ffi.runtime_ctypes#

Common runtime ctypes.

class tvm._ffi.runtime_ctypes.ArgTypeCode[源代码]#

Type code used in API calls

class tvm._ffi.runtime_ctypes.DataType(type_str)[源代码]#

TVM datatype structure

class tvm._ffi.runtime_ctypes.DataTypeCode[源代码]#

DataType code in DLTensor.

class tvm._ffi.runtime_ctypes.Device(device_type, device_id)[源代码]#

TVM device strucure.

Typically constructed using convenience function tvm.runtime.device().

Exposes uniform interface to device-specific APIs such as CUDA or OpenCL. Some properties may return None depending on whether an API exposes that particular property.

NOTE! The integer values in MASK2STR and STR2MASK must correspond to the values provided by the DLDeviceType and TVMDeviceExtType enums.

_GetDeviceAttr(device_type, device_id, attr_id)[源代码]#

Internal helper function to invoke runtime.GetDeviceAttr

property api_version#

Returns version number of the SDK used to compile TVM.

For example, CUDA_VERSION for cuda or VK_HEADER_VERSION for Vulkan.

Returns device value for cuda, rocm, opencl, and vulkan. Returns remote device value for RPC devices. Returns None for all other devices.

versionint or None

The version of the SDK

property compute_version#

Get compute version number as string.

Returns maximum API version (e.g. CUDA/OpenCL/Vulkan) supported by the device.

Returns device value for cuda, rocm, opencl, and vulkan. Returns remote device value for RPC devices. Returns None for all other devices.

versionstr or None

The version string in major.minor format.

create_raw_stream()[源代码]#

Create a new runtime stream at the context.

User should free the stream after use.

streamTVMStreamHandle

The created runtime stream.

property device_name#

Return the vendor-specific name of device.

Returns device value for cuda, rocm, opencl, and vulkan. Returns remote device value for RPC devices. Returns None for all other devices.

device_namestr or None

The name of the device.

property driver_version#

Returns version number of the driver

Returns driver vendor’s internal version number. (e.g. “450.408.256” for nvidia-driver-450)

Returns device value for opencl and vulkan. Returns remote device value for RPC devices. Returns None for all other devices.

versionstr or None

The version string in major.minor.patch format.

property exist#

Whether this device exists.

Returns True if TVM has support for the device, if the physical device is present, and the device is accessible through appropriate drivers (e.g. cuda/vulkan).

existbool

True if the device exists

free_raw_stream(stream)[源代码]#

Free a created stream handle.

streamTVMStreamHandle

The stream which should to be released.

property max_clock_rate#

Return the max clock frequency of device (kHz).

Returns device value for cuda, rocm, and opencl. Returns remote device value for RPC devices. Returns None for all other devices.

max_clock_rateint or None

The maximum clock frequency of the device (kHz)

property max_shared_memory_per_block#

Total amount of shared memory per block in bytes.

Returns device value for cuda, rocm, opencl, and vulkan. Returns remote device value for RPC devices. Returns None for all other devices.

max_shared_memory_per_blockint or None

Total amount of shared memory per block in bytes

property max_thread_dimensions#

Return the maximum size of each thread axis

Returns device value for cuda, rocm, opencl, and vulkan. Returns remote device value for RPC devices. Returns None for all other devices.

dims: List of int, or None

The maximum length of threadIdx.x, threadIdx.y, threadIdx.z

property max_threads_per_block#

Maximum number of threads on each block.

Returns device value for cuda, metal, rocm, opencl, and vulkan devices. Returns remote device value for RPC devices. Returns None for all other devices.

max_threads_per_blockint or None

The number of threads on each block

property multi_processor_count#

Return the number of compute units in the device.

Returns device value for cuda, rocm, and opencl. Returns remote device value for RPC devices. Returns None for all other devices.

multi_processor_countint or None

Thee number of compute units in the device

set_raw_stream(stream)[源代码]#

Set a created stream handle.

streamTVMStreamHandle

The stream which should to be set to the device.

sync(stream=None)[源代码]#

Synchronize until jobs finished at the context.

streamTVMStreamHandle

Jobs in this stream should be finished.

texture_spatial_limit()[源代码]#

Returns limits for textures by spatial dimensions

limitint or None

Maximum size of the texture by spatial dimensions

property warp_size#

Number of threads that execute concurrently.

Returns device value for cuda, rocm, and vulkan. Returns 1 for metal and opencl devices, regardless of the physical device. Returns remote device value for RPC devices. Returns None for all other devices.

warp_sizeint or None

Number of threads that execute concurrently

class tvm._ffi.runtime_ctypes.ObjectRValueRef(obj)[源代码]#

Represent an RValue ref to an object that can be moved.

objtvm.runtime.Object

The object that this value refers to

class tvm._ffi.runtime_ctypes.TVMArray[源代码]#

TVMValue in C API

tvm._ffi.runtime_ctypes.TVMArrayHandle#

:py:class:`tvm._ffi.runtime_ctypes.LP_TVMArray`的别名

class tvm._ffi.runtime_ctypes.TVMByteArray[源代码]#

Temp data structure for byte array.