mehrdadh commented on a change in pull request #8715:
URL: https://github.com/apache/tvm/pull/8715#discussion_r688120358
##########
File path: python/tvm/micro/build.py
##########
@@ -57,3 +61,57 @@ def get_standalone_crt_dir() -> str:
raise CrtNotFoundError()
return STANDALONE_CRT_DIR
+
+
+def autotvm_module_loader(
+ template_project_dir: str,
+ project_options: dict = None,
+):
+ """Configure a new adapter.
+
+ Parameters
+ ----------
+ template_project_dir: str
+ Path to the template project directory on the runner.
+
+ project_options : dict
+ Opt
+ compiler options specific to this build.
+
+ workspace_kw : Optional[dict]
+ Keyword args passed to the Workspace constructor.
+ """
+ if isinstance(template_project_dir, pathlib.Path):
+ template_project_dir = str(template_project_dir)
+ elif not isinstance(template_project_dir, str):
+ raise TypeError(f"Incorrect type {type(template_project_dir)}.")
+
+ @contextlib.contextmanager
+ def module_loader(remote_kw, build_result):
+ with open(build_result.filename, "rb") as build_file:
+ build_result_bin = build_file.read()
+
+ tracker = _rpc.connect_tracker(remote_kw["host"], remote_kw["port"])
+ remote = tracker.request(
+ remote_kw["device_key"],
+ priority=remote_kw["priority"],
+ session_timeout=remote_kw["timeout"],
+ session_constructor_args=[
+ "tvm.micro.compile_and_create_micro_session",
+ build_result_bin,
+ template_project_dir,
+ json.dumps(project_options),
+ ],
+ )
+ system_lib = remote.get_function("runtime.SystemLib")()
+ yield remote, system_lib
Review comment:
done.
--
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]