You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/06/29 22:14:15 UTC

[GitHub] [tvm] junrushao1994 commented on a diff in pull request #11797: [MetaSchedule] Tuning Script Upgrade

junrushao1994 commented on code in PR #11797:
URL: https://github.com/apache/tvm/pull/11797#discussion_r910453866


##########
python/tvm/meta_schedule/testing/custom_builder_runner.py:
##########
@@ -158,15 +160,22 @@ def run_module_via_rpc(
 
     # pylint: enable=import-outside-toplevel
 
-    with tempfile.TemporaryDirectory() as tmp_dir:
-        filename = os.path.join(tmp_dir, "tvm_tmp_mod." + tar.output_format)
-        lib.export_library(filename, tar)
-        session = rpc_config.connect_server()
-        session.upload(filename)
-        _, filename = os.path.split(filename)
-        rt_mod = session.load_module(filename)
-        dev = session.device(dev_type=dev_type, dev_id=0)
-        nd_args = {}
-        for arg_key, arg_value in args.items():
-            nd_args[arg_key] = ndarray.array(arg_value, dev)
-        return continuation(rt_mod, dev, nd_args)
+    try:
+        with tempfile.TemporaryDirectory() as tmp_dir:
+            filename = os.path.join(tmp_dir, "tvm_tmp_mod." + tar.output_format)
+            if backend == "vm":
+                code, lib = lib.save()
+            lib.export_library(filename, tar)
+            session = rpc_config.connect_server()
+            session.upload(filename)
+            _, filename = os.path.split(filename)
+            rt_mod = session.load_module(filename)
+            if backend == "vm":
+                rt_mod = session.get_function("runtime.Load_Executable")(code, rt_mod)
+            dev = session.device(dev_type=dev_type, dev_id=0)
+            nd_args = {k: ndarray.array(v, dev) for k, v in args.items()}
+            return continuation(rt_mod, dev, nd_args)
+    except Exception as exc:  # pylint: disable=broad-except
+        print(
+            f"Run module {continuation.__name__} via RPC failed, exception: {exc}",
+        )

Review Comment:
   quick question: why do we need to silence the exceptions here?



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org