vta#

这个文档包含 python API 到 VTA 编译器工具链。

VTA Package 是 TVM 后端扩展,支持 VTA 硬件。

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

硬件信息#

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

硬件配置对象

该对象包含编译到特定 VTA 后端所需的所有信息。

cfgstr 到 value 的 dict。

配置的参数。

# 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()
vta.get_env()[源代码]#

获得当前 VTA Environment。

envEnvironment

当前环境。

RPC Utilities#

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

基于当前硬件 spec 重新配置远程运行时。

remoteRPCSession

TVM RPC 会话

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

Upload and program bistream

remoteRPCSession

TVM RPC 会话

bitstreamstr, optional

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

Compiler API#

We program VTA using TVM, so the compiler API in vta package is only a thin wrapper to provide VTA specific extensions.

vta.build_config(debug_flag=0, **kwargs)[源代码]#

Build a build config for VTA.

debug_flagint

The dbeug flag to be passed.

kwargsdict

Additional configurations.

build_config: tvm.transform.PassContext

The build config that can be used in TVM.

# build a vta module.
with vta.build_config():
    vta_module = tvm.build(s, ...)
vta.build(*args, **kwargs)[源代码]#

Thin wrapper of tvm.build

This wrapper automatically applies VTA’s build_config if there is no user specified build_config in context.

tvm.build : The original TVM’s build function

vta.lower(*args, **kwargs)[源代码]#

Thin wrapper of tvm.lower

This wrapper automatically applies VTA’s build_config if there is no user specified build_config in context.

tvm.lower : The original TVM’s lower function