vta#

VTA Package is a TVM backend extension to support VTA hardware.

Besides the compiler toolchain, it also includes utility functions to configure the hardware environment and access remote device through RPC.

Subpackages#

Submodules#

Package Contents#

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.

Attributes#

__version__

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()
property alu#

ALU pragma

property cfg_dict#
property dev#

Developer context

property dma_copy#

DMA copy pragma

property gemm#

GEMM intrinsic

property mock#

A mock version of the Environment

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

property target#
property target_host#

The target host

property target_vta_cpu#
DEBUG_DUMP_INSN#
DEBUG_DUMP_UOP#
DEBUG_SKIP_READ_BARRIER#
DEBUG_SKIP_WRITE_BARRIER#
MAX_XFER#
acc_scope = 'local.acc_buffer'#
current#
inp_scope = 'local.inp_buffer'#
wgt_scope = 'local.wgt_buffer'#
__enter__()[源代码]#
__exit__(ptype, value, trace)[源代码]#
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'[源代码]#