kparzysz-quic commented on a change in pull request #10311:
URL: https://github.com/apache/tvm/pull/10311#discussion_r819105614



##########
File path: tests/python/contrib/test_hexagon/test_launcher.py
##########
@@ -217,24 +223,23 @@ def test_graph_executor(android_serial_number, 
tvm_tracker_host, tvm_tracker_por
         lowered.get_lib().save(dso_binary_path)
 
     if not android_serial_number:
-        pytest.skip("Skip hardware test since ANDROID_SERIAL_NUMBER is not 
set.")
+        pytest.skip(msg="Skip hardware test since ANDROID_SERIAL_NUMBER is not 
set.")
 
     rpc_info = {
-      "rpc_tracker_host" : tvm_tracker_host,
-      "rpc_tracker_port" : tvm_tracker_port,
-      "rpc_server_port" : 7070,
+        "rpc_tracker_host": tvm_tracker_host,
+        "rpc_tracker_port": tvm_tracker_port,
+        "rpc_server_port": 7070,
     }
     launcher = HexagonLauncher(serial_number=android_serial_number, 
rpc_info=rpc_info)
     launcher.upload(dso_binary_path, dso_binary)
     launcher.start_server()
 
     with launcher.start_session() as sess:
         graph_mod = launcher.get_graph_executor(lowered.get_graph_json(), 
dso_binary, sess)
-        weight_in = np.random.rand(5, 5, 3, 8).astype(dtype=dtype)
-        data_in = np.random.rand(1, 64, 64, 3).astype(dtype=dtype)
-        graph_mod.set_input(weight=weight_in)
-        graph_mod.run(data=data_in)
+        graph_mod.set_input(**params)
+        graph_mod.run(**inputs)
         hexagon_output = graph_mod.get_output(0).numpy()
+        launcher.stop_server()

Review comment:
       The idea about the `with` indent is that it starts a session, and 
leaving the indent should stop the session.  This isn't really happening right 
now because there is no way (that I could see) to close the connection by doing 
something like `rpc.close()` in the `__exit__` function in `Session`.
   According to that, the `stop_server()` should happen after the session has 
been closed, i.e. outside of the indent.  That is,
   ```
   with launcher.start_session() as sess:
       # run, etc.
   # getting here should terminate sess
   launcher.stop_server()
   ```
   I noticed this in several places in this file.

##########
File path: tests/python/contrib/test_hexagon/test_launcher.py
##########
@@ -50,12 +51,12 @@ def test_add(android_serial_number, tvm_tracker_host, 
tvm_tracker_port):
     func.save(dso_binary_path)
 
     if not android_serial_number:
-        pytest.skip("Skip hardware test since ANDROID_SERIAL_NUMBER is not 
set.")
+        pytest.skip(msg="Skip hardware test since ANDROID_SERIAL_NUMBER is not 
set.")
 
     rpc_info = {
-      "rpc_tracker_host" : tvm_tracker_host,
-      "rpc_tracker_port" : tvm_tracker_port,
-      "rpc_server_port" : 7070,
+        "rpc_tracker_host": tvm_tracker_host,
+        "rpc_tracker_port": tvm_tracker_port,
+        "rpc_server_port": 7070,

Review comment:
       There is a problem I just realized with the RPC server: there is no way 
that I know of to gracefully shut it down.  When `stop_server()` terminates the 
server, this leaves the socket (7070) in a `TIME_WAIT` state.  As a 
consequence, in the next test, `start_server()` would fail to bind to 7070, 
which would still be considered "in use", and the test as a whole would fail.
   
   My workaround for that was to use a different server port in each test, i.e. 
7070, 7071, etc., at least in the short term, until the connection shutdown can 
be improved.




-- 
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]


Reply via email to