You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by gr...@apache.org on 2022/11/08 03:02:13 UTC
[tvm] branch main updated: [microTVM] Fix RPC session close on runtime side (#13310)
This is an automated email from the ASF dual-hosted git repository.
gromero pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new e43841d2ef [microTVM] Fix RPC session close on runtime side (#13310)
e43841d2ef is described below
commit e43841d2efec6eedaace0c9a53cd63c607b93c36
Author: Mehrdad Hessar <mh...@octoml.ai>
AuthorDate: Mon Nov 7 21:02:07 2022 -0600
[microTVM] Fix RPC session close on runtime side (#13310)
Currently, the RPC session on C/C++ side does not know if the session
was closed on Python side which causes extra read/write on transport
while the session is already closed. This commit reuses the Hexagon
approach in microTVM to shutdown the RPC session.
---
python/tvm/micro/project_api/client.py | 6 +++---
python/tvm/micro/session.py | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/python/tvm/micro/project_api/client.py b/python/tvm/micro/project_api/client.py
index f1eb115cfb..c9f889e9b6 100644
--- a/python/tvm/micro/project_api/client.py
+++ b/python/tvm/micro/project_api/client.py
@@ -85,17 +85,17 @@ class ProjectAPIClient:
@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 = {
diff --git a/python/tvm/micro/session.py b/python/tvm/micro/session.py
index 8a51f1082d..7d01baa752 100644
--- a/python/tvm/micro/session.py
+++ b/python/tvm/micro/session.py
@@ -157,6 +157,8 @@ class Session:
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)