vta#

VTA 软件包是支持 VTA 硬件的 TVM 后端扩展。

除了编译器工具链,它还包括配置硬件环境和通过 RPC 访问远程设备的实用功能。

Submodules#

Attributes#

Classes#

Environment

Hardware configuration object.

Functions#

download_bitstream()

Downloads a cached bitstream corresponding to the current config

get_bitstream_path()

Returns the path to the cached bitstream corresponding to the current config

get_env()

Get the current VTA Environment.

module_loader([bitstream])

Construct a ModuleLoader implementation specialized for VTA.

program_fpga(remote[, bitstream])

Upload and program bistream

reconfig_runtime(remote)

Reconfigure remote runtime based on current hardware spec.

Package Contents#

class vta.Environment(cfg)[源代码]#

Bases: object

Hardware configuration object.

This object contains all the information needed for compiling to a specific VTA backend.

Parameters#

cfgdict of str to value.

The configuration parameters.

Example#

# the following code reconfigures the environment
# temporarily to attributes specified in new_cfg.json
new_cfg = json.load(json.load(open("new_cfg.json")))
with vta.Environment(new_cfg):
    # env works on the new environment
    env = vta.get_env()
__enter__()[源代码]#
__exit__(ptype, value, trace)[源代码]#
ACC_BUFF_SIZE#
ACC_ELEM_BITS#
ACC_ELEM_BYTES#
ACC_WIDTH#
BATCH#
BITSTREAM#
BLOCK_IN#
BLOCK_OUT#
DEBUG_DUMP_INSN#
DEBUG_DUMP_UOP#
DEBUG_SKIP_READ_BARRIER#
DEBUG_SKIP_WRITE_BARRIER#
INP_BUFF_SIZE#
INP_ELEM_BITS#
INP_ELEM_BYTES#
INP_WIDTH#
MAX_XFER#
MODEL#
OUT_BUFF_SIZE#
OUT_ELEM_BITS#
OUT_ELEM_BYTES#
OUT_WIDTH#
UOP_BUFF_SIZE#
WGT_BUFF_SIZE#
WGT_ELEM_BITS#
WGT_ELEM_BYTES#
WGT_WIDTH#
_dev_ctx = None#
_last_env = None#
_mock_env = None#
acc_dtype#
acc_scope = 'local.acc_buffer'#
property alu#

ALU pragma

property cfg_dict#
current = None#
property dev#

Developer context

property dma_copy#

DMA copy pragma

property gemm#

GEMM intrinsic

inp_dtype#
inp_scope = 'local.inp_buffer'#
property mock#

A mock version of the Environment

The ALU, dma_copy and intrinsics will be mocked to be nop.

mock_mode = False#
out_dtype#
pkg#
property target#
property target_host#

The target host

property target_vta_cpu#
wgt_dtype#
wgt_scope = 'local.wgt_buffer'#
vta.download_bitstream()[源代码]#

Downloads a cached bitstream corresponding to the current config

vta.get_bitstream_path()[源代码]#

Returns the path to the cached bitstream corresponding to the current config

Returns#

bit_path: str

Corresponding to the filepath of the bitstream

vta.get_env()[源代码]#

Get the current VTA Environment.

Returns#

envEnvironment

The current environment.

vta.module_loader(bitstream=None)[源代码]#

Construct a ModuleLoader implementation specialized for VTA.

Parameters#

bitsreamOptional[str]

Path to the bitstream to write prior to uploading code.

Returns#

ModuleLoader :

The ModuleLoader instance.

vta.program_fpga(remote, bitstream=None)[源代码]#

Upload and program bistream

Parameters#

remoteRPCSession

The TVM RPC session

bitstreamstr, optional

Path to a local bistream file. If unset, tries to download from cache server.

vta.reconfig_runtime(remote)[源代码]#

Reconfigure remote runtime based on current hardware spec.

Parameters#

remoteRPCSession

The TVM RPC session

vta.__version__ = '0.1.0'[源代码]#