guberti commented on code in PR #12495:
URL: https://github.com/apache/tvm/pull/12495#discussion_r961499633


##########
python/tvm/micro/session.py:
##########
@@ -275,27 +277,45 @@ def compile_and_create_micro_session(
 
     project_options: dict
         Options for the microTVM API Server contained in template_project_dir.
-    """
 
-    temp_dir = utils.tempdir()
-    # Keep temp directory for generate project
-    temp_dir.set_keep_for_debug(True)
-    model_library_format_path = temp_dir / "model.tar.gz"
-    with open(model_library_format_path, "wb") as mlf_f:
-        mlf_f.write(mod_src_bytes)
+    build_dir: str
+        if debug is False: The path to save the generated microTVM Project.
+        if debug is True: The path to a generated microTVM Project for 
debugging.
 
-    try:
-        template_project = 
project.TemplateProject.from_directory(template_project_dir)
-        generated_project = template_project.generate_project_from_mlf(
-            model_library_format_path,
-            str(temp_dir / "generated-project"),
+    debug: bool
+        skips the project generation and opens transport to the project at the 
project_dir address.
+    """
+
+    if debug:
+        project_dir = Path(build_dir)
+        assert Path(build_dir).is_dir(), f"{build_dir} does not exist."
+        generated_project = project.GeneratedProject.from_directory(
+            str(project_dir / "generated-project"),
             options=json.loads(project_options),
         )
-    except Exception as exception:
-        logging.error("Project Generate Error: %s", str(exception))
-        raise exception
+    else:
+        if build_dir:
+            temp_dir = utils.tempdir(custom_path=build_dir, 
keep_for_debug=True)
+        else:
+            temp_dir = utils.tempdir()
+
+        model_library_format_path = temp_dir / "model.tar.gz"
+        with open(model_library_format_path, "wb") as mlf_f:
+            mlf_f.write(mod_src_bytes)
+
+        try:
+            template_project = 
project.TemplateProject.from_directory(template_project_dir)
+            generated_project = template_project.generate_project_from_mlf(
+                model_library_format_path,
+                str(temp_dir / "generated-project"),
+                options=json.loads(project_options),
+            )
+        except Exception as exception:
+            logging.error("Project Generate Error: %s", str(exception))
+            raise exception
+
+        generated_project.build()

Review Comment:
   I do not believe the Arduino implementation does this - how do we want to 
handle that?



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