Skip to content

Commit

Permalink
[RPC] Lazily import micro when starting an RPC server (apache#6505)
Browse files Browse the repository at this point in the history
* [RPC] Lazily import micro when starting an RPC server

Since apache#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
  • Loading branch information
lhutton1 authored and trevor-m committed Sep 18, 2020
1 parent b5bd021 commit ba3c0b4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/tvm/exec/rpc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import sys
import logging
import tvm
from tvm import micro
from .. import rpc


Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit ba3c0b4

Please sign in to comment.