Lunderberg commented on code in PR #12727:
URL: https://github.com/apache/tvm/pull/12727#discussion_r971025248
##########
python/tvm/contrib/hexagon/session.py:
##########
@@ -88,14 +88,23 @@ def __enter__(self):
self._rpc_receive_buffer_size_bytes,
],
)
+ func =
self._rpc.get_function("device_api.hexagon.acquire_resources")
+ func()
return self
except RuntimeError as exception:
raise exception
def __exit__(self, exc_type, exc_value, exc_traceback):
- # close session to the tracker
- del self._rpc
+ try:
+ func =
self._rpc.get_function("device_api.hexagon.release_resources")
+ func()
+ except RuntimeError as exception:
+ # do nothing, as we are shutting down
Review Comment:
Redacted Nitpick: I was going to make a nitpick about `...` and `pass`, but
it looks like it's [a more open
discussion](https://stackoverflow.com/questions/55274977/when-is-the-usage-of-the-python-ellipsis-to-be-preferred-over-pass/67769536)
than I had thought. I generally see `...` for function stubs and `pass` for
explicitly doing nothing in a block, but my certainty has been shaken.
##########
python/tvm/contrib/hexagon/session.py:
##########
@@ -88,14 +88,23 @@ def __enter__(self):
self._rpc_receive_buffer_size_bytes,
],
)
+ func =
self._rpc.get_function("device_api.hexagon.acquire_resources")
+ func()
return self
except RuntimeError as exception:
raise exception
def __exit__(self, exc_type, exc_value, exc_traceback):
- # close session to the tracker
- del self._rpc
+ try:
+ func =
self._rpc.get_function("device_api.hexagon.release_resources")
+ func()
+ except RuntimeError as exception:
Review Comment:
Looks like this is the line giving a lint error. Where value of the
exception isn't required, the `as` statement can be removed, so this line could
be just `except RuntimeError`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]