Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[microTVM] Fix RPC session close on runtime side #13310

Merged
merged 3 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/tvm/micro/project_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ def __init__(

@property
def is_shutdown(self):
return self.read_file is None
return self.read_file.closed

def shutdown(self):
if self.is_shutdown:
if self.is_shutdown: # pylint: disable=using-constant-test
return

self.read_file.close()
self.write_file.close()

def _request_reply(self, method, params):
if self.is_shutdown:
if self.is_shutdown: # pylint: disable=using-constant-test
raise ConnectionShutdownError("connection already closed")

request = {
Expand Down
2 changes: 2 additions & 0 deletions python/tvm/micro/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def __exit__(self, exc_type, exc_value, exc_traceback):
if not self._exit_called:
self._exit_called = True
self.transport.__exit__(exc_type, exc_value, exc_traceback)
shutdown_func = self._rpc._sess.get_function("CloseRPCConnection")
shutdown_func()

def _cleanup(self):
self.__exit__(None, None, None)
Expand Down