From de0c3a424091d5cd2722615140acbe5ba93df959 Mon Sep 17 00:00:00 2001 From: lhutton1 <35535092+lhutton1@users.noreply.github.com> Date: Thu, 17 Sep 2020 22:49:32 +0100 Subject: [PATCH] [RPC] Lazily import micro when starting an RPC server (#6505) * [RPC] Lazily import micro when starting an RPC server Since #6334 the RPC server cannot be started unless USE_MICRO is enabled. I've tracked this down to an import in `python/tvn/exec/rpc_server.py`: `from tvm import micro` in the top level list of imports. This will mean that we try to import micro when it's not been built. Fix this by lazily importing micro when initializing an rpc server with micro enabled. Change-Id: I8f22d81e215cfe4ac0662b0a99bdf02a3e91f90c * fix lint Change-Id: I8b78b678374bc82b3b66a7b3595ed4f1684e7d90 --- python/tvm/exec/rpc_server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/tvm/exec/rpc_server.py b/python/tvm/exec/rpc_server.py index 7233d71ee197..345e44718ac3 100644 --- a/python/tvm/exec/rpc_server.py +++ b/python/tvm/exec/rpc_server.py @@ -25,7 +25,6 @@ import sys import logging import tvm -from tvm import micro from .. import rpc @@ -70,6 +69,8 @@ def init_utvm(args): args : argparse.Namespace parsed args from command-line invocation """ + from tvm import micro # pylint: disable=import-outside-toplevel + if args.utvm_dev_config and args.utvm_dev_id: raise RuntimeError("only one of --utvm-dev-config and --utvm-dev-id allowed")