[Auto-Tuning VTA solved] Using simulator to tune resnet18 on VTA successfully

Hi, there,

I can run tune_relay_vta.py with VTA simulator fsim in another way.

Please try the following steps (tvm version = v0.10.dev0).

Step 1.

eidt TVM_ROOT/vta/python/vta/exec/rpc_server.py: Line 42

def server_start():
    """VTA RPC server extension."""
    # pylint: disable=unused-variable
    curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
    proj_root = os.path.abspath(os.path.join(curr_path, "../../../../"))
    dll_path = find_libvta("libvta_fsim")[0]  # <== HERE!
    cfg_path = os.path.abspath(os.path.join(proj_root, "3rdparty/vta-hw/config/vta_config.json"))

Please check if there is the dynamic library file libvta_fsim.so in TVMROOT/build.

Step 2.

edit TVM_ROOT/vta/tutorials/autotvm/tune_relay_vta.py: Line 218

tuning_option = {
    "log_filename": log_file,
    "tuner": "random",
    "n_trial": 1000,
    "early_stopping": None,
    "measure_option": autotvm.measure_option(
        builder=autotvm.LocalBuilder(),
        runner=autotvm.RPCRunner(
            env.TARGET,
            host=tracker_host,
            port=tracker_port,
            number=5,
            timeout=60,
            module_loader=None  # <== HERE!

            # check_correctness=True, # TODO: re-enable when check_correctness works again.
        ),
    ),
}

, which same same as the way by denis above.

Step 3.

run tracker & server

python -m tvm.exec.rpc_tracker --host=0.0.0.0 --port=9190 &
python -m vta.exec.rpc_server --tracker=0.0.0.0:9190 --key=sim &

Use vta.exec.rpc_server not tvm.exec.rpc_server for RPC server because VTA modefiled rpc_server loads fsim module.

Step 4.

run the tuner script.

python TVM_ROOT/vta/tutorials/autotvm/tune_relay_vta.py

By the above steps, I’ve succeeded in running the tuner with fsim although lots of warning messages being produced like:

Warning: Trying to bind buffer to another one with lower alignment requirement  required_alignment=256, provided_alignment=128

I’ve not tried tsim, but maybe you can use libvta_tsim instead of libvta_fsim in Step 1. (Of cause, you have to build not only tvm with tsim option but also chisel codes in TVMROOT/3rdparty/vta-hw/hardware/chisel)

1 Like