diff --git a/vta/tutorials/autotvm/tune_relay_vta.py b/vta/tutorials/autotvm/tune_relay_vta.py index 2cec62fa9cae..273f0af4af03 100644 --- a/vta/tutorials/autotvm/tune_relay_vta.py +++ b/vta/tutorials/autotvm/tune_relay_vta.py @@ -340,18 +340,6 @@ def _topi_nn_conv2d(*args, **kwargs): def tune_and_evaluate(tuning_opt): - if env.TARGET != "sim": - # Get remote from fleet node - remote = autotvm.measure.request_remote( - env.TARGET, tracker_host, tracker_port, timeout=10000 - ) - # Reconfigure the JIT runtime and FPGA. - vta.reconfig_runtime(remote) - vta.program_fpga(remote, bitstream=None) - else: - # In simulation mode, host the RPC server locally. - remote = rpc.LocalSession() - # Register VTA tuning tasks register_vta_tuning_tasks() @@ -407,6 +395,19 @@ def tune_and_evaluate(tuning_opt): print("Tuning...") tune_tasks(tasks, **tuning_opt) + # evaluate with tuning history + if env.TARGET != "sim": + # Get remote from fleet node + remote = autotvm.measure.request_remote( + env.TARGET, tracker_host, tracker_port, timeout=10000 + ) + # Reconfigure the JIT runtime and FPGA. + vta.reconfig_runtime(remote) + vta.program_fpga(remote, bitstream=None) + else: + # In simulation mode, host the RPC server locally. + remote = rpc.LocalSession() + # compile kernels with history best records with autotvm.tophub.context(target, extra_files=[log_file]): # Compile network @@ -425,9 +426,9 @@ def tune_and_evaluate(tuning_opt): # Export library print("Upload...") temp = utils.tempdir() - lib.save(temp.relpath("graphlib.o")) - remote.upload(temp.relpath("graphlib.o")) - lib = remote.load_module("graphlib.o") + lib.export_library(temp.relpath("graphlib.tar")) + remote.upload(temp.relpath("graphlib.tar")) + lib = remote.load_module("graphlib.tar") # Generate the graph runtime ctx = remote.ext_dev(0) if device == "vta" else remote.cpu(0)