diff --git a/python/tvm/micro/session.py b/python/tvm/micro/session.py index b9ffe25f8e6b7..d545f2e7daa4e 100644 --- a/python/tvm/micro/session.py +++ b/python/tvm/micro/session.py @@ -144,12 +144,12 @@ def __enter__(self): def __exit__(self, exc_type, exc_value, exc_traceback): """Tear down this session and associated RPC session resources.""" - self.transport.__exit__(exc_type, exc_value, exc_traceback) - - def _cleanup(self): if not self._exit_called: self._exit_called = True - self.__exit__(None, None, None) + self.transport.__exit__(exc_type, exc_value, exc_traceback) + + def _cleanup(self): + self.__exit__(None, None, None) def lookup_remote_linked_param(mod, storage_id, template_tensor, device): diff --git a/python/tvm/micro/testing.py b/python/tvm/micro/testing.py index c2c67347759c8..ef334e6814bdf 100644 --- a/python/tvm/micro/testing.py +++ b/python/tvm/micro/testing.py @@ -22,15 +22,11 @@ from typing import Union -def _check_tune_log(log_path: Union[pathlib.Path, str]): +def check_tune_log(log_path: Union[pathlib.Path, str]): """Reads tune log and check each result""" - results = [] with open(log_path, "r") as f: line = f.readline() - while line: - results.append(json.loads(line)) + while line is not None: + tune_result = json.loads(line) + assert tune_result["result"][0][0] < 1000000000.0 line = f.readline() - - for item in results: - tune_result = item["result"] - assert tune_result[0][0] < 1000000000.0 diff --git a/src/runtime/crt/host/Makefile b/src/runtime/crt/host/Makefile index 858ed52958f82..98a810e0d1b14 100644 --- a/src/runtime/crt/host/Makefile +++ b/src/runtime/crt/host/Makefile @@ -28,11 +28,11 @@ CC ?= ${PREFIX}gcc CXX ?= ${PREFIX}g++ RANLIB ?= ${PREFIX}ranlib -$(ifeq VERBOSE,1) -QUIET ?= -$(else) -QUIET = @ -$(endif) +ifeq (${VERBOSE}, 1) +QUIET ?= +else +QUIET ?= @ +endif PWD = $(shell pwd) BUILD_DIR = build diff --git a/src/runtime/rpc/rpc_endpoint.cc b/src/runtime/rpc/rpc_endpoint.cc index d76ce61c489d8..07b90058ce990 100644 --- a/src/runtime/rpc/rpc_endpoint.cc +++ b/src/runtime/rpc/rpc_endpoint.cc @@ -684,11 +684,12 @@ void RPCEndpoint::Init() { /*! * \brief Create a new RPCEndpoint instance. - * \param channel RPCChannel used to communicate + * \param channel RPCChannel used to communicate. * \param name Name of this session, used to identify log messages from this RPCEndpoint instance. - * \param The remote key reported during protocol initialization, or "%toinit" if the RPCEndpoint - * should handle this phase of the protocol for you. Some servers may prefer to access parts of - * the key to modify their behavior. + * \param remote_key The remote key reported during protocol initialization, or "%toinit" if the + * RPCEndpoint should handle this phase of the protocol for you. Some servers may prefer to access + * parts of the key to modify their behavior. + * \param fcleanup The cleanup Packed function. */ std::shared_ptr RPCEndpoint::Create(std::unique_ptr channel, std::string name, std::string remote_key, diff --git a/src/runtime/rpc/rpc_endpoint.h b/src/runtime/rpc/rpc_endpoint.h index 19611a3fe61be..ed19a3f59e58a 100644 --- a/src/runtime/rpc/rpc_endpoint.h +++ b/src/runtime/rpc/rpc_endpoint.h @@ -161,9 +161,9 @@ class RPCEndpoint { * \param channel The communication channel. * \param name The local name of the session, used for debug * \param remote_key The remote key of the session - * \param fcleanup The cleanup Packed function * if remote_key equals "%toinit", we need to re-intialize * it by event handler. + * \param fcleanup The cleanup Packed function. */ static std::shared_ptr Create(std::unique_ptr channel, std::string name, std::string remote_key, diff --git a/tests/micro/zephyr/test_zephyr.py b/tests/micro/zephyr/test_zephyr.py index 4f5d4736a8d04..b6396ce533158 100644 --- a/tests/micro/zephyr/test_zephyr.py +++ b/tests/micro/zephyr/test_zephyr.py @@ -39,7 +39,7 @@ from tvm.relay.expr_functor import ExprMutator from tvm.relay.op.annotation import compiler_begin, compiler_end -from tvm.micro.testing import _check_tune_log +from tvm.micro.testing import check_tune_log import conftest @@ -466,7 +466,7 @@ def test_autotune_conv2d(temp_dir, board, west_cmd, tvm_debug): ) assert tuner.best_flops > 0 - _check_tune_log(log_path) + check_tune_log(log_path) # Build without tuning with pass_context: diff --git a/tests/python/unittest/test_crt.py b/tests/python/unittest/test_crt.py index 487bfd454105f..62e68ab01ce53 100644 --- a/tests/python/unittest/test_crt.py +++ b/tests/python/unittest/test_crt.py @@ -35,7 +35,7 @@ from tvm.topi.utils import get_const_tuple from tvm.topi.testing import conv2d_nchw_python -from tvm.micro.testing import _check_tune_log +from tvm.micro.testing import check_tune_log BUILD = True DEBUG = False @@ -285,7 +285,7 @@ def test_autotune(): ) assert tuner.best_flops > 0 - _check_tune_log(tune_log_file) + check_tune_log(tune_log_file) # Build without tuning with pass_context: