Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadh committed Sep 16, 2021
1 parent 607af09 commit 2b31a1f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 26 deletions.
8 changes: 4 additions & 4 deletions python/tvm/micro/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 4 additions & 8 deletions python/tvm/micro/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions src/runtime/crt/host/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions src/runtime/rpc/rpc_endpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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> RPCEndpoint::Create(std::unique_ptr<RPCChannel> channel,
std::string name, std::string remote_key,
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/rpc/rpc_endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<RPCEndpoint> Create(std::unique_ptr<RPCChannel> channel, std::string name,
std::string remote_key,
Expand Down
4 changes: 2 additions & 2 deletions tests/micro/zephyr/test_zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/python/unittest/test_crt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2b31a1f

Please sign in to comment.