I can successfully build the runtime lib and load in VTA Runtime;
But, It doesn’t seem to be running on SIM at all !! The data for each item is empty.
Sim Run_Insn has not been used once;
====================================================================
with autotvm.tophub.context(target):
# Populate the shape and data type dictionary for ImageNet classifier input
dtype_dict = {"data": "float32"}
shape_dict = {"data": (env.BATCH, 3, 224, 224)}
# Get off the shelf gluon model, and convert to relay
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
# Update shape and type dictionary
shape_dict.update({k: v.shape for k, v in params.items()})
dtype_dict.update({k: str(v.dtype) for k, v in params.items()})
with tvm.transform.PassContext(opt_level=3):
with relay.quantize.qconfig(global_scale=8.0, skip_conv_layers=[0]):
mod = relay.quantize.quantize(mod, params=params)
# Perform graph packing and constant folding for VTA target
assert env.BLOCK_IN == env.BLOCK_OUT
# do device annotation if target is intelfocl or sim
relay_prog = graph_pack(
mod["main"],
env.BATCH,
env.BLOCK_OUT,
env.WGT_WIDTH,
start_name=start_name,
stop_name=stop_name,
device_annot=(env.TARGET == "intelfocl"),
)
with vta.build_config(
opt_level=3, disabled_pass={"AlterOpLayout", "tir.CommonSubexprElimTIR"}
):
graph, lib, params = relay.build(
relay_prog, target=tvm.target.Target(target, host=env.target_host), params=params
)
temp = utils.tempdir()
lib.export_library(temp.relpath("graphlib.tar"))
remote.upload(temp.relpath("graphlib.tar"))
lib = remote.load_module("graphlib.tar")
m = graph_executor.create(graph, lib, ctx)
image = np.random.logistic(size=(env.BATCH, 3, 224, 224))
m.set_input("data", image)
if env.TARGET in ["sim", "tsim"]:
simulator.clear_stats()
m.module.time_evaluator("run", ctx, number=1, repeat=1)
if env.TARGET in ["sim", "tsim"]:
sim_stats = simulator.stats()
print("execution statistics:")
for k, v in sim_stats.items():
print("\t{:<16}: {:>16}".format(k, v))